TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java
Lemon ed2f15cc54 Patches
1. Remove marco from dev
2. Add namehistory
3. Fix grammar issues
4. Actually use CoreProtect bridge to rollback players
5.  Improve automatic wiper
2017-10-13 23:35:11 +05:00

45 lines
1.4 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import net.pravian.aero.command.handler.SimpleCommandHandler;
import org.bukkit.ChatColor;
public class CommandLoader extends FreedomService
{
@Getter
private final SimpleCommandHandler<TotalFreedomMod> handler;
public CommandLoader(TotalFreedomMod plugin)
{
super(plugin);
handler = new SimpleCommandHandler<>(plugin);
}
@Override
protected void onStart()
{
handler.clearCommands();
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory(plugin));
handler.setCommandClassPrefix("Command_");
handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command.");
handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console.");
handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players.");
handler.loadFrom(FreedomCommand.class.getPackage());
handler.registerAll("TotalFreedomMod", true);
FLog.info("Loaded " + handler.getExecutors().size() + " commands.");
}
@Override
protected void onStop()
{
handler.clearCommands();
}
}