mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 02:21:22 +01:00
Remove old permissions handlers that are no longer used. This fixes an issue where new versions of Bpermissions would be detected as old.
This commit is contained in:
parent
9976cc847f
commit
8755935fcb
@ -1,74 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import de.bananaco.permissions.Permissions;
|
||||
import de.bananaco.permissions.info.InfoReader;
|
||||
import de.bananaco.permissions.interfaces.PermissionSet;
|
||||
import de.bananaco.permissions.worlds.WorldPermissionsManager;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BPermissionsHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient WorldPermissionsManager wpm;
|
||||
private final transient InfoReader info;
|
||||
|
||||
public BPermissionsHandler()
|
||||
{
|
||||
wpm = Permissions.getWorldPermissionsManager();
|
||||
info = new InfoReader();
|
||||
info.instantiate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return groups.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final PermissionSet pset = wpm.getPermissionSet(base.getWorld());
|
||||
if (pset == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return pset.getGroups(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return groups.contains(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return info.getPrefix(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return info.getSuffix(base);
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class Permissions2Handler implements IPermissionsHandler
|
||||
{
|
||||
private final transient PermissionHandler permissionHandler;
|
||||
|
||||
public Permissions2Handler(final Plugin permissionsPlugin)
|
||||
{
|
||||
permissionHandler = ((Permissions)permissionsPlugin).getHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
return permissionHandler.getGroup(base.getWorld().getName(), base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
return Arrays.asList(permissionHandler.getGroups(base.getWorld().getName(), base.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return permissionHandler.canGroupBuild(base.getWorld().getName(), getGroup(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return permissionHandler.inGroup(base.getWorld().getName(), base.getName(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return permissionHandler.permission(base, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return permissionHandler.getGroupPrefix(base.getWorld().getName(), getGroup(base));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return permissionHandler.getGroupSuffix(base.getWorld().getName(), getGroup(base));
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
|
||||
public class Permissions3Handler implements IPermissionsHandler
|
||||
{
|
||||
private final transient PermissionHandler permissionHandler;
|
||||
|
||||
public Permissions3Handler(final Plugin permissionsPlugin)
|
||||
{
|
||||
permissionHandler = ((Permissions)permissionsPlugin).getHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
return permissionHandler.getPrimaryGroup(base.getWorld().getName(), base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
return Arrays.asList(permissionHandler.getGroups(base.getWorld().getName(), base.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return permissionHandler.canUserBuild(base.getWorld().getName(), base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return permissionHandler.inGroup(base.getWorld().getName(), base.getName(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return permissionHandler.has(base, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return permissionHandler.getUserPrefix(base.getWorld().getName(), base.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return permissionHandler.getUserSuffix(base.getWorld().getName(), base.getName());
|
||||
}
|
||||
}
|
@ -160,16 +160,6 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
||||
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
||||
{
|
||||
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
|
||||
if (NumberUtil.isInt(bVer) && Integer.parseInt(bVer) < 284)
|
||||
{
|
||||
if (!(handler instanceof BPermissionsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
||||
handler = new BPermissionsHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!(handler instanceof BPermissions2Handler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
|
||||
@ -178,27 +168,6 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||
return;
|
||||
|
||||
}
|
||||
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
|
||||
if (permPlugin != null && permPlugin.isEnabled())
|
||||
{
|
||||
if (permPlugin.getDescription().getVersion().charAt(0) == '3')
|
||||
{
|
||||
if (!(handler instanceof Permissions3Handler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using Permissions 3 based permissions.");
|
||||
handler = new Permissions3Handler(permPlugin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(handler instanceof Permissions2Handler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using Permissions 2 based permissions.");
|
||||
handler = new Permissions2Handler(permPlugin);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (useSuperperms)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user