summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Essentials/nbproject/project.properties6
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/IEssentials.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java88
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java (renamed from Essentials/src/com/earth2me/essentials/ConfigPermissionsHandler.java)3
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java (renamed from Essentials/src/com/earth2me/essentials/IPermissionsHandler.java)2
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java (renamed from Essentials/src/com/earth2me/essentials/Permissions2Handler.java)2
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/Permissions3Handler.java (renamed from Essentials/src/com/earth2me/essentials/Permissions3Handler.java)2
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java86
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java (renamed from Essentials/src/com/earth2me/essentials/PermissionsExHandler.java)4
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java (renamed from Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java)5
-rw-r--r--lib/PermissionsBukkit-1.2.jarbin0 -> 23673 bytes
-rw-r--r--lib/bPermissions.jarbin0 -> 36236 bytes
15 files changed, 199 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 7152ec996..dd7da3087 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,5 @@
/EssentialsPermissionsCommands/dist/
/Essentials/nbproject/private/
/Essentials/dist/
-/Essentials/build/ \ No newline at end of file
+/Essentials/build/
+/YamlAnnotations/ \ No newline at end of file
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index 8df8ef4d2..db78855e6 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -62,6 +62,7 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
+file.reference.bPermissions.jar=../lib/bPermissions.jar
file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar
file.reference.iCo4.jar=../lib/iCo4.jar
file.reference.iCo5.jar=../lib/iCo5.jar
@@ -69,6 +70,7 @@ file.reference.iCo6.jar=../lib/iCo6.jar
file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar
file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
file.reference.Permissions3.jar=../lib/Permissions3.jar
+file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
@@ -82,7 +84,9 @@ javac.classpath=\
${file.reference.iCo6.jar}:\
${file.reference.MultiCurrency.jar}:\
${file.reference.BOSEconomy7.jar}:\
- ${file.reference.PermissionsEx.jar}
+ ${file.reference.PermissionsEx.jar}:\
+ ${file.reference.bPermissions.jar}:\
+ ${file.reference.PermissionsBukkit-1.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 5fdb23785..cc465d7bf 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -17,6 +17,8 @@
*/
package com.earth2me.essentials;
+import com.earth2me.essentials.perm.IPermissionsHandler;
+import com.earth2me.essentials.perm.ConfigPermissionsHandler;
import com.earth2me.essentials.api.Economy;
import com.earth2me.essentials.commands.EssentialsCommand;
import java.io.*;
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
index 99df25578..2155ca622 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java
@@ -1,5 +1,10 @@
package com.earth2me.essentials;
+import com.earth2me.essentials.perm.ConfigPermissionsHandler;
+import com.earth2me.essentials.perm.BukkitPermissionsHandler;
+import com.earth2me.essentials.perm.Permissions3Handler;
+import com.earth2me.essentials.perm.Permissions2Handler;
+import com.earth2me.essentials.perm.PermissionsExHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.server.PluginDisableEvent;
diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java
index 9f427b220..0512b629e 100644
--- a/Essentials/src/com/earth2me/essentials/IEssentials.java
+++ b/Essentials/src/com/earth2me/essentials/IEssentials.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import com.earth2me.essentials.perm.IPermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import org.bukkit.World;
import org.bukkit.command.Command;
diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java
new file mode 100644
index 000000000..bc9fc2113
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java
@@ -0,0 +1,88 @@
+package com.earth2me.essentials.perm;
+
+import de.bananaco.permissions.Permissions;
+import de.bananaco.permissions.interfaces.PermissionSet;
+import de.bananaco.permissions.worlds.WorldPermissionsManager;
+import java.util.List;
+import org.bukkit.entity.Player;
+
+
+public class BPermissionsHandler implements IPermissionsHandler
+{
+ private final transient WorldPermissionsManager wpm;
+
+ public BPermissionsHandler()
+ {
+ wpm = Permissions.getWorldPermissionsManager();
+ }
+
+ @Override
+ public String getGroup(final Player base)
+ {
+ final PermissionSet pset = wpm.getPermissionSet(base.getWorld());
+ if (pset == null)
+ {
+ return "default";
+ }
+ final List<String> groups = pset.getGroups(base);
+ if (groups == null || groups.isEmpty())
+ {
+ return "default";
+ }
+ return groups.get(0);
+ }
+
+ @Override
+ public boolean canBuild(Player base, String group)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean inGroup(Player base, String group)
+ {
+ final PermissionSet pset = wpm.getPermissionSet(base.getWorld());
+ if (pset == null)
+ {
+ return false;
+ }
+ final List<String> groups = pset.getGroups(base);
+ if (groups == null || groups.isEmpty())
+ {
+ return false;
+ }
+ return groups.contains(group);
+ }
+
+ @Override
+ public boolean hasPermission(Player base, String node)
+ {
+ if (base.hasPermission("-" + node))
+ {
+ return false;
+ }
+ final String[] parts = node.split("\\.");
+ final StringBuilder sb = new StringBuilder();
+ for (String part : parts)
+ {
+ if (base.hasPermission(sb.toString() + "*"))
+ {
+ return true;
+ }
+ sb.append(part).append(".");
+ }
+ return base.hasPermission(node);
+ }
+
+ @Override
+ public String getPrefix(Player base)
+ {
+ return "";
+ }
+
+ @Override
+ public String getSuffix(Player base)
+ {
+ return "";
+ }
+}
diff --git a/Essentials/src/com/earth2me/essentials/ConfigPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java
index 200aa34f8..1d5ac447d 100644
--- a/Essentials/src/com/earth2me/essentials/ConfigPermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java
@@ -1,5 +1,6 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
+import com.earth2me.essentials.IEssentials;
import org.bukkit.entity.Player;
diff --git a/Essentials/src/com/earth2me/essentials/IPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java
index a7bcc80b7..c7fddb6c8 100644
--- a/Essentials/src/com/earth2me/essentials/IPermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java
@@ -1,4 +1,4 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
import org.bukkit.entity.Player;
diff --git a/Essentials/src/com/earth2me/essentials/Permissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java
index 71d7da58b..eca6feaf8 100644
--- a/Essentials/src/com/earth2me/essentials/Permissions2Handler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java
@@ -1,4 +1,4 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
diff --git a/Essentials/src/com/earth2me/essentials/Permissions3Handler.java b/Essentials/src/com/earth2me/essentials/perm/Permissions3Handler.java
index 99c95da0a..905b5e0a9 100644
--- a/Essentials/src/com/earth2me/essentials/Permissions3Handler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/Permissions3Handler.java
@@ -1,4 +1,4 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java
new file mode 100644
index 000000000..fdf998ced
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java
@@ -0,0 +1,86 @@
+package com.earth2me.essentials.perm;
+
+import com.platymuus.bukkit.permissions.Group;
+import com.platymuus.bukkit.permissions.PermissionInfo;
+import com.platymuus.bukkit.permissions.PermissionsPlugin;
+import java.util.List;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+
+public class PermissionsBukkitHandler implements IPermissionsHandler
+{
+ private final transient PermissionsPlugin plugin;
+
+ public PermissionsBukkitHandler(Plugin plugin)
+ {
+ this.plugin = (PermissionsPlugin)plugin;
+ }
+
+
+ public String getGroup(Player base)
+ {
+ final PermissionInfo info = plugin.getPlayerInfo(base.getName());
+ if (info == null) {
+ return "default";
+ }
+ final List<Group> groups = info.getGroups();
+ if (groups == null || groups.isEmpty()) {
+ return "default";
+ }
+ return groups.get(0).getName();
+ }
+
+ public boolean canBuild(Player base, String group)
+ {
+ return true;
+ }
+
+ public boolean inGroup(Player base, String group)
+ {
+ final PermissionInfo info = plugin.getPlayerInfo(base.getName());
+ if (info == null) {
+ return false;
+ }
+ final List<Group> groups = info.getGroups();
+ if (groups == null || groups.isEmpty()) {
+ return false;
+ }
+ for (Group group1 : groups)
+ {
+ if(group1.getName().equalsIgnoreCase(group)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean hasPermission(Player base, String node)
+ {
+ if (base.hasPermission("-" + node))
+ {
+ return false;
+ }
+ final String[] parts = node.split("\\.");
+ final StringBuilder sb = new StringBuilder();
+ for (String part : parts)
+ {
+ if (base.hasPermission(sb.toString() + "*"))
+ {
+ return true;
+ }
+ sb.append(part).append(".");
+ }
+ return base.hasPermission(node);
+ }
+
+ public String getPrefix(Player base)
+ {
+ return "";
+ }
+
+ public String getSuffix(Player base)
+ {
+ return "";
+ }
+}
diff --git a/Essentials/src/com/earth2me/essentials/PermissionsExHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java
index f9151c77e..ed3c2afe6 100644
--- a/Essentials/src/com/earth2me/essentials/PermissionsExHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java
@@ -1,4 +1,4 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
import org.bukkit.entity.Player;
import ru.tehkode.permissions.PermissionManager;
@@ -6,7 +6,7 @@ import ru.tehkode.permissions.PermissionUser;
import ru.tehkode.permissions.bukkit.PermissionsEx;
-class PermissionsExHandler implements IPermissionsHandler
+public class PermissionsExHandler implements IPermissionsHandler
{
private final transient PermissionManager manager;
diff --git a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java
index aee9ef0b4..e31776fe1 100644
--- a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java
@@ -1,9 +1,9 @@
-package com.earth2me.essentials;
+package com.earth2me.essentials.perm;
import org.bukkit.entity.Player;
-public class BukkitPermissionsHandler implements IPermissionsHandler
+public class SuperpermsHandler implements IPermissionsHandler
{
public String getGroup(Player base)
{
@@ -49,3 +49,4 @@ public class BukkitPermissionsHandler implements IPermissionsHandler
return "";
}
}
+
diff --git a/lib/PermissionsBukkit-1.2.jar b/lib/PermissionsBukkit-1.2.jar
new file mode 100644
index 000000000..3f5caf1b4
--- /dev/null
+++ b/lib/PermissionsBukkit-1.2.jar
Binary files differ
diff --git a/lib/bPermissions.jar b/lib/bPermissions.jar
new file mode 100644
index 000000000..b3b38e425
--- /dev/null
+++ b/lib/bPermissions.jar
Binary files differ