26.01.2015, 19:27
At first, this is how to implement a custom check before the command is executed (e.g. for a admin level check):
Do you use the provided amx files in your server.cfg?
Код:
class AdminCommands { private HashMap<String, Integer> adminLevels; public AdminCommands() { adminLevels = new WeakHashMap<>(); adminLevels.put("kick", 2); } @BeforeCheck public boolean beforeCheck(Player p, String cmd, String params) { if(!adminLevels.containsKey(cmd)) return false; //Get player data if(playerData.getAdminLevel() >= adminLevels.get(cmd)) return true; //Return true = command is allowed to execute //Maybe write some message that he's not allowed: p.sendMessage(Color.GRAY, "You are not allowed to execute command /" + cmd); return false; // return false, command is not allowed to execute } @Command public boolean kick(Player player, Player target) {....} }