addition of PlayerGameModeChangeEvent
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
@@ -301,6 +301,13 @@ public abstract class Event implements Serializable {
|
||||
*/
|
||||
PLAYER_FISH(Category.PLAYER),
|
||||
|
||||
/**
|
||||
* Called when the game mode of a player is changed
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerGameModeChangeEvent
|
||||
*/
|
||||
PLAYER_GAME_MODE_CHANGE(Category.PLAYER),
|
||||
|
||||
/**
|
||||
* BLOCK EVENTS
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private boolean cancelled;
|
||||
private GameMode newGameMode;
|
||||
|
||||
public PlayerGameModeChangeEvent(Player player, GameMode newGameMode) {
|
||||
super(Type.PLAYER_GAME_MODE_CHANGE, player);
|
||||
this.newGameMode = newGameMode;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
public GameMode getNewGameMode() {
|
||||
return newGameMode;
|
||||
}
|
||||
}
|
||||
@@ -191,4 +191,11 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerFish(PlayerFishEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player's game mode is changed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user