@EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerBucketFill(PlayerBucketFillEvent event) {
    if (event.isCancelled()) return;

    final Player player = event.getPlayer();
    final Block block = event.getBlockClicked();

    if (player.getWorld() != plugin.getIslandWorld()) return;
    if (player.isOp()) return;
    if (player.hasPermission("islandworld.bypass.island")) return;

    if (block != null && !plugin.canBuildOnLocation(player, block.getLocation()))
      event.setCancelled(true);

    plugin.debug("Event :" + event.getEventName() + ", cancelled:" + event.isCancelled());
  }
Ejemplo n.º 2
0
  @Override
  public void onPlayerBucketFill(PlayerBucketFillEvent event) {
    if (event.isCancelled()) {
      return;
    }

    Block block = event.getBlockClicked();
    Player player = event.getPlayer();

    if (!this.playerCanUseItemHere(player, block, event.getBucket())) {
      event.setCancelled(true);
      return;
    }
  }
Ejemplo n.º 3
0
 @EventHandler(priority = EventPriority.HIGH)
 public void playerFillBucket(PlayerBucketFillEvent event) {
   if (event.isCancelled()) {
     return;
   }
   Player player = event.getPlayer();
   if (vanishNoPacket.isPlayerInvisible(player)) {
     return;
   }
   Block block = event.getBlockClicked();
   Set<Snitch> snitches = snitchManager.findSnitches(block.getWorld(), block.getLocation());
   for (Snitch snitch : snitches) {
     if (!isOnSnitch(snitch, player.getName()) || isDebugging()) {
       if (checkProximity(snitch, player.getName())) {
         plugin.getJaLogger().logSnitchBucketFill(snitch, player, block);
       }
     }
   }
 }