Package com.tommytony.war

Examples of com.tommytony.war.Warzone


    }
  }
 
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerRespawn(PlayerRespawnEvent event) {
    Warzone playingZone = Warzone.getZoneByPlayerName(event.getPlayer().getName());
    Warzone deadZone = Warzone.getZoneForDeadPlayer(event.getPlayer());
    if (playingZone == null && deadZone != null) {
      // Game ended while player was dead, so restore state
      deadZone.getReallyDeadFighters().remove(event.getPlayer().getName());
      if (deadZone.hasPlayerState(event.getPlayer().getName())) {
        deadZone.restorePlayerState(event.getPlayer());
      }
      event.setRespawnLocation(deadZone.getEndTeleport(LeaveCause.DISCONNECT));
      return;
    } else if (playingZone == null) {
      // Player not playing war
      return;
    } else if (deadZone == null) {
View Full Code Here


  }

  @EventHandler
  public void onPlayerTeleport(final PlayerTeleportEvent event) {
    if (War.war.isLoaded()) {
      Warzone playerWarzone = Warzone.getZoneByPlayerName(event.getPlayer().getName());
      Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
      if (playerWarzone != null) {
        if (!playerWarzone.getVolume().contains(event.getTo())) {
          // Prevent teleporting out of the warzone
          if (!playerWarzone.getWarzoneConfig().getBoolean(WarzoneConfig.REALDEATHS)) {
            War.war.badMsg(event.getPlayer(), "Use /leave (or /war leave) to exit the zone.");
          }
          playerWarzone.dropAllStolenObjects(event.getPlayer(), false);
          playerWarzone.respawnPlayer(event, playerTeam, event.getPlayer());
        }
      }
    }
  }
View Full Code Here

  public void onInventoryClick(final InventoryClickEvent event) {
    if (!(event.getWhoClicked() instanceof Player)) {
      return;
    }
    Player player = (Player) event.getWhoClicked();
    Warzone zone = Warzone.getZoneByPlayerName(player.getName());
    if (zone == null) {
      return;
    }
    // Prevent thieves from taking their bomb/wool/cake into a chest, etc.
    if (zone.isThief(player.getName())) {
      event.setCancelled(true);
      player.playSound(player.getLocation(), Sound.FIZZ, 10, 10);
    } else // Magically give player a wool block when they click their helmet
      if (event.getSlotType() == InventoryType.SlotType.ARMOR && event.getSlot() == 39
        && zone.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
      ItemStack teamBlock = zone.getPlayerTeam(player.getName()).getKind().getBlockHead();
      player.getInventory().remove(teamBlock.getType());
      event.setCursor(teamBlock);
      event.setCancelled(true);
    }
  }
View Full Code Here

  }

  @EventHandler
  public void onBucketEmpty(PlayerBucketEmptyEvent event) {
    Player player = (Player) event.getPlayer();
    Warzone zone = Warzone.getZoneByPlayerName(player.getName());
    if (zone == null) {
      return;
    }
    if (zone.isImportantBlock(event.getBlockClicked())) {
      event.setCancelled(true);
      player.playSound(player.getLocation(), Sound.FIZZ, 10, 10);
    }
  }
View Full Code Here

TOP

Related Classes of com.tommytony.war.Warzone

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.