Display which permission system is used.

This commit is contained in:
snowleo 2011-08-27 21:13:33 +02:00
parent 322ecdb9fc
commit 347be03b25
2 changed files with 35 additions and 9 deletions

View File

@ -148,9 +148,10 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
}
final ServerListener serverListener = new EssentialsPluginListener(this);
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this);
pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this);
confList.add(serverListener);
final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);

View File

@ -1,6 +1,5 @@
package com.earth2me.essentials;
import com.earth2me.essentials.register.payment.Methods;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.event.server.PluginDisableEvent;
@ -10,7 +9,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
public class EssentialsPluginListener extends ServerListener
public class EssentialsPluginListener extends ServerListener implements IConf
{
private final transient IEssentials ess;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
@ -41,7 +40,7 @@ public class EssentialsPluginListener extends ServerListener
LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments.");
}
}
private void checkPermissions()
{
final PluginManager pm = ess.getServer().getPluginManager();
@ -54,28 +53,54 @@ public class EssentialsPluginListener extends ServerListener
{
if (ess.getSettings().useBukkitPermissions())
{
ess.setPermissionsHandler(new BukkitPermissionsHandler());
if (!(ess.getPermissionsHandler() instanceof BukkitPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using superperms based permissions.");
ess.setPermissionsHandler(new BukkitPermissionsHandler());
}
}
else
{
ess.setPermissionsHandler(new ConfigPermissionsHandler(ess));
if (!(ess.getPermissionsHandler() instanceof ConfigPermissionsHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config.");
ess.setPermissionsHandler(new ConfigPermissionsHandler(ess));
}
}
}
else
{
if (permissionsPlugin.getDescription().getVersion().charAt(0) == '3')
{
ess.setPermissionsHandler(new Permissions3Handler(permissionsPlugin));
if (!(ess.getPermissionsHandler() instanceof Permissions3Handler))
{
LOGGER.log(Level.INFO, "Essentials: Using Permissions 3 based permissions.");
ess.setPermissionsHandler(new Permissions3Handler(permissionsPlugin));
}
}
else
{
ess.setPermissionsHandler(new Permissions2Handler(permissionsPlugin));
if (!(ess.getPermissionsHandler() instanceof Permissions2Handler))
{
LOGGER.log(Level.INFO, "Essentials: Using Permissions 2 based permissions.");
ess.setPermissionsHandler(new Permissions2Handler(permissionsPlugin));
}
}
}
}
else
{
ess.setPermissionsHandler(new PermissionsExHandler());
if (!(ess.getPermissionsHandler() instanceof PermissionsExHandler))
{
LOGGER.log(Level.INFO, "Essentials: Using PermissionsEx based permissions.");
ess.setPermissionsHandler(new PermissionsExHandler());
}
}
}
@Override
public void reloadConfig()
{
checkPermissions();
}
}