org.bukkit.event.player.PlayerBucketEmptyEvent Java Examples
The following examples show how to use
org.bukkit.event.player.PlayerBucketEmptyEvent.
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: NetherPortals.java From askyblock with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.LOW) public void onBucketEmpty(final PlayerBucketEmptyEvent e) { if (DEBUG) plugin.getLogger().info("DEBUG: " + e.getEventName()); if (!Settings.newNether) { if (e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_nether") || e.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.worldName + "_the_end")) { if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) { return; } if (!awayFromSpawn(e.getPlayer()) && !e.getPlayer().isOp()) { e.setCancelled(true); } } } }
Example #2
Source File: BlockTransformEvent.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
/** * Get whether the {@link Block} was probably transformed by a player. * * @return Whether the event is considered "manual." */ public final boolean isManual() { final Event event = getCause(); if (event instanceof BlockPlaceEvent || event instanceof BlockBreakEvent || event instanceof PlayerBucketEmptyEvent || event instanceof PlayerBucketFillEvent) return true; if (event instanceof BlockIgniteEvent) { BlockIgniteEvent igniteEvent = (BlockIgniteEvent) event; if (igniteEvent.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && igniteEvent.getIgnitingEntity() != null) { return true; } } if (event instanceof ExplosionPrimeByEntityEvent && ((ExplosionPrimeByEntityEvent) event).getPrimer() instanceof Player) { return true; } return false; }
Example #3
Source File: DisplayProtectionListener.java From QuickShop-Reremake with GNU General Public License v3.0 | 6 votes |
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void player(PlayerBucketEmptyEvent event) { if (!useEnhanceProtection) { return; } if (DisplayItem.getNowUsing() != DisplayType.REALITEM) { return; } final Block waterBlock = event.getBlockClicked().getRelative(event.getBlockFace()); final Shop shop = getShopPlayer(waterBlock.getRelative(BlockFace.DOWN).getLocation(),true); if (shop == null) { return; } event.setCancelled(true); sendAlert( "[DisplayGuard] Player " + event.getPlayer().getName() + " trying use water to move somethings on the shop top, QuickShop already remove it."); }
Example #4
Source File: PlayerListener.java From civcraft with GNU General Public License v2.0 | 6 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void OnPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) { Resident resident = CivGlobal.getResident(event.getPlayer()); if (resident == null) { event.setCancelled(true); return; } ChunkCoord coord = new ChunkCoord(event.getBlockClicked().getLocation()); CultureChunk cc = CivGlobal.getCultureChunk(coord); if (cc != null) { if (event.getBucket().equals(Material.LAVA_BUCKET) || event.getBucket().equals(Material.LAVA)) { if (!resident.hasTown() || (resident.getTown().getCiv() != cc.getCiv())) { CivMessage.sendError(event.getPlayer(), "You cannot place lava inside another civ's culture."); event.setCancelled(true); return; } } } }
Example #5
Source File: BlockTransformEvent.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
/** * Return true if the block transformation was performed "by hand". * * Handled: * - place * - mine * - bucket fill/empty * - flint & steel fire/tnt * * Not handled: * - bonemeal * - probably lots of other things */ public boolean isManual() { final Event event = getCause(); if(Types.instanceOfAny( event, BlockPlaceEvent.class, BlockBreakEvent.class, PlayerBucketEmptyEvent.class, PlayerBucketFillEvent.class )) return true; if(event instanceof BlockIgniteEvent) { BlockIgniteEvent igniteEvent = (BlockIgniteEvent) event; if(igniteEvent.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && igniteEvent.getIgnitingEntity() != null) { return true; } } if(event instanceof ExplosionPrimeByEntityEvent && ((ExplosionPrimeByEntityEvent) event).getPrimer() instanceof Player) { return true; } return false; }
Example #6
Source File: BuildHeight.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onEmptyBucket(PlayerBucketEmptyEvent event) { Block toFill = event.getBlockClicked().getRelative(event.getBlockFace()); if (toFill.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 #7
Source File: BukkitPlotListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBucketEmptyEvent(PlayerBucketEmptyEvent 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.add(event.getBlockFace().getModX(), event.getBlockFace().getModY(), event.getBlockFace().getModZ())); 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 #8
Source File: BlockPhysicsListener.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onBucketUse(PlayerBucketEmptyEvent e) { // Fix for placing water on player heads Location l = e.getBlockClicked().getRelative(e.getBlockFace()).getLocation(); if (BlockStorage.hasBlockInfo(l)) { e.setCancelled(true); } }
Example #9
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { Block block = event.getBlockClicked().getRelative(event.getBlockFace()); Player player = event.getPlayer(); NovaPlayer nPlayer = PlayerManager.getPlayer(player); if(nPlayer.getPreferences().getBypass()) { return; } //Fluid protection NovaRegion fluidProtectRegion = null; for(NovaRegion region : plugin.getRegionManager().getRegions()) { if(!region.getWorld().equals(block.getWorld())) { continue; } Location centerLocation = region.getCenter().clone(); Location blockLocation = block.getLocation().clone(); centerLocation.setY(0); blockLocation.setY(0); if(blockLocation.distance(centerLocation) <= region.getDiagonal() / 2 + Config.REGION_FLUIDPROTECT.getInt()) { fluidProtectRegion = region; break; } } if((fluidProtectRegion != null && (!nPlayer.hasGuild() || (!fluidProtectRegion.getGuild().isMember(nPlayer) && !fluidProtectRegion.getGuild().isAlly(nPlayer.getGuild())))) || (RegionManager.get(block) != null && (!plugin.getRegionManager().canInteract(player, block) || !nPlayer.hasPermission(GuildPermission.BLOCK_PLACE)))) { event.setCancelled(true); Message.CHAT_REGION_DENY_INTERACT.send(player); } }
Example #10
Source File: Areas.java From AnnihilationPro with MIT License | 5 votes |
@EventHandler(priority = EventPriority.LOWEST,ignoreCancelled = true) public void checkBreaks(PlayerBucketEmptyEvent event) { if(event.getPlayer().getGameMode() != GameMode.CREATIVE) { Area a = this.getArea(new Loc(event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(),false)); if(a != null) { event.setCancelled(true); } } }
Example #11
Source File: TitleRespawn.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketEmpty(PlayerBucketEmptyEvent event) { boolean material = event.getBucket().equals(Material.WATER_BUCKET) || event.getBucket().equals(Material.LAVA_BUCKET) || event.getBucket().equals(Material.LAVA) || event.getBucket().equals(Material.WATER) || event.getBucket().equals(Material.AIR); if (material && isDeadUUID(event.getPlayer().getUniqueId())) { event.setCancelled(true); } }
Example #12
Source File: CancellableChunkEvents.java From ClaimChunk with MIT License | 5 votes |
@EventHandler public void onLiquidPlacePickup(PlayerBucketEmptyEvent e) { if (e != null) { BlockFace bf = e.getBlockFace(); Vector v = new Vector(bf.getModX(), bf.getModY(), bf.getModZ()); ChunkEventHelper.handleBlockEvent(e.getPlayer(), e.getBlockClicked().getLocation().add(v).getChunk(), e); } }
Example #13
Source File: ProtectionHandler.java From Civs with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onBucketEmpty(PlayerBucketEmptyEvent event) { boolean cancel = shouldBlockAction(event.getBlockClicked().getLocation(), event.getPlayer(), "block_build"); if (cancel) { event.setCancelled(true); event.getPlayer().sendMessage(Civs.getPrefix() + LocaleManager.getInstance().getTranslationWithPlaceholders(event.getPlayer(), LocaleConstants.REGION_PROTECTED)); } }
Example #14
Source File: BlockTransformListener.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @EventWrapper public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) { Block block = event.getBlockClicked().getRelative(event.getBlockFace()); Material contents = Materials.materialInBucket(event.getBucket()); if(contents == null) { return; } BlockState newBlock = BlockStateUtils.cloneWithMaterial(block, contents); this.callEvent(event, block.getState(), newBlock, event.getPlayer()); }
Example #15
Source File: BlockPlaceRegion.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketEmpty(PlayerBucketEmptyEvent event) { Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR)); if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), material, event).equals(FilterState.DENY)) { event.setCancelled(true); ChatUtil.sendWarningMessage(event.getPlayer(), message); } }
Example #16
Source File: BlockEventRegion.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketEmpty(PlayerBucketEmptyEvent event) { Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR)); if (!event.isCancelled() && filter.evaluate(event.getPlayer(), material, 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 #17
Source File: BlockTransformListener.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") @EventWrapper public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) { Block block = event.getBlockClicked().getRelative(event.getBlockFace()); Material contents = Materials.materialInBucket(event.getBucket()); if (contents == null) { return; } BlockState newBlock = BlockStates.cloneWithMaterial(block, contents); this.callEvent(event, block.getState(), newBlock, event.getPlayer()); }
Example #18
Source File: BlockPlaceAgainstRegion.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onBucketEmpty(PlayerBucketEmptyEvent event) { Material material = (event.getBucket().equals(Material.WATER_BUCKET) ? Material.WATER : (event.getBucket().equals(Material.LAVA_BUCKET) ? Material.LAVA : Material.AIR)); if (!event.isCancelled() && region.contains(new BlockRegion(null, event.getBlockClicked().getRelative(event.getBlockFace()).getLocation().toVector())) && filter.evaluate(event.getPlayer(), material, event).equals(FilterState.DENY)) { event.setCancelled(true); ChatUtil.sendWarningMessage(event.getPlayer(), message); } }
Example #19
Source File: CoreObjective.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onBucketEmpty(PlayerBucketEmptyEvent event) { if (lava.contains(event.getBlockClicked().getRelative(event.getBlockFace()))) event.setCancelled(true); }
Example #20
Source File: BucketAction.java From FunnyGuilds with Apache License 2.0 | 4 votes |
@EventHandler public void onEmpty(PlayerBucketEmptyEvent e) { if (ProtectionSystem.build(e.getPlayer(), e.getBlockClicked().getLocation())) { e.setCancelled(true); } }
Example #21
Source File: PlayerEventHandler.java From GriefDefender with MIT License | 4 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) { onPlayerBucketEvent(event); }
Example #22
Source File: IslandGuard.java From askyblock with GNU General Public License v2.0 | 4 votes |
/** * Prevents emptying of buckets outside of island space * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBucketEmpty(final PlayerBucketEmptyEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (inWorld(e.getPlayer())) { Player p = e.getPlayer(); if (e.getBlockClicked() != null) { // This is where the water or lava actually will be dumped Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace()); if (actionAllowed(p, dumpBlock.getLocation(), SettingsFlag.BUCKET)) { // Check if biome is Nether and then allow water placement but fizz the water if (e.getBlockClicked().getBiome().equals(Biome.HELL)) { if (plugin.getServer().getVersion().contains("(MC: 1.8") || plugin.getServer().getVersion().contains("(MC: 1.7")) { if (e.getPlayer().getItemInHand().getType().equals(Material.WATER_BUCKET)) { e.setCancelled(true); e.getPlayer().getItemInHand().setType(Material.BUCKET); e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.valueOf("FIZZ"), 1F, 2F); Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).biomeSet.replace("[biome]", "Nether")); } } else { if (Util.playerIsHolding(e.getPlayer(), Material.WATER_BUCKET)) { e.setCancelled(true); if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) { e.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.BUCKET)); } else if (e.getPlayer().getInventory().getItemInOffHand().getType() == Material.WATER_BUCKET) { e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.BUCKET)); } e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F); Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).biomeSet.replace("[biome]", "Nether")); } } } return; } // Not allowed Util.sendMessage(p, ChatColor.RED + plugin.myLocale(p.getUniqueId()).islandProtected); e.setCancelled(true); } } }
Example #23
Source File: BucketsEmptiedListener.java From Statz with GNU General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBucketEmpty(final PlayerBucketEmptyEvent event) { final PlayerStat stat = PlayerStat.BUCKETS_EMPTIED; // Get player final Player player = event.getPlayer(); // Do general check if (!plugin.doGeneralCheck(player, stat)) return; PlayerStatSpecification specification = new BucketsEmptiedSpecification(player.getUniqueId(), 1, player.getWorld().getName()); // Update value to new stat. plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, specification.constructQuery()); }
Example #24
Source File: ExprTool.java From Skript with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), PlayerItemHeldEvent.class, PlayerBucketFillEvent.class, PlayerBucketEmptyEvent.class); }
Example #25
Source File: EnvironmentControlListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGH) public void noBucket(final PlayerBucketEmptyEvent event) { event.setCancelled(true); }
Example #26
Source File: FreezeListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBucketEmpty(final PlayerBucketEmptyEvent event) { if(freeze.isFrozen(event.getPlayer())) { event.setCancelled(true); } }
Example #27
Source File: SeaLevelRise.java From GlobalWarming with GNU Lesser General Public License v3.0 | 4 votes |
/** * Emptying a bucket (water or lava) will remove the adjacent block * from the tracked set */ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { Block adjacent = event.getBlockClicked().getRelative(event.getBlockFace()); adjacent.removeMetadata(SEALEVEL_BLOCK, GlobalWarming.getInstance()); }
Example #28
Source File: FreezeMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBucketEmpty(final PlayerBucketEmptyEvent event) { if (freeze.isFrozen(event.getPlayer())) { event.setCancelled(true); } }
Example #29
Source File: PlayerEventHandler.java From GriefDefender with MIT License | 4 votes |
public void onPlayerBucketEvent(PlayerBucketEvent event) { final Player player = event.getPlayer(); final Block clickedBlock = event.getBlockClicked(); GDCauseStackManager.getInstance().pushCause(player); if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(player.getWorld().getUID())) { return; } if (GriefDefenderPlugin.isTargetIdBlacklisted(Flags.INTERACT_BLOCK_SECONDARY.getName(), clickedBlock, player.getWorld().getUID())) { return; } GDTimings.PLAYER_INTERACT_BLOCK_SECONDARY_EVENT.startTiming(); final Object source = player; final Location location = clickedBlock.getLocation(); final GDClaim claim = this.dataStore.getClaimAt(location); final TrustType trustType = NMSUtil.getInstance().isTileInventory(location) || clickedBlock != null && clickedBlock.getType() == Material.ENDER_CHEST ? TrustTypes.CONTAINER : TrustTypes.ACCESSOR; Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.INTERACT_BLOCK_SECONDARY, source, clickedBlock, player, trustType, true); if (result == Tristate.FALSE) { event.setCancelled(true); GDTimings.PLAYER_INTERACT_BLOCK_SECONDARY_EVENT.stopTiming(); return; } GDTimings.PLAYER_INTERACT_BLOCK_SECONDARY_EVENT.stopTiming(); if (event instanceof PlayerBucketEmptyEvent) { // check block place result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.BLOCK_PLACE, source, event.getBucket().name().toLowerCase().replace("_bucket", ""), player, TrustTypes.BUILDER, true); if (result == Tristate.FALSE) { event.setCancelled(true); return; } } else if (event instanceof PlayerBucketFillEvent) { // check block break result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, Flags.BLOCK_BREAK, source, event.getBlockClicked(), player, TrustTypes.BUILDER, true); if (result == Tristate.FALSE) { event.setCancelled(true); return; } } }