Added PlayerChangedWorldEvent.

By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
Bukkit/Spigot 2011-09-30 20:29:24 +02:00
parent 2ef3dfed7b
commit 2a3a80d543
4 changed files with 39 additions and 0 deletions

View file

@ -312,6 +312,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
*/

View file

@ -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;
}
}

View file

@ -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) {}
}

View file

@ -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() {