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 | 04a43eb5d0f630fc815b5a136273bb42a1250f63 (patch) | |
tree | c5118a38cfb231769c54593d7b507164ced4ce5a /EssentialsSpawn | |
parent | 792f70efa5f3a47f642360e97979fe841593384c (diff) | |
download | Essentials-04a43eb5d0f630fc815b5a136273bb42a1250f63.tar Essentials-04a43eb5d0f630fc815b5a136273bb42a1250f63.tar.gz Essentials-04a43eb5d0f630fc815b5a136273bb42a1250f63.tar.lz Essentials-04a43eb5d0f630fc815b5a136273bb42a1250f63.tar.xz Essentials-04a43eb5d0f630fc815b5a136273bb42a1250f63.zip |
New Event code for EssentialsSpawn
Diffstat (limited to 'EssentialsSpawn')
-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()); |