Java Code Examples for org.bukkit.event.player.PlayerBucketFillEvent#setCancelled()
The following examples show how to use
org.bukkit.event.player.PlayerBucketFillEvent#setCancelled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtectionHandler.java From Civs with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onBucketEmpty(PlayerBucketFillEvent event) { boolean cancel = shouldBlockAction(event.getBlockClicked().getLocation(), event.getPlayer(), "block_break"); if (cancel) { event.setCancelled(true); event.getPlayer().sendMessage(Civs.getPrefix() + LocaleManager.getInstance().getTranslationWithPlaceholders(event.getPlayer(), LocaleConstants.REGION_PROTECTED)); } }
Example 2
Source File: GlobalProtectionListener.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerBucketFill(PlayerBucketFillEvent event) { Player player = event.getPlayer(); if (DPlayerListener.isCitizensNPC(player)) { return; } Block block = event.getBlockClicked(); if (DPortal.getByBlock(plugin, block) != null) { event.setCancelled(true); // Workaround for a bug of Bukkit event.getPlayer().sendBlockChange(block.getLocation(), block.getType(), (byte) 0); } }
Example 3
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.LOW) public void onBucketFill(final PlayerBucketFillEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (inWorld(e.getPlayer())) { // This permission bypasses protection if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) { return; } Island island = plugin.getGrid().getProtectedIslandAt(e.getBlockClicked().getLocation()); if (island != null) { if (island.getMembers().contains(e.getPlayer().getUniqueId())) { return; } if (island.getIgsFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) { return; } if (island.getIgsFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) { return; } if (island.getIgsFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) { return; } if (island.getIgsFlag(SettingsFlag.BUCKET)) { return; } } else { // Null if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) { return; } } // Not allowed Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected); e.setCancelled(true); } }
Example 4
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBucketFillEvent(PlayerBucketFillEvent event) { IPlayer player = plugin.wrapPlayer(event.getPlayer()); Location location = BukkitUtil.adapt(event.getBlockClicked().getLocation()); if (player.hasPermission(PermissionNames.ADMIN_BUILDANYWHERE)) { return; } if (manager.isPlotWorld(location)) { Plot plot = manager.getPlot(location); if (plot == null) { player.sendMessage(api.C("CannotBuild")); event.setCancelled(true); } else { if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) { return; } Optional<Plot.AccessLevel> member = plot.isMember(player.getUniqueId()); if (member.isPresent()) { if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) { player.sendMessage(api.C("CannotBuild")); event.setCancelled(true); } else if (api.isPlotLocked(plot.getId())) { player.sendMessage(api.C("PlotLocked")); event.setCancelled(true); } } else { player.sendMessage(api.C("CannotBuild")); event.setCancelled(true); } } } }
Example 5
Source File: BuildHeight.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onFillBucket(PlayerBucketFillEvent event) { Block toEmpty = event.getBlockClicked().getRelative(event.getBlockFace()); if (toEmpty.getY() >= height && !event.isCancelled()) { event.setCancelled(true); ChatUtil.sendWarningMessage(event.getPlayer(), "You have reached the maximum build height (" + ChatColor.AQUA + height + ChatColor.RED + " blocks)"); } }
Example 6
Source File: BlockBreakRegion.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketFill(PlayerBucketFillEvent event) { if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY)) { event.setCancelled(true); ChatUtil.sendWarningMessage(event.getPlayer(), message); } }
Example 7
Source File: BlockEventRegion.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketFill(PlayerBucketFillEvent event) { if (!event.isCancelled() && filter.evaluate(event.getPlayer(), event.getBlockClicked().getRelative(event.getBlockFace()), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector()))) { event.setCancelled(true); ChatUtil.sendWarningMessage(event.getPlayer(), message); } }
Example 8
Source File: FreezeMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBucketFill(final PlayerBucketFillEvent event) { if (freeze.isFrozen(event.getPlayer())) { event.setCancelled(true); } }
Example 9
Source File: FreezeListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBucketFill(final PlayerBucketFillEvent event) { if(freeze.isFrozen(event.getPlayer())) { event.setCancelled(true); } }
Example 10
Source File: EnvironmentControlListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGH) public void noBucket(final PlayerBucketFillEvent event) { event.setCancelled(true); }
Example 11
Source File: BucketAction.java From FunnyGuilds with Apache License 2.0 | 4 votes |
@EventHandler public void onFill(PlayerBucketFillEvent e) { if (ProtectionSystem.build(e.getPlayer(), e.getBlockClicked().getLocation())) { e.setCancelled(true); } }
Example 12
Source File: CoreObjective.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBucketFill(PlayerBucketFillEvent event) { if (lava.contains(event.getBlockClicked())) event.setCancelled(true); }