diff options
author | snowleo <schneeleo@gmail.com> | 2012-01-20 05:34:28 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2012-01-20 05:34:28 +0100 |
commit | 90e1b619be0b8d9707ed1907e686ce38c8c5bf7f (patch) | |
tree | 7b2fc855b3caf168ad77af54f36c258154f55af4 /EssentialsSpawn/src/com/earth2me/essentials | |
parent | ebb3a1c19fd56c92987ffb16e29f691c2a386568 (diff) | |
download | Essentials-90e1b619be0b8d9707ed1907e686ce38c8c5bf7f.tar Essentials-90e1b619be0b8d9707ed1907e686ce38c8c5bf7f.tar.gz Essentials-90e1b619be0b8d9707ed1907e686ce38c8c5bf7f.tar.lz Essentials-90e1b619be0b8d9707ed1907e686ce38c8c5bf7f.tar.xz Essentials-90e1b619be0b8d9707ed1907e686ce38c8c5bf7f.zip |
New Event code for EssentialsSpawn
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me/essentials')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java | 24 | ||||
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index 813220a16..565764aa6 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -8,8 +8,14 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; +import org.bukkit.event.EventException; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.EventExecutor; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -38,8 +44,22 @@ public class EssentialsSpawn extends JavaPlugin ess.addReloadListener(spawns); final EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(ess, spawns); - pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, ess.getSettings().getRespawnPriority(), this); - pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, ess.getSettings().getRespawnPriority(), this); + pluginManager.registerEvent(PlayerRespawnEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor() + { + @Override + public void execute(final Listener ll, final Event event) throws EventException + { + ((EssentialsSpawnPlayerListener)ll).onPlayerRespawn((PlayerRespawnEvent)event); + } + }, this); + pluginManager.registerEvent(PlayerJoinEvent.class, playerListener, ess.getSettings().getRespawnPriority(), new EventExecutor() + { + @Override + public void execute(final Listener ll, final Event event) throws EventException + { + ((EssentialsSpawnPlayerListener)ll).onPlayerJoin((PlayerJoinEvent)event); + } + }, this); LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 81e8f6e9e..2814714a2 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -7,13 +7,13 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -public class EssentialsSpawnPlayerListener extends PlayerListener +public class EssentialsSpawnPlayerListener implements Listener { private final transient IEssentials ess; private final transient SpawnStorage spawns; @@ -26,7 +26,6 @@ public class EssentialsSpawnPlayerListener extends PlayerListener this.spawns = spawns; } - @Override public void onPlayerRespawn(final PlayerRespawnEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -51,7 +50,6 @@ public class EssentialsSpawnPlayerListener extends PlayerListener } } - @Override public void onPlayerJoin(final PlayerJoinEvent event) { final User user = ess.getUser(event.getPlayer()); |