From 4c2b9b8d0fd35cd27ef4cbdd0a8e4200d02926b0 Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 6 Dec 2011 13:41:29 +0100 Subject: Updated EssentialsSpawn to use the new config code /spawn and /home now call the PlayerRespawnEvent to make it more compatible with other plugins. --- .../com/earth2me/essentials/spawn/EssentialsSpawn.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java') diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index 256faf6c7..6f6244f25 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -2,8 +2,10 @@ package com.earth2me.essentials.spawn; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IEssentialsModule; import java.util.logging.Level; import java.util.logging.Logger; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.event.Event.Priority; @@ -14,8 +16,9 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsSpawn extends JavaPlugin { - private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private static final Logger LOGGER = Bukkit.getLogger(); private transient IEssentials ess; + private transient SpawnStorage spawns; public void onEnable() { @@ -25,11 +28,15 @@ public class EssentialsSpawn extends JavaPlugin { LOGGER.log(Level.WARNING, _("versionMismatchAll")); } - if (!ess.isEnabled()) { + if (!ess.isEnabled()) + { this.setEnabled(false); return; } - final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess); + + spawns = new SpawnStorage(ess); + + final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns); pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this); pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); @@ -41,8 +48,9 @@ public class EssentialsSpawn extends JavaPlugin } @Override - public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) + public boolean onCommand(final CommandSender sender, final Command command, + final String commandLabel, final String[] args) { - return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials."); + return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns); } } -- cgit v1.2.3