diff options
author | sunkid <sunkid@iminurnetz.com> | 2011-09-30 20:29:24 +0200 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-10-01 15:35:04 -0400 |
commit | a457ea9784c62e125a090c6fe876bbfa1639e896 (patch) | |
tree | c7d7ee0904f81861ed58c2bff962c51c2769e093 /src/main/java/org | |
parent | 0f885de3ba66d5f60689bae185da25f661c41fa2 (diff) | |
download | bukkit-a457ea9784c62e125a090c6fe876bbfa1639e896.tar bukkit-a457ea9784c62e125a090c6fe876bbfa1639e896.tar.gz bukkit-a457ea9784c62e125a090c6fe876bbfa1639e896.tar.lz bukkit-a457ea9784c62e125a090c6fe876bbfa1639e896.tar.xz bukkit-a457ea9784c62e125a090c6fe876bbfa1639e896.zip |
Added PlayerChangedWorldEvent.
Diffstat (limited to 'src/main/java/org')
4 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java index 3bbd7ab8..25271f73 100644 --- a/src/main/java/org/bukkit/event/Event.java +++ b/src/main/java/org/bukkit/event/Event.java @@ -313,6 +313,13 @@ public abstract class Event implements Serializable { PLAYER_GAME_MODE_CHANGE(Category.PLAYER), /** + * Called after a player has changed to a new world + * + * @see org.bukkit.event.player.PlayerChangedWorldEvent + */ + PLAYER_CHANGED_WORLD(Category.PLAYER), + + /** * BLOCK EVENTS */ diff --git a/src/main/java/org/bukkit/event/player/PlayerChangedWorldEvent.java b/src/main/java/org/bukkit/event/player/PlayerChangedWorldEvent.java new file mode 100644 index 00000000..badbc13f --- /dev/null +++ b/src/main/java/org/bukkit/event/player/PlayerChangedWorldEvent.java @@ -0,0 +1,18 @@ +package org.bukkit.event.player; + +import org.bukkit.World; +import org.bukkit.entity.Player; + +public class PlayerChangedWorldEvent extends PlayerEvent { + + private final World from; + + public PlayerChangedWorldEvent(Player player, World from) { + super(Type.PLAYER_CHANGED_WORLD, player); + this.from = from; + } + + public World getFrom() { + return from; + } +} diff --git a/src/main/java/org/bukkit/event/player/PlayerListener.java b/src/main/java/org/bukkit/event/player/PlayerListener.java index 423caebb..f108a32f 100644 --- a/src/main/java/org/bukkit/event/player/PlayerListener.java +++ b/src/main/java/org/bukkit/event/player/PlayerListener.java @@ -205,4 +205,11 @@ public class PlayerListener implements Listener { * @param event Relevant event details */ public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {} + + /** + * Called after a player changes to a new world + * + * @param event Relevant event details + */ + public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {} } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 7b61a266..ad69872e 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -434,6 +434,13 @@ public class JavaPluginLoader implements PluginLoader { } }; + case PLAYER_CHANGED_WORLD: + return new EventExecutor() { + public void execute(Listener listener, Event event) { + ((PlayerListener) listener).onPlayerChangedWorld((PlayerChangedWorldEvent) event); + } + }; + // Block Events case BLOCK_PHYSICS: return new EventExecutor() { |