Saber-Factions/src/main/java/com/massivecraft/factions/cmd/CmdReload.java

55 lines
1.6 KiB
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.discord.Discord;
import com.massivecraft.factions.listeners.FactionsPlayerListener;
import com.massivecraft.factions.shop.ShopConfig;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdReload extends FCommand {
/**
* @author FactionsUUID Team
*/
public CmdReload() {
super();
this.aliases.add("reload");
this.requirements = new CommandRequirements.Builder(Permission.RELOAD).build();
}
@Override
public void perform(CommandContext context) {
long timeInitStart = System.currentTimeMillis();
Conf.load();
Conf.save();
ShopConfig.loadShop();
FactionsPlugin.getInstance().reloadConfig();
FactionsPlugin.getInstance().loadLang();
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
FactionsPlugin.getInstance().factionsFlight = true;
}
if (!FactionsPlugin.getInstance().mc17) {
FactionsPlayerListener.loadCorners();
}
Discord.setupDiscord();
//Recheck if commands should truly be disabled and rebuild.
FCmdRoot.instance.addVariableCommands();
FCmdRoot.instance.rebuild();
long timeReload = (System.currentTimeMillis() - timeInitStart);
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RELOAD_DESCRIPTION;
}
}