Removed direct Permissions and PermissionsEx plugin support. Problems with PermissionsEx integration had been reported.

Now permissions are solely handled directly through Bukkit's built-in "superperms" permission system, since all modern permission plugins should be interfacing through that at this point.
This commit is contained in:
Brettflan 2012-01-31 10:52:34 -06:00
parent 8a279fa699
commit d639a4a93e
4 changed files with 4 additions and 44 deletions

Binary file not shown.

Binary file not shown.

View File

@ -36,7 +36,6 @@ import com.massivecraft.factions.struct.Rel;
import com.massivecraft.factions.zcore.MPlugin; import com.massivecraft.factions.zcore.MPlugin;
import com.griefcraft.lwc.LWCPlugin; import com.griefcraft.lwc.LWCPlugin;
import com.nijiko.permissions.PermissionHandler;
import com.earth2me.essentials.chat.EssentialsChat; import com.earth2me.essentials.chat.EssentialsChat;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -76,7 +75,6 @@ public class P extends MPlugin
public static PermissionHandler Permissions;
private static EssentialsChat essChat; private static EssentialsChat essChat;

View File

@ -3,25 +3,16 @@ package com.massivecraft.factions.zcore.util;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission; import org.bukkit.permissions.Permission;
import org.bukkit.plugin.Plugin;
import ru.tehkode.permissions.PermissionManager;
import ru.tehkode.permissions.bukkit.PermissionsEx;
import com.massivecraft.factions.zcore.Lang; import com.massivecraft.factions.zcore.Lang;
import com.massivecraft.factions.zcore.MPlugin; import com.massivecraft.factions.zcore.MPlugin;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.Permissions.Permissions;
public class PermUtil { public class PermUtil {
public PermissionManager pex = null;
public PermissionHandler perm2or3 = null;
public Map<String, String> permissionDescriptions = new HashMap<String, String>(); public Map<String, String> permissionDescriptions = new HashMap<String, String>();
protected MPlugin p; protected MPlugin p;
@ -40,30 +31,13 @@ public class PermUtil {
/** /**
* This method hooks into all permission plugins we are supporting * This method hooks into all permission plugins we are supporting
*/ */
public void setup() public final void setup()
{ {
for(Permission permission : p.getDescription().getPermissions()) for(Permission permission : p.getDescription().getPermissions())
{ {
//p.log("\""+permission.getName()+"\" = \""+permission.getDescription()+"\""); //p.log("\""+permission.getName()+"\" = \""+permission.getDescription()+"\"");
this.permissionDescriptions.put(permission.getName(), permission.getDescription()); this.permissionDescriptions.put(permission.getName(), permission.getDescription());
} }
if ( Bukkit.getServer().getPluginManager().isPluginEnabled("PermissionsEx"))
{
pex = PermissionsEx.getPermissionManager();
p.log("Will use this plugin for permissions: " + Bukkit.getServer().getPluginManager().getPlugin("PermissionsEx").getDescription().getFullName());
return;
}
if ( Bukkit.getServer().getPluginManager().isPluginEnabled("Permissions"))
{
Plugin permissionsPlugin = Bukkit.getServer().getPluginManager().getPlugin("Permissions");
perm2or3 = ((Permissions) permissionsPlugin).getHandler();
p.log("Will use this plugin for permissions: " + permissionsPlugin.getDescription().getFullName());
return;
}
p.log("No permission plugin detected. Defaulting to native bukkit permissions.");
} }
public String getPermissionDescription (String perm) public String getPermissionDescription (String perm)
@ -89,18 +63,6 @@ public class PermUtil {
return me.hasPermission(perm); return me.hasPermission(perm);
} }
if (pex != null)
{
//return pex.has((Player)me, perm);
// Since pex supports superperms we should use those instead.
return ((Player)me).hasPermission(perm);
}
if (perm2or3 != null)
{
return perm2or3.has((Player)me, perm);
}
return me.hasPermission(perm); return me.hasPermission(perm);
} }