diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-15 23:15:19 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-15 23:15:19 +0000 |
commit | adf3755abb29b635977a2eb3ca4688dbd917d471 (patch) | |
tree | b9ed2c4cc46f740fb1d2f08ae740452c014e6bf0 | |
parent | 5c280e7cb7a2eb7fd2cacf373db698c3b31f7c28 (diff) | |
download | Essentials-adf3755abb29b635977a2eb3ca4688dbd917d471.tar Essentials-adf3755abb29b635977a2eb3ca4688dbd917d471.tar.gz Essentials-adf3755abb29b635977a2eb3ca4688dbd917d471.tar.lz Essentials-adf3755abb29b635977a2eb3ca4688dbd917d471.tar.xz Essentials-adf3755abb29b635977a2eb3ca4688dbd917d471.zip |
Handle permission check failures better.
3 files changed, 27 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 2ba5a3909..684080f63 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -139,8 +139,10 @@ public class Essentials extends JavaPlugin implements IEssentials final int versionNumber = Integer.parseInt(versionMatch.group(1)); if (versionNumber < BUKKIT_VERSION && versionNumber > 100) { + LOGGER.log(Level.SEVERE, "* ! * ! * ! * ! * ! * ! * ! * ! * ! *"); LOGGER.log(Level.SEVERE, _("notRecommendedBukkit")); LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION))); + LOGGER.log(Level.SEVERE, "* ! * ! * ! * ! * ! * ! * ! * ! * ! *"); this.setEnabled(false); return; } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 6a7feff07..8f6196e31 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -71,7 +71,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser return false; } - return ess.getPermissionsHandler().hasPermission(base, node); + try { + return ess.getPermissionsHandler().hasPermission(base, node); + } + catch (Exception ex) { + ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage()); + return false; + } } public void healCooldown() throws Exception diff --git a/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java b/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java index 8c3cdf1e2..23fe142b2 100644 --- a/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/GroupManagerHandler.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.perm; import java.util.Arrays; import java.util.List; import org.anjocaido.groupmanager.GroupManager; +import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -20,7 +21,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public String getGroup(final Player base) { - final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + final AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return null; @@ -31,7 +32,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public List<String> getGroups(final Player base) { - final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + final AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return null; @@ -42,7 +43,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public boolean canBuild(final Player base, final String group) { - final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + final AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return false; @@ -53,7 +54,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public boolean inGroup(final Player base, final String group) { - AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return false; @@ -64,7 +65,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public boolean hasPermission(final Player base, final String node) { - AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return false; @@ -75,7 +76,7 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public String getPrefix(final Player base) { - AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return null; @@ -86,11 +87,21 @@ public class GroupManagerHandler implements IPermissionsHandler @Override public String getSuffix(final Player base) { - AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(base); + AnjoPermissionsHandler handler = getHandler(base); if (handler == null) { return null; } return handler.getUserSuffix(base.getName()); } + + private AnjoPermissionsHandler getHandler(final Player base) + { + final WorldsHolder holder = groupManager.getWorldsHolder(); + if (holder == null) + { + return null; + } + return holder.getWorldPermissions(base); + } } |