Hi, i'm trying to make my own command to set someones/your level in-game. But when i use the command in-game it says "An internal error occured while attempting to perform this command". Currently i'm aiming at changing the game level but i'd like to make a sort of a rpg plugin later on. I just started with java and before posting this i searched the forum & tried to fix it myself for an hour. Code: @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (command.getName().equalsIgnoreCase("levelset") && sender instanceof Player) { Player player = (Player) sender; int intendedlevel = Integer.parseInt(args[0]); if (args[1].length() == 0) { player.setLevel(intendedlevel); } else { Player target = Bukkit.getPlayerExact(args[1]); String targetname = target.getDisplayName(); targetname.setLevel(intendedlevel); player.sendMessage(ChatColor.RED + "Level of player" + args[1] + "set to" + intendedlevel); return true; } } else { sender.sendMessage(ChatColor.RED + "You are not permitted to do this."); } sender.sendMessage(ChatColor.RED + "This command does not exist."); return false; } Thank you for your time and sorry for asking you to help me with what is probably a very trivial problem. Also i have one more question, into Code: public boolean onCommand(CommandSender sender, Command command, String label, String[] args) can be put more than one commands, right?
@Deity onCommand can handle as much commands as you want. My guess is that you have an ArrayOutOfBounds exception because you don't check the length of args.