Package com.bergerkiller.bukkit.tc.events

Examples of com.bergerkiller.bukkit.tc.events.SignActionEvent


    return owner.getGroup().getBlockTracker().getMemberFromRails(railsBlock) == owner;
  }

  @Override
  protected void onSignChange(Block signblock, boolean active) {
    SignActionEvent event = new SignActionEvent(signblock, owner);
    event.setAction(active ? SignActionType.MEMBER_ENTER : SignActionType.MEMBER_LEAVE);
    SignAction.executeAll(event);
  }
View Full Code Here


      Block nextRail = iter.next();
      BlockLocation newNodeLocation;
      String newNodeName;
      boolean hasFinished = false;
      for (Block signblock : Util.getSignsFromRails(nextRail)) {
        SignActionEvent event = new SignActionEvent(signblock);
        if (event.getMode() != SignActionMode.NONE) {
          if (event.isType("tag", "switcher")){
            newNodeLocation = new BlockLocation(nextRail);
            newNodeName = newNodeLocation.toString();
          } else if (event.isType("destination")) {
            newNodeLocation = new BlockLocation(nextRail);
            newNodeName = event.getLine(2);
          } else if (event.isType("blocker") && event.isWatchedDirection(iter.currentDirection()) && event.isPowerAlwaysOn()) {
            hasFinished = true;
            break;
          } else {
            continue;
          }
View Full Code Here

    CommonUtil.callEvent(new VehicleUpdateEvent(vehicle));
    if (!from.equals(to)) {
      // Execute move events
      CommonUtil.callEvent(new VehicleMoveEvent(vehicle, from, to));
      for (org.bukkit.block.Block sign : this.getBlockTracker().getActiveSigns()) {
        SignAction.executeAll(new SignActionEvent(sign, this), SignActionType.MEMBER_MOVE);
      }
    }

    // Minecart collisions
    for (Entity near : entity.getNearbyEntities(0.2, 0, 0.2)) {
View Full Code Here

  public static void reroute() {
    BlockSet blocks = new BlockSet();
    blocks.addAll(blockNodes.keySet());
    clearAll();
    String name;
    SignActionEvent info;
    for (BlockLocation location : blocks) {
      name = location.toString();
      // Destination sign? If so, fix up the name
      Block block = location.getBlock();
      if (block == null) {
        continue;
      }
      for (Block signBlock : Util.getSignsFromRails(block)) {
        info = new SignActionEvent(signBlock);
        if (info.getSign() != null && info.isType("destination")) {
          name = info.getLine(2);
          break;
        }
      }
      getOrCreate(name, location);
    }
View Full Code Here

   */
  public SignActionEvent getSignEvent(World world) {
    if (this.isLoaded(world)) {
      Block signblock = this.location.toBlock(world);
      if (MaterialUtil.ISSIGN.get(signblock)) {
        SignActionEvent event = new SignActionEvent(signblock);
        if (this.validate(event)) {
          return event;
        }
      }
      this.remove(signblock);
View Full Code Here

    return owner;
  }

  @Override
  protected void onSignChange(Block signblock, boolean active) {
    SignActionEvent event = new SignActionEvent(signblock, owner);
    event.setAction(active ? SignActionType.GROUP_ENTER : SignActionType.GROUP_LEAVE);
    SignAction.executeAll(event);
  }
View Full Code Here

    }

    // Perform routine update events
    if (needsUpdate.clear()) {
      for (Block signBlock : getActiveSigns()) {
        SignAction.executeAll(new SignActionEvent(signBlock, owner), SignActionType.GROUP_UPDATE);
      }
      for (DetectorRegion region : getActiveDetectorRegions()) {
        region.update(owner);
      }
      // Member updates
      for (MinecartMember<?> member : owner) {
        BlockTrackerMember tracker = member.getBlockTracker();
        if (tracker.needsUpdate.clear()) {
          for (Block signBlock : tracker.getActiveSigns()) {
            SignAction.executeAll(new SignActionEvent(signBlock, tracker.getOwner()), SignActionType.MEMBER_UPDATE);
          }
          for (DetectorRegion region : tracker.getActiveDetectorRegions()) {
            region.update(tracker.getOwner());
          }
        }
View Full Code Here

  }

  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onBlockBreak(BlockBreakEvent event) {
    if (MaterialUtil.ISSIGN.get(event.getBlock())) {
      SignAction.handleDestroy(new SignActionEvent(event.getBlock()));
    } else if (MaterialUtil.ISRAILS.get(event.getBlock())) {
      onRailsBreak(event.getBlock());
    }
  }
View Full Code Here

        event.setCancelled(true);
      }
    } else if (MaterialUtil.ISSIGN.get(type)) {
      if (!Util.isSupported(block)) {
        // Sign is no longer supported - clear all sign actions
        SignAction.handleDestroy(new SignActionEvent(block));
      }
    }
  }
View Full Code Here

  private BlockSet poweredBlocks = new BlockSet();

  @EventHandler(priority = EventPriority.MONITOR)
  public void onChunkLoad(ChunkLoadEvent event) {
    // Set the initial power state of all signs within this Chunk
    SignActionEvent info;
    try {
      for (BlockState state : WorldUtil.getBlockStates(event.getChunk())) {
        if (state instanceof Sign) {
          info = new SignActionEvent(state.getBlock());
          LogicUtil.addOrRemove(poweredBlocks, info.getBlock(), isPowered(info));
        }
      }
    } catch (Throwable t) {
      TrainCarts.plugin.getLogger().log(Level.SEVERE, "Error while initializing sign power states in chunk " + event.getChunk().getX() + "/" + event.getChunk().getZ(), t);
    }
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.tc.events.SignActionEvent

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.