1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-10-02 09:07:08 +02:00

Heavy cleanup of all classes

ItemDb is not static anymore
Essentials.getStatic() removed
This commit is contained in:
snowleo
2011-07-16 01:33:22 +02:00
parent 372f88757b
commit 616b880e13
48 changed files with 330 additions and 294 deletions

View File

@@ -1,34 +1,37 @@
package com.earth2me.essentials.spawn;
import java.io.*;
import java.util.logging.*;
import com.earth2me.essentials.*;
import org.bukkit.command.*;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.plugin.java.*;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class EssentialsSpawn extends JavaPlugin
{
public static final String AUTHORS = Essentials.AUTHORS;
private static final Logger logger = Logger.getLogger("Minecraft");
public EssentialsSpawn() throws IOException
{
}
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient IEssentials ess;
public void onEnable()
{
EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener();
getServer().getPluginManager().registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this);
getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) {
logger.log(Level.WARNING, Util.i18n("versionMismatchAll"));
final PluginManager pluginManager = getServer().getPluginManager();
ess = (IEssentials)pluginManager.getPlugin("Essentials");
final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess);
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this);
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this);
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
}
logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS));
LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));
}
public void onDisable()
@@ -38,6 +41,6 @@ public class EssentialsSpawn extends JavaPlugin
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
{
return Essentials.getStatic().onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.");
return ess.onCommandEssentials(sender, command, commandLabel, args, Thread.currentThread().getContextClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.");
}
}