PermissionsBukkit player group manipulation
Mitsugaru opened this issue ยท 11 comments
Hey there,
So, I've been trying to use the Vault methods for adding/removing groups to a player with the PermissionsBukkit system. I had noticed that it was not actually changing the groups on command. After looking at your source code, I noticed that I had to have the String object of the "world" set to null, or else it would return false.
However, when giving it a null string object for the world parameter, I get the following:
15:23:38 [WARNING] Unexpected exception while parsing console command
org.bukkit.command.CommandException: Unhandled exception executing command 'jail' in plugin KarmicJail v0.271
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:378)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:374)
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:564)
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:541)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
Caused by: org.bukkit.command.CommandException: Unhandled exception executing command 'permissions' in plugin PermissionsBukkit v1.2
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:378)
at net.milkbowl.vault.permission.plugins.Permission_PermissionsBukkit.playerAddGroup(Permission_PermissionsBukkit.java:168)
at com.mitsugaru.karmicjail.PermCheck.playerAddGroup(PermCheck.java:182)
at com.mitsugaru.karmicjail.KarmicJail.jailPlayer(KarmicJail.java:687)
at com.mitsugaru.karmicjail.KarmicJail.onCommand(KarmicJail.java:204)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
... 7 more
Caused by: java.lang.NullPointerException
at com.platymuus.bukkit.permissions.PermissionsCommand.checkPerm(PermissionsCommand.java:444)
at com.platymuus.bukkit.permissions.PermissionsCommand.playerCommand(PermissionsCommand.java:310)
at com.platymuus.bukkit.permissions.PermissionsCommand.onCommand(PermissionsCommand.java:160)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
... 14 more
Is this something on PermissionsBukkit end, Vault's end, or my plugin's end?
It almost looks like it's PermissionsBukkit. what was the exact parameter you issued? and does the group exist?
The world parameter is the name of the world based on a teleport location.
String world = location.getWorld().getName();
I know that the location and world exists because issuing Bukkit to teleport the player to the location works.
The name parameter is the name of a player, that is currently online or is known to have been on the server at least once.
And the group name is given. In my test server, I've validated that the group exists and PermissionsBukkit sees it and allows me to .
So, when I call the method, I do the following:
final boolean check = perm.playerAddGroup(world, name, group);
where the variable perm is Vault's Permission object.
Although, wouldn't giving it a valid world name mean that it will always return false?
if (world != null) {
return false;
}
Anyways, I tried it with that, and checked if returned false with a log message. It did and it said the following:
Could not add group 'jailed' to 'Mitsugaru'
And I know that both the jailed group exist and the username is correct and both are in the config.yml.
k, you do need to pass it in as a null world, PBukkit doesn't work with world-specific permissions on it's commands (and it has no API to add them) - that's why I pass commands in Vault for it.
Alright, well, if I do give a null world, then the issue of the original post occurs... which is weird because the same exact syntax for the in-game commands for PermissionsBukkit works... :\
might check with PermissionsBukkit. except I think it's not actively developed... which presents issues :-/
Well, I finally added a special case in my code to handle PermissionsBukkit by itself. The weird thing is, I'm pretty much using the same exact comand as you are:
final String cmd = "permissions player removegroup " + name + " " + group;
final boolean check = plugin.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
Weird... :
I'ma test something and let you know how it goes.
latest version should work (on my jenkins) - I don't think bukkit initializes the console command sender until later on.
Well, from what I can understand based on the commands you posted, group can have specific nodes per world. However, the group itself is not tied to just that world (unlike some other permission systems, such as bPermissions where it can be split up per world config). So, all groups exists in all worlds, they just might have permission nodes applied to only certain specific worlds, based on the configuration.
Its not a: set player to group of this world. Its more like: set player to group... and that's it. Its more along the lines that the group is not world specific, just the permissions that it has can be.
Yea. I kinda figured that out after I had posted (hence why my message disappeared).
P.S. - I'm seeing this issue in a plugin that I'm trying to use although I asked the mod author to look into it and pointed the individual at this (now closed) bug report just in case.
@shinji257 - cause it's fixed in the latest version of Vault.