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();
}
Aggregations