コード例 #1
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockGrow(final BlockGrowEvent event) {
    Block b = event.getBlock();

    if (PlotManager.isPlotWorld(b)) {
      String id = PlotManager.getPlotId(b.getLocation());

      if (id.equalsIgnoreCase("")) {
        event.setCancelled(true);
      }
    }
  }
コード例 #2
0
  public static void handleBlockGrowEvent(World world, int x, int y, int z, int type, int data) {
    Block block = new BukkitBlock(new BukkitChunk(world.getChunkFromBlockCoords(x, z)), x, y, z);
    BukkitBlockState state = (BukkitBlockState) block.getState();
    state.setTypeId(type);
    state.setRawData((byte) data);

    BlockGrowEvent event = new BlockGrowEvent(block, state);
    Bukkit.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
      state.update(true);
    }
  }
コード例 #3
0
 @EventHandler
 public void BlockGrowEvent(BlockGrowEvent event) {
   if (!arena.getRegion().isInside(event.getBlock().getLocation()) || arena.getEditMode()) return;
   event.setCancelled(true);
 }
コード例 #4
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onBlockGrow(BlockGrowEvent event) {
   addToCheck(event.getBlock(), event.getBlock().getState());
 }