Hello, This is me code, I'm doing something wrong, but I Dont know what. Couse if a user has permission to monsterparty.create and monsterparty.join then it works. But when someone only has the permission monsterparty.join It does not work. Im pritty sure I'm doing something wrong. Could anyone help me? Code: public boolean execute(CommandSender sender, String[] split) { Player player = (Player) sender; player.sendMessage(ChatColor.RED + " Party Help"); player.sendMessage(ChatColor.DARK_PURPLE + "-----------------------------------------------------"); //check if user has permission to create party if (player.hasPermission("monsterparty.create")) { player.sendMessage(ChatColor.YELLOW + "/party create [Name] " + ChatColor.AQUA + "- Create a party"); player.sendMessage(ChatColor.YELLOW + "/party create [Name] :p[Password] " + ChatColor.AQUA + "- Create Password Protected Party"); player.sendMessage(ChatColor.YELLOW + "/party lock " + ChatColor.AQUA + "- Lock your party"); //check if user has permission to join party if (player.hasPermission("monsterparty.join")) { player.sendMessage(ChatColor.YELLOW + "/party join [Name] " + ChatColor.AQUA + "- Join a party"); //check if user has permission to leave party if (player.hasPermission("monsterparty.leave")) { player.sendMessage(ChatColor.YELLOW + "/party join [Name] " + ChatColor.AQUA + "- Join a party"); return true; }}} return false; } http://pastebin.com/4s8gmMGE - Jurre
All your if statements are nested, thus the if (player.hasPermission("monsterparty.join")) is only checked if player.hasPermission("monsterparty.join"). If you used indentation properly you would have seen this issue immediately (In eclipse you can simply select the whole code with ctrl+A and then press crtl+I to fix the indentatin) Also read this: http://forums.bukkit.org/threads/the-power-of-indentation-write-easly-readable-code.95083/ and this if you want to have nice code automatically: http://forums.bukkit.org/threads/how-to-make-eclipse-clean-up-format-your-code-for-you.78574/
First try this, might even help you fix your problem yourself: http://forums.bukkit.org/threads/the-power-of-indentation-write-easly-readable-code.95083/
Code:java if(somecondition == true) {if(someother == true) {this is nested}} if(somecondition == true) { }if(someother == true) {this is not nested}