@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.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); } }
@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; } }
@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()); }
@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"))); } } } }
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; }
@EventHandler public void onPlayerBucketFill(PlayerBucketFillEvent e) { if (!canBuildHere(e.getPlayer(), e.getBlockClicked())) { e.setCancelled(true); } }