Method public String[] getPlayerGroups(Player player) returns empty array on permissionsbukkit when it should not.
wiigor opened this issue ยท 5 comments
versions: vault 1.23 bukkit 1.0.1-R1
using permissionsbukkit: 1.2
expected behavior:
when calling public String[] getPlayerGroups(Player player) from the main thread.
with an existing player named "wiigor" , that is in one group called "megabuilder"
this method returns {"megabuilder"}
observed behavior:
when calling public String[] getPlayerGroups(Player player) from the main thread.
with an existing player named "wiigor" , that is in one group called "megabuilder"
this method returns {} empty array.
getPlayerGroups(player) - will return only world-specific groups. you may be thinking of getPlayerGroups(null, player); which should return all groups on the player
There is only 1 world named "world" on the server I tested on. And the player is in it when calling getPlayerGroups(Player player)
These 3 getplayergroup methods exists:
1 public String[] getPlayerGroups(String world, String player);
2 public String[] getPlayerGroups(World world, String player);
3 public String[] getPlayerGroups(Player player);
If i use getPlayerGroups(null, player) I get an ambigious method call error since it can refer to both method 1 and 2.
if i make a World world = null and pass it like this getPlayerGroups(world, "wiigor");
i get
java.lang.NullPointerException
at net.milkbowl.vault.permission.Permission.getPlayerGroups(Permission.java:481)
at me.wiigor.wiipay.WiiPay.handleShowUserGroups(WiiPay.java:70)
at me.wiigor.wiipay.WiiPay.onCommand(WiiPay.java:63)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
I only want to imput the name of the player and get the list of groups the player is in.
@wiigor - if the permission plugin supports global groups then it should work like that. I'm fairly certain it does in PEX/P3, but unsure of the other ones as bPerms has been world-only until recently, so it may not handle it properly.
try getPlayerGroup((String) null, playerName) this casts null to a string to prevent the ambiguity issue. you can't pass a null world object, but I can fix the possibility of an NPE on that method to support it.