Package com.palmergames.bukkit.townywar.event

Examples of com.palmergames.bukkit.townywar.event.CellAttackEvent


  }
 
  @Override
  public void onCustomEvent(Event event) {
    if (event.getEventName().equals("CellAttack")) {
      CellAttackEvent cellAttackEvent = (CellAttackEvent)event;
      try {
        CellUnderAttack cell = cellAttackEvent.getData();
        TownyWar.registerAttack(cell);
      } catch (Exception e) {
        cellAttackEvent.setCancelled(true);
        cellAttackEvent.setReason(e.getMessage());
      }
    } else if (event.getEventName().equals("CellDefended")) {
      CellDefendedEvent cellDefendedEvent = (CellDefendedEvent)event;
      Player player = cellDefendedEvent.getPlayer();
      CellUnderAttack cell = cellDefendedEvent.getCell().getAttackData();
View Full Code Here


    // Check that attack takes place on the edge of a town
    if (!TownyUtil.isOnEdgeOfOwnership(landOwnerTown, worldCoord))
      throw new TownyException(TownySettings.getLangString("msg_err_enemy_war_not_on_edge_of_town"));
   
    // Call Event (and make sure an attack isn't already under way)
    CellAttackEvent cellAttackEvent = new CellAttackEvent(player, block);
    plugin.getServer().getPluginManager().callEvent(cellAttackEvent);
   
    if (cellAttackEvent.isCancelled()) {
      if (cellAttackEvent.hasReason())
        throw new TownyException(cellAttackEvent.getReason());
      else
        return false;
    }
   
    // Successful Attack
View Full Code Here

      return;
   
    if (block.getType() == TownyWarConfig.getFlagBaseMaterial()) {
      int topY = block.getWorld().getHighestBlockYAt(block.getX(), block.getZ()) - 1;
      if (block.getY() >= topY) {
        CellAttackEvent cellAttackEvent = new CellAttackEvent(player, block);
        this.plugin.getServer().getPluginManager().callEvent(cellAttackEvent);
        if (cellAttackEvent.isCancelled()) {
          event.setBuild(false);
          event.setCancelled(true);
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.palmergames.bukkit.townywar.event.CellAttackEvent

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.