From 121f6f500d1d175f1faddc5f418443e4b5adddb7 Mon Sep 17 00:00:00 2001 From: Rigby Date: Mon, 14 Mar 2011 11:20:15 +0000 Subject: [PATCH] Added basic 'has()' permission. --- .../MultiVerseCore/MVPermissions.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/com/onarandombox/MultiVerseCore/MVPermissions.java b/src/com/onarandombox/MultiVerseCore/MVPermissions.java index 00acdb4c..92077566 100644 --- a/src/com/onarandombox/MultiVerseCore/MVPermissions.java +++ b/src/com/onarandombox/MultiVerseCore/MVPermissions.java @@ -17,6 +17,27 @@ public class MVPermissions { this.plugin = plugin; } + /** + * Check if the player has the following Permission node, if a Permissions plugin + * is not installed then we default to isOp() + * @param p The player instance. + * @param node The permission node we are checking against. + * @return + */ + public boolean has(Player p, String node){ + boolean result = false; + + if(MultiVerseCore.GroupManager!=null){ + result = MultiVerseCore.GroupManager.getWorldsHolder().getWorldPermissions(p).has(p, node); + } else if(MultiVerseCore.Permissions!=null){ + result = MultiVerseCore.Permissions.has(p, node); + } else if(p.isOp()){ + result = true; + } + + return result; + } + /** * Check if a Player can teleport to the Destination world from there * current world. This checks against the Worlds Blacklist