Hey everybody! I am making a team plugin, and I believe I have written it correct, but when I type the command in-game, nothing happens. Code:java public boolean onCommand1(CommandSender sender, Command cmd, String commandLabel, String[] args, Player player) {if(cmd.getName().equalsIgnoreCase("class")) {if(args.length == 0) {sender.sendMessage(ChatColor.GREEN + "/class <class>");} else {PVPType pvptype = PVPType.searchByName(args[0]);if(pvptype != null) {pvptype.applyItems(player);sender.sendMessage(ChatColor.GREEN + "You are now an" + pvptype);}}}return false;} (This is spaced correctly, for some reason it won't paste in right, so that's not a problem.) Plugin.yml: Code: name: ZenithPvpTeams version: 1.0 main: me.bdking00.zenithpvpteams.Main commands: class: description: Choose classes setspawnred: description: Set red spawn setspawnblue: description: Set blue spawn permissions: znpvp.engineer: description: Be an engineer default: op znpvp.axeman: description: Be an axeman default: op znpvp.setspawn: description: Set the spawns default: op
BDKing88 I'm not too sure about this, as I've never tried it and am a Java noob, but I believe the method name has to be onCommand, otherwise it will not work. If you have multiple commands, and don't want all of them in one method (I know it can look terrible if you do), consider making separate classes for each command.
Code:java public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {if(commandLabel.equalsIgnoreCase("class")) {if(args.length == 0) {sender.sendMessage(ChatColor.GREEN + "/class <class>");} else {PVPType pvptype = PVPType.searchByName(args[0]);if(pvptype != null) {pvptype.applyItems(player);sender.sendMessage(ChatColor.GREEN + "You are now an" + pvptype);}}}return false;} Try this. I removed the 1 from onCommand, Removed the player argument, and changed the cmd.getName() to commandLabel.equalsIgnoreCase(). Oh, and in the future. You only need one onCommand, you've made 3 different ones from what I can tell. Code:java public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]){if(commandLabel.equalsIgnoreCase("one"){doStuff();} else if(commandLabel.equalsIgnoreCase("two"){doOtherStuff();}}
BDKing88 Is that code in a separate class? If so, make sure to let the class implement CommandExecutor, and register the command(s) in your onEnable() method.
BDKing88 Paste your whole class. For one, you use the variable 'player' in your onCommand but give us no clue as to what player could be. If you paste the whole class we can help you better.