From fd2de1d264b2972734b88ee30b720190a1f4f8b5 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 2 Apr 2011 20:38:04 -0700 Subject: [PATCH] Added support for newer versions of Permissions, in theory. --- .../migration/NijiPermissionsResolver.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/com/sk89q/bukkit/migration/NijiPermissionsResolver.java b/src/com/sk89q/bukkit/migration/NijiPermissionsResolver.java index eeba26297..bb54011f4 100644 --- a/src/com/sk89q/bukkit/migration/NijiPermissionsResolver.java +++ b/src/com/sk89q/bukkit/migration/NijiPermissionsResolver.java @@ -55,31 +55,44 @@ public class NijiPermissionsResolver implements PermissionsResolver { try { Player player = server.getPlayer(name); if (player == null) return false; - return api.Security.permission(player, permission); + try { + return api.getHandler().has(player, permission); + } catch (Throwable t) { + return api.Security.permission(player, permission); + } } catch (Throwable t) { t.printStackTrace(); return false; } } - @SuppressWarnings("static-access") + @SuppressWarnings({ "static-access", "deprecation" }) public boolean inGroup(String name, String group) { try { Player player = server.getPlayer(name); if (player == null) return false; - return api.Security.inGroup(name, group); + try { + return api.getHandler().inGroup(player.getWorld().getName(), name, group); + } catch (Throwable t) { + return api.Security.inGroup(name, group); + } } catch (Throwable t) { t.printStackTrace(); return false; } } - @SuppressWarnings("static-access") + @SuppressWarnings({ "static-access", "deprecation" }) public String[] getGroups(String name) { try { Player player = server.getPlayer(name); if (player == null) return new String[0]; - String group = api.Security.getGroup(player.getName()); + String group; + try { + group = api.getHandler().getGroup(player.getWorld().getName(), player.getName()); + } catch (Throwable t) { + group = api.Security.getGroup(player.getName()); + } if (group == null) { return new String[0]; } else {