Search in sources :

Example 1 with PlayerGameModeChangeEvent

use of org.bukkit.event.player.PlayerGameModeChangeEvent in project Glowstone by GlowstoneMC.

the class GlowPlayer method setGameMode.

@Override
public void setGameMode(GameMode mode) {
    if (getGameMode() != mode) {
        PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this, mode);
        if (EventFactory.getInstance().callEvent(event).isCancelled()) {
            return;
        }
        super.setGameMode(mode);
        super.setFallDistance(0);
        updateUserListEntries(UserListItemMessage.gameModeOne(getUniqueId(), mode.getValue()));
        session.send(new StateChangeMessage(Reason.GAMEMODE, mode.getValue()));
    }
    setGameModeDefaults();
}
Also used : StateChangeMessage(net.glowstone.net.message.play.game.StateChangeMessage) PlayerGameModeChangeEvent(org.bukkit.event.player.PlayerGameModeChangeEvent)

Aggregations

StateChangeMessage (net.glowstone.net.message.play.game.StateChangeMessage)1 PlayerGameModeChangeEvent (org.bukkit.event.player.PlayerGameModeChangeEvent)1