diff options
Diffstat (limited to 'src/main/java')
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() { |