How I set that when a player do a command, give it a permission? And how I set the opposite (when a player do a command remove a permission from he)?
PHP: public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(command.getName().equalsIgnoreCase("yourcommand") && s.hasPermission("your.perm.here")){ // If typed command is your command and has permission Player s = (Player)sender; // defines player s as the person doing command// do stuff } return true;
Code:java Permissible perm; //Ading permissions:PermissionAttachment permInfo = perm.addAttachment(plugin, permission, value); // Removing permissions perm.removeAttachment(permInfo);
I am still a little confused on what you are trying to achieve. Here is what I can interpret. You are trying to add a Permision Node to a Player when they do a certain command. Code: public void addPermission(String player, String permissionNode) { ru.tehkode.permissions.bukkit.PermissionsEx.getUser(player).addPermission(permissionNode); } public void removePermission(String player, String permissionNode) { ru.tehkode.permissions.bukkit.PermissionsEx.getUser(player).removePermission(permissionNode); }
Wundark Your code just works with PermissionsEx. Better use Vault or even better bukkits API (like ferrybig still suggested... BTW: A player is a Permissible: player.addAttachment(plugin, "your.permission", boolean); ).