summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java43
1 files changed, 23 insertions, 20 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
index 77cb9a3cb..fcc8f6276 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
@@ -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.");
}
}