mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-12-12 12:16:52 +01:00
Fix a possible NPE case -- getPlayerInfo () in PBukkit can return null when the user is not defined.
This commit is contained in:
parent
9d50820b8c
commit
d95d5f21d1
@ -30,6 +30,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.platymuus.bukkit.permissions.Group;
|
import com.platymuus.bukkit.permissions.Group;
|
||||||
|
import com.platymuus.bukkit.permissions.PermissionInfo;
|
||||||
import com.platymuus.bukkit.permissions.PermissionsPlugin;
|
import com.platymuus.bukkit.permissions.PermissionsPlugin;
|
||||||
|
|
||||||
public class Permission_PermissionsBukkit extends Permission {
|
public class Permission_PermissionsBukkit extends Permission {
|
||||||
@ -189,7 +190,8 @@ public class Permission_PermissionsBukkit extends Permission {
|
|||||||
@Override
|
@Override
|
||||||
public String[] getPlayerGroups(String world, String player) {
|
public String[] getPlayerGroups(String world, String player) {
|
||||||
List<String> groupList = new ArrayList<String>();
|
List<String> groupList = new ArrayList<String>();
|
||||||
if (world != null && perms.getPlayerInfo(player) != null) {
|
PermissionInfo info = perms.getPlayerInfo(player);
|
||||||
|
if (world != null && info != null) {
|
||||||
for (Group group : perms.getPlayerInfo(player).getGroups()) {
|
for (Group group : perms.getPlayerInfo(player).getGroups()) {
|
||||||
if (group.getInfo().getWorlds().contains(world)) {
|
if (group.getInfo().getWorlds().contains(world)) {
|
||||||
groupList.add(group.getName());
|
groupList.add(group.getName());
|
||||||
@ -197,9 +199,11 @@ public class Permission_PermissionsBukkit extends Permission {
|
|||||||
}
|
}
|
||||||
return groupList.toArray(new String[0]);
|
return groupList.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
for (Group group : perms.getPlayerInfo(player).getGroups()) {
|
if (info != null) {
|
||||||
|
for (Group group : info.getGroups()) {
|
||||||
groupList.add(group.getName());
|
groupList.add(group.getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return groupList.toArray(new String[0]);
|
return groupList.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user