Package org.spout.vanilla.event.player

Examples of org.spout.vanilla.event.player.PlayerGameModeChangedEvent


  public void setGamemode(GameMode mode, boolean updateClient) {
    boolean changeToFromCreative = getGameMode() == GameMode.CREATIVE;
    Entity holder = getOwner();
    if (holder instanceof Player) {
      PlayerGameModeChangedEvent event = holder.getEngine().getEventManager().callEvent(new PlayerGameModeChangedEvent((Player) getOwner(), mode));
      if (event.isCancelled()) {
        return;
      }
      changeToFromCreative ^= event.getMode() == GameMode.CREATIVE;
      GameMode old = getGameMode();
      mode = event.getMode();

      //In Survival we shoudn't be able to fly.
      setCanFly(mode == GameMode.CREATIVE, updateClient);
      if (changeToFromCreative) {
        if (callAbilityChangeEvent().isCancelled()) {
View Full Code Here

TOP

Related Classes of org.spout.vanilla.event.player.PlayerGameModeChangedEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.