Ejemplo n.º 1
0
  @EventHandler(priority = EventPriority.HIGH)
  public void liquidFill(PlayerBucketFillEvent event) {
    OwnedLand land = OwnedLand.getApplicableLand(event.getBlockClicked().getLocation());
    if (land == null) {
      return;
    }
    Player p = event.getPlayer();

    if (!land.hasPermTo(p, this)) {
      p.sendMessage(
          ChatColor.RED + getPlugin().getMessageConfig().getString("event.build.bucketFill"));
      event.setCancelled(true);
    }
  }
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
 public void onPlayerFillBucket(PlayerBucketFillEvent PBF) {
   Player PBFP = PBF.getPlayer();
   if (!Authentication.config.getBoolean("Authentication.Events.BlockBreak.Allowed") == true) {
     if (!Authentication.instance.hasPlayerAccepted(PBFP)) {
       PBF.setCancelled(true);
       if (Authentication.instance.RulesMessage == true) {
         PBFP.performCommand("serverrules");
       }
       if (Authentication.instance.EventMessage == true) {
         PBFP.sendMessage(
             ChatColor.translateAlternateColorCodes(
                 '&',
                 Authentication.config.getString("Authentication.Events.BlockBreak.Message")));
       }
     }
   }
 }
Ejemplo n.º 4
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);
       }
     }
   }
 }
Ejemplo n.º 5
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onPlayerBucketFill(final PlayerBucketFillEvent event) {
    if (!PlotMe.cPerms(event.getPlayer(), "plotme.admin.buildanywhere")) {
      Block b = event.getBlockClicked();
      if (PlotManager.isPlotWorld(b)) {
        String id = PlotManager.getPlotId(b.getLocation());
        Player p = event.getPlayer();

        if (id.equalsIgnoreCase("")) {
          p.sendMessage(PlotMe.caption("ErrCannotBuild"));
          event.setCancelled(true);
        } else {
          Plot plot = PlotManager.getPlotById(p, id);

          if (plot == null) {
            p.sendMessage(PlotMe.caption("ErrCannotBuild"));
            event.setCancelled(true);
          } else if (!plot.isAllowed(p.getName())) {
            p.sendMessage(PlotMe.caption("ErrCannotBuild"));
            event.setCancelled(true);
          }
        }
      }
    }
  }
  @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());
  }
  private static PlayerEvent getPlayerBucketEvent(
      boolean isFilling,
      EntityPlayerMP who,
      int clickedX,
      int clickedY,
      int clickedZ,
      int clickedFace,
      ItemStack itemstack,
      net.minecraft.src.Item item) {
    Player player =
        (who == null)
            ? null
            : (Player) BukkitEntity.getEntity((BukkitServer) Bukkit.getServer(), who);
    BukkitItemStack itemInHand = new BukkitItemStack(new ItemStack(item));
    Material bucket = Material.getMaterial(itemstack.itemID);

    BukkitWorld craftWorld = (BukkitWorld) player.getWorld();
    BukkitServer craftServer = (BukkitServer) player.getServer();

    Block blockClicked = craftWorld.getBlockAt(clickedX, clickedY, clickedZ);
    BlockFace blockFace = BukkitBlock.notchToBlockFace(clickedFace);

    PlayerEvent event = null;
    if (isFilling) {
      event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand);
      ((PlayerBucketFillEvent) event)
          .setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    } else {
      event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand);
      ((PlayerBucketEmptyEvent) event)
          .setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ));
    }

    craftServer.getPluginManager().callEvent(event);

    return event;
  }
Ejemplo n.º 8
0
 @EventHandler
 public void onPlayerBucketFill(PlayerBucketFillEvent e) {
   if (!canBuildHere(e.getPlayer(), e.getBlockClicked())) {
     e.setCancelled(true);
   }
 }