summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-09-02 23:07:23 +0100
committerElgarL <ElgarL@palmergames.com>2011-09-02 23:07:23 +0100
commit1153a0eee4a3685fcfad490646e4610d38d61c01 (patch)
tree93f541d3c340fac94019858e5104a5321e445b6f
parentb140f606b41cbb30fd0acff3f9c6f416967d82c2 (diff)
downloadEssentials-1153a0eee4a3685fcfad490646e4610d38d61c01.tar
Essentials-1153a0eee4a3685fcfad490646e4610d38d61c01.tar.gz
Essentials-1153a0eee4a3685fcfad490646e4610d38d61c01.tar.lz
Essentials-1153a0eee4a3685fcfad490646e4610d38d61c01.tar.xz
Essentials-1153a0eee4a3685fcfad490646e4610d38d61c01.zip
Bukkit Superperms support
-rw-r--r--EssentialsGroupBridge/.classpath10
-rw-r--r--EssentialsGroupBridge/.project17
-rw-r--r--[-rwxr-xr-x]EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java4
-rw-r--r--[-rwxr-xr-x]EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java131
-rw-r--r--EssentialsGroupManager/.classpath7
-rw-r--r--EssentialsGroupManager/.project17
-rw-r--r--[-rwxr-xr-x]EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java14
-rw-r--r--[-rwxr-xr-x]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java9
-rw-r--r--[-rwxr-xr-x]EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java12
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java195
10 files changed, 344 insertions, 72 deletions
diff --git a/EssentialsGroupBridge/.classpath b/EssentialsGroupBridge/.classpath
new file mode 100644
index 000000000..a1bc47710
--- /dev/null
+++ b/EssentialsGroupBridge/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/EssentialsGroupManager"/>
+ <classpathentry kind="lib" path="../lib/Permissions3.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/EssentialsGroupBridge/.project b/EssentialsGroupBridge/.project
new file mode 100644
index 000000000..0780b7dbb
--- /dev/null
+++ b/EssentialsGroupBridge/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>EssentialsGroupBridge</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
index c7a85fc71..5d027cccc 100755..100644
--- a/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
+++ b/EssentialsGroupBridge/src/com/nijikokun/bukkit/Permissions/Permissions.java
@@ -2,7 +2,7 @@ package com.nijikokun.bukkit.Permissions;
import com.nijiko.permissions.PermissionHandler;
import java.util.logging.Logger;
-import org.anjocaido.groupmanager.GroupManager;
+//import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
@@ -63,7 +63,7 @@ public class Permissions extends JavaPlugin {
}
private void setGM(final Plugin p) {
- GroupManager groupManager = (GroupManager) p;
+ //GroupManager groupManager = (GroupManager) p;
((NijikoPermissionsProxy) Security).setGM(p);
}
diff --git a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
index bc9cde437..a41a51bc9 100755..100644
--- a/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
+++ b/EssentialsGroupBridge/src/org/anjocaido/groupmanager/permissions/NijikoPermissionsProxy.java
@@ -47,12 +47,12 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public void addGroupInfo(String world, String group, String node, Object data) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addGroupInfo(group, node, data);
+ GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().addGroupInfo(group, node, data);
}
@Override
public void removeGroupInfo(String world, String group, String node) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeGroupInfo(group, node);
+ GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeGroupInfo(group, node);
}
@Override
@@ -67,17 +67,17 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public void addUserInfo(String world, String user, String node, Object data) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().addUserInfo(user, node, data);
+ GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().addUserInfo(user, node, data);
}
@Override
public void removeUserInfo(String world, String user, String node) {
- plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeUserInfo(user, node);
+ GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().removeUserInfo(user, node);
}
@Deprecated
public void removeUserInfo(String user, String node) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeUserInfo(user, node);
+ GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeUserInfo(user, node);
}
@Deprecated
@@ -92,12 +92,12 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Deprecated
public void addGroupInfo(String group, String node, Object data) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addGroupInfo(group, node, data);
+ GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addGroupInfo(group, node, data);
}
@Deprecated
public void removeGroupInfo(String group, String node) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeGroupInfo(group, node);
+ GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().removeGroupInfo(group, node);
}
@Deprecated
@@ -112,7 +112,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Deprecated
public void addUserInfo(String user, String node, Object data) {
- plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addUserInfo(user, node, data);
+ GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().addUserInfo(user, node, data);
}
@Override
@@ -147,13 +147,13 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public void reload() {
- plugin.getWorldsHolder().reloadAll();
+ GroupManager.getWorldsHolder().reloadAll();
//throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean reload(String world) {
- plugin.getWorldsHolder().reloadWorld(world);
+ GroupManager.getWorldsHolder().reloadWorld(world);
return true;
}
@@ -175,214 +175,214 @@ public class NijikoPermissionsProxy extends PermissionHandler {
}
if (player.getWorld() == null) {
GroupManager.logger.warning("The player " + player.getName() + " has a null world? Treating as default world!");
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().has(player, permission);
}
- return plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
+ return GroupManager.getWorldsHolder().getWorldData(player.getWorld().getName()).getPermissionsHandler().has(player, permission);
}
@Override
public String getGroupRawPrefix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
}
@Override
public String getGroupRawSuffix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
}
@Override
public String getUserPrefix(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPrefix(user);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPrefix(user);
}
@Override
public String getUserSuffix(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserSuffix(user);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserSuffix(user);
}
@Override
public String getGroup(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
}
@Override
public String getPrimaryGroup(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroup(user);
}
@Override
public boolean canUserBuild(String world, String user) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canUserBuild(user);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canUserBuild(user);
}
@Deprecated
public String getGroup(String name) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroup(name);
}
@Override
public String[] getGroups(String world, String name) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroups(name);
}
@Override
public boolean inGroup(String world, String name, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name, group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(name, group);
}
@Deprecated
public boolean inGroup(String name, String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name, group);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().inGroup(name, group);
}
@Override
public String getGroupPrefix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPrefix(group);
}
@Deprecated
public String getGroupPrefix(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPrefix(group);
}
@Override
public String getGroupSuffix(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupSuffix(group);
}
@Deprecated
public String getGroupSuffix(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupSuffix(group);
}
@Override
public boolean canGroupBuild(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
}
@Deprecated
public boolean canGroupBuild(String group) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().canGroupBuild(group);
}
@Override
public String getGroupPermissionString(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionString(group, permission);
}
@Deprecated
public String getGroupPermissionString(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionString(group, permission);
}
@Override
public int getGroupPermissionInteger(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionInteger(group, permission);
}
@Deprecated
public int getGroupPermissionInteger(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionInteger(group, permission);
}
@Override
public boolean getGroupPermissionBoolean(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionBoolean(group, permission);
}
@Deprecated
public boolean getGroupPermissionBoolean(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionBoolean(group, permission);
}
@Override
public double getGroupPermissionDouble(String world, String group, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getGroupPermissionDouble(group, permission);
}
@Deprecated
public double getGroupPermissionDouble(String group, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getGroupPermissionDouble(group, permission);
}
@Override
public String getUserPermissionString(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionString(name, permission);
}
@Deprecated
public String getUserPermissionString(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionString(name, permission);
}
@Override
public int getUserPermissionInteger(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionInteger(name, permission);
}
@Deprecated
public int getUserPermissionInteger(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionInteger(name, permission);
}
@Override
public boolean getUserPermissionBoolean(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionBoolean(name, permission);
}
@Deprecated
public boolean getUserPermissionBoolean(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionBoolean(name, permission);
}
@Override
public double getUserPermissionDouble(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getUserPermissionDouble(name, permission);
}
@Deprecated
public double getUserPermissionDouble(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getUserPermissionDouble(name, permission);
}
@Override
public String getPermissionString(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionString(name, permission);
}
@Deprecated
public String getPermissionString(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionString(name, permission);
}
@Override
public int getPermissionInteger(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionInteger(name, permission);
}
@Deprecated
public int getPermissionInteger(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionInteger(name, permission);
}
@Override
public boolean getPermissionBoolean(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionBoolean(name, permission);
}
@Deprecated
public boolean getPermissionBoolean(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionBoolean(name, permission);
}
@Override
public double getPermissionDouble(String world, String name, String permission) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getPermissionDouble(name, permission);
}
@Deprecated
public double getPermissionDouble(String name, String permission) {
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name, permission);
}
public void setGM(Plugin p) {
@@ -391,7 +391,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public boolean canGroupRawBuild(String world, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().canGroupBuild(group);
}
@Override
@@ -432,7 +432,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public Boolean getInfoBoolean(String world, String entryName, String path,
boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoBoolean(entryName, path, isGroup);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoBoolean(entryName, path, isGroup);
}
@Override
@@ -443,7 +443,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public Double getInfoDouble(String world, String entryName, String path, boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoDouble(entryName, path, isGroup);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoDouble(entryName, path, isGroup);
}
@Override
@@ -455,7 +455,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public Integer getInfoInteger(String world, String entryName, String path,
boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoInteger(entryName, path, isGroup);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoInteger(entryName, path, isGroup);
}
@Override
@@ -466,7 +466,7 @@ public class NijikoPermissionsProxy extends PermissionHandler {
@Override
public String getInfoString(String world, String entryName, String path, boolean isGroup) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoString(entryName, path, isGroup);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().getInfoString(entryName, path, isGroup);
}
@Override
@@ -530,14 +530,14 @@ public class NijikoPermissionsProxy extends PermissionHandler {
}
if (world == null) {
GroupManager.logger.warning("The player " + playerName + " has a null world? Treating as default world!");
- return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().permission(playerName, permission);
+ return GroupManager.getWorldsHolder().getDefaultWorld().getPermissionsHandler().permission(playerName, permission);
}
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().permission(playerName, permission);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().permission(playerName, permission);
}
@Override
public boolean inGroup(String world, String user, String groupWorld, String group) {
- return plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(user, group);
+ return GroupManager.getWorldsHolder().getWorldData(world).getPermissionsHandler().inGroup(user, group);
}
@Override
@@ -580,8 +580,9 @@ public class NijikoPermissionsProxy extends PermissionHandler {
throw new UnsupportedOperationException("Not supported yet.");
}
- @Override
- public Group getPrimaryGroupObject(String string, String string1) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
+ //@Override
+ public Group getPrimaryGroupObject(String arg0, String arg1) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
}
diff --git a/EssentialsGroupManager/.classpath b/EssentialsGroupManager/.classpath
new file mode 100644
index 000000000..eafae0c2b
--- /dev/null
+++ b/EssentialsGroupManager/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="../lib/bukkit-0.0.1-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="../lib/craftbukkit-0.0.1-SNAPSHOT.jar"/>
+</classpath>
diff --git a/EssentialsGroupManager/.project b/EssentialsGroupManager/.project
new file mode 100644
index 000000000..6ad74b347
--- /dev/null
+++ b/EssentialsGroupManager/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>EssentialsGroupManager</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 7f6e0fb85..2e094558c 100755..100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -5,6 +5,7 @@
package org.anjocaido.groupmanager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
+import org.anjocaido.groupmanager.permissions.BukkitPermissions;
import org.anjocaido.groupmanager.utils.GroupManagerPermissions;
import org.anjocaido.groupmanager.data.Variables;
import org.anjocaido.groupmanager.data.User;
@@ -45,15 +46,19 @@ public class GroupManager extends JavaPlugin {
private ScheduledThreadPoolExecutor scheduler;
private Map<String, ArrayList<User>> overloadedUsers = new HashMap<String, ArrayList<User>>();
private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>();
- private WorldsHolder worldsHolder;
+ private static WorldsHolder worldsHolder;
private boolean validateOnlinePlayer = true;
private boolean isReady = false;
+ public static boolean isLoaded = false;
private GMConfiguration config;
private GMLoggerHandler ch;
+ public static BukkitPermissions BukkitPermissions;
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
@Override
public void onDisable() {
+ isLoaded = false;
+
if (worldsHolder != null) {
worldsHolder.saveChanges();
}
@@ -82,8 +87,11 @@ public class GroupManager extends JavaPlugin {
this.getServer().getPluginManager().disablePlugin(this);
throw new IllegalStateException("An error ocurred while loading GroupManager");
}
+
+ BukkitPermissions = new BukkitPermissions(this);
enableScheduler();
+ isLoaded = true;
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
}
@@ -110,7 +118,7 @@ public class GroupManager extends JavaPlugin {
@Override
public void run() {
- GroupManager.this.worldsHolder.saveChanges();
+ GroupManager.worldsHolder.saveChanges();
}
};
scheduler = new ScheduledThreadPoolExecutor(1);
@@ -153,7 +161,7 @@ public class GroupManager extends JavaPlugin {
worldsHolder.reloadAll();
}
- public WorldsHolder getWorldsHolder() {
+ public static WorldsHolder getWorldsHolder() {
return worldsHolder;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index 4af5449fc..7523831e7 100755..100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -4,6 +4,7 @@
*/
package org.anjocaido.groupmanager.data;
+import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import java.util.ArrayList;
import java.util.Map;
@@ -52,7 +53,7 @@ public class Group extends DataUnit implements Cloneable {
/**
* Use this to deliver a group from a different dataSource to another
* @param dataSource
- * @return
+ * @return Null or Clone
*/
public Group clone(WorldDataHolder dataSource) {
if (dataSource.groupExists(this.getName())) {
@@ -79,7 +80,7 @@ public class Group extends DataUnit implements Cloneable {
}
/**
- * @param inherits the inherits to set
+ * @param inherit the inherits to set
*/
public void addInherits(Group inherit) {
if (!this.getDataSource().groupExists(inherit.getName())) {
@@ -89,6 +90,8 @@ public class Group extends DataUnit implements Cloneable {
inherits.add(inherit.getName().toLowerCase());
}
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
public boolean removeInherits(String inherit) {
@@ -118,5 +121,7 @@ public class Group extends DataUnit implements Cloneable {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index b90cf4ff1..f3ea1d0f5 100755..100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -6,6 +6,8 @@ package org.anjocaido.groupmanager.data;
//import com.sun.org.apache.bcel.internal.generic.AALOAD;
import java.util.ArrayList;
+
+import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import java.util.Map;
@@ -102,6 +104,8 @@ public class User extends DataUnit implements Cloneable {
public void setGroup(String group) {
this.group = group;
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
/**
@@ -114,6 +118,8 @@ public class User extends DataUnit implements Cloneable {
group = getDataSource().getGroup(group.getName());
this.group = group.getName();
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
public void addSubGroup(Group subGroup) {
@@ -127,6 +133,8 @@ public class User extends DataUnit implements Cloneable {
removeSubGroup(subGroup);
subGroups.add(subGroup.getName());
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
public int subGroupsSize() {
@@ -145,6 +153,8 @@ public class User extends DataUnit implements Cloneable {
try {
if (subGroups.remove(subGroup.getName())) {
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
return true;
}
} catch (Exception e) {
@@ -187,5 +197,7 @@ public class User extends DataUnit implements Cloneable {
variables.addVar(key, temp.getVarObject(key));
}
flagAsChanged();
+ if (GroupManager.isLoaded)
+ GroupManager.BukkitPermissions.updateAllPlayers();
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
new file mode 100644
index 000000000..e396118b4
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -0,0 +1,195 @@
+/*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+package org.anjocaido.groupmanager.permissions;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.anjocaido.groupmanager.GroupManager;
+import org.anjocaido.groupmanager.data.User;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerKickEvent;
+import org.bukkit.event.player.PlayerListener;
+import org.bukkit.event.player.PlayerPortalEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.event.server.PluginDisableEvent;
+import org.bukkit.event.server.PluginEnableEvent;
+import org.bukkit.event.server.ServerListener;
+import org.bukkit.permissions.Permission;
+import org.bukkit.permissions.PermissionAttachment;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginManager;
+
+
+/**
+ *
+ * BukkitPermissions overrides to force GM reponses to Superperms
+ *
+ * @author ElgarL, based upon PermissionsEX implementation
+ */
+public class BukkitPermissions {
+
+ protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
+ protected Set<Permission> registeredPermissions = new HashSet<Permission>();
+ protected Plugin plugin;
+ protected boolean dumpAllPermissions = true;
+ protected boolean dumpMatchedPermissions = true;
+
+ public BukkitPermissions(Plugin plugin) {
+ this.plugin = plugin;
+
+ this.collectPermissions();
+ this.registerEvents();
+
+ this.updateAllPlayers();
+
+ GroupManager.logger.info("Superperms support enabled.");
+ }
+
+ private void registerEvents() {
+ PluginManager manager = plugin.getServer().getPluginManager();
+
+ PlayerEvents playerEventListener = new PlayerEvents();
+
+ manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Normal, plugin);
+
+ manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Normal, plugin);
+
+ ServerListener serverListener = new BukkitEvents();
+
+ manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
+ manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
+ }
+
+ private void collectPermissions() {
+ registeredPermissions.clear();
+ for (Plugin bukkitPlugin : Bukkit.getServer().getPluginManager().getPlugins()) {
+ registeredPermissions.addAll(bukkitPlugin.getDescription().getPermissions());
+ }
+ }
+
+ public void updatePermissions(Player player){
+ this.updatePermissions(player, null);
+ }
+
+ public void updatePermissions(Player player, String world) {
+ if (player == null || !this.plugin.isEnabled()) {
+ return;
+ }
+
+ if (!this.attachments.containsKey(player)) {
+ this.attachments.put(player, player.addAttachment(plugin));
+ }
+
+ if(world == null){
+ world = player.getWorld().getName();
+ }
+
+ PermissionAttachment attachment = this.attachments.get(player);
+
+ User user = GroupManager.getWorldsHolder().getWorldData(world).getUser(player.getName());
+
+ // clear permissions
+ for (String permission : attachment.getPermissions().keySet()) {
+ attachment.unsetPermission(permission);
+ }
+
+ for (Permission permission : registeredPermissions) {
+ boolean permissionValue = user.getGroup().hasSamePermissionNode(permission.getName());
+
+ //GroupManager.logger.info(permission.getName() + " : " + Boolean.toString(permissionValue));
+
+ attachment.setPermission(permission, permissionValue);
+ }
+
+ player.recalculatePermissions();
+
+ }
+
+ public void updateAllPlayers() {
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ updatePermissions(player);
+ }
+ }
+
+ protected class PlayerEvents extends PlayerListener {
+
+ @Override
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ updatePermissions(event.getPlayer());
+ }
+
+ @Override
+ public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
+ if(event.getPlayer().getWorld().equals(event.getTo().getWorld())){ // only if world actually changed
+ return;
+ }
+
+ updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
+ }
+
+ @Override
+ public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
+ updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
+ }
+
+ @Override
+ public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
+ if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
+ updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
+ }
+ }
+
+ @Override
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ attachments.remove(event.getPlayer());
+ }
+
+ @Override
+ public void onPlayerKick(PlayerKickEvent event) {
+ attachments.remove(event.getPlayer());
+ }
+ }
+
+ protected class BukkitEvents extends ServerListener {
+
+ @Override
+ public void onPluginEnable(PluginEnableEvent event) {
+ collectPermissions();
+ updateAllPlayers();
+ }
+
+ @Override
+ public void onPluginDisable(PluginDisableEvent event) {
+ collectPermissions();
+ updateAllPlayers();
+ }
+ }
+
+} \ No newline at end of file