@EventWrapper public void onBlockIgnite(final BlockIgniteEvent event) { // Flint & steel generates a BlockPlaceEvent if(event.getCause() == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) return; BlockState oldState = event.getBlock().getState(); BlockState newState = BlockStateUtils.cloneWithMaterial(event.getBlock(), Material.FIRE); ParticipantState igniter = null; if(event.getIgnitingEntity() != null) { // The player themselves using flint & steel, or any of // several types of owned entity starting or spreading a fire. igniter = entityResolver.getOwner(event.getIgnitingEntity()); } else if(event.getIgnitingBlock() != null) { // Fire, lava, or flint & steel in a dispenser igniter = blockResolver.getOwner(event.getIgnitingBlock()); } callEvent(event, oldState, newState, igniter); }
@EventHandler public void FireSpread(BlockIgniteEvent e) { if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.BlockIgnite-FireSpread.Enable")) { if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.BlockIgnite-FireSpread.World.All_World")) { if (WorldUtils.getWFS().contains(e.getBlock().getWorld().getName())) { if (e.getCause() == IgniteCause.SPREAD) { e.setCancelled(true); } } } else { if (e.getCause() == IgniteCause.SPREAD) { e.setCancelled(true); } } } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { Player player = event.getPlayer(); if(player != null){ Block block = event.getBlock(); if(block != null && block.getRelative(BlockFace.DOWN).getType().equals(Material.NETHERRACK) && block.getRelative(BlockFace.DOWN, 2).getType().equals(Material.NETHERRACK)){ if(block.getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST).getType().equals(Material.TRAP_DOOR) || block.getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST).getType().equals(Material.TRAP_DOOR) || block.getRelative(BlockFace.DOWN).getRelative(BlockFace.SOUTH).getType().equals(Material.TRAP_DOOR) || block.getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH).getType().equals(Material.TRAP_DOOR)){ if(player.hasPermission("pmf.createfireplace")){ block.getRelative(BlockFace.DOWN).setType(Material.FIRE, false); player.sendMessage(ChatColor.GREEN + "[PMF] Fireplace has been created!"); } else { player.sendMessage(ChatColor.RED + "[PMF] You need the permission pmf.createfireplace to create a fireplace!"); } } } } }
@EventHandler public void onBlockStartBurn(BlockIgniteEvent e){ if (e.isCancelled()){ return; } Block b = e.getBlock(); Block bignit = e.getIgnitingBlock(); if ( b == null || bignit == null){ return; } RedProtect.get().logger.debug("Is BlockIgniteEvent event from global-listener"); Region r = RedProtect.get().rm.getTopRegion(b.getLocation()); if (r != null){ return; } if ((bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-spread")){ e.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGH) public void onBlockIgnite(final BlockIgniteEvent event) { if (event.isCancelled()) return; final Block block = event.getBlock(); // Ok so a frame block ignites // Find the nearest gate! final WorldCoord blockCoord = new WorldCoord(block); final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord); if (nearestGate != null) { event.setCancelled(true); } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { Block block = event.getBlock(); String world = block.getWorld().getUID().toString(); Integer x = block.getLocation().getChunk().getX(), z = block.getLocation().getChunk().getZ(); if (QuickChecks.isWorldChunkClaimed(serverdata.get("worldmap").get(world), x, z, "cla")) { String pvillage = ((HashMap) ((HashMap) serverdata.get("worldmap").get(world).get(x)).get(z)).get("cla").toString(); if (serverdata.get("villages").get(pvillage).containsKey("fire")) { if (serverdata.get("villages").get(pvillage).get("fire").equals("off")) { event.setCancelled(true); } } else if (Config.getString("Village Settings.Toggle Settings.Fire Enabled").equals("off")) { event.setCancelled(true); } } }
@EventHandler(priority = EventPriority.LOWEST) public void onBlockIgnite(BlockIgniteEvent event) { final Location location = event.getBlock().getLocation(); if (!reinforcementManager.isWorldActive(location.getWorld().getName())) { return; } // If the block is not reinforced, it is allowed to burn normally. if (!reinforcementManager.isReinforced(location)) { return; } Player player = null; if (BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL.equals(event.getCause())) { player = event.getPlayer(); } // If the block is reinforced, the burn event is cancelled for the block. event.setCancelled(true); // The block reinforcement is then damaged. reinforcementManager.damageBlock(location, player, BlockSaverDamageCause.FIRE); }
@EventHandler public void WhenFireLimitor(BlockIgniteEvent event) { if (ConfigOptimize.FireLimitorenable == true) { if (event.getCause() == IgniteCause.FLINT_AND_STEEL) { return; } Block block = event.getBlock(); if (CheckFast(block.getChunk())) { event.setCancelled(true); } else { ChunkChecked.put(block.getChunk(), System.currentTimeMillis()); } } }
/** * 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; }
@SuppressWarnings("deprecation") public boolean ignite(Player igniter, Location loc, IgniteCause cause) { Random rand = new Random(); loc.add(0.5, 0.5, 0.5); BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(), cause, (org.bukkit.entity.Entity) igniter); Bukkit.getServer().getPluginManager().callEvent(igniteEvent); if (igniteEvent.isCancelled()) { return false; } BlockState blockState = loc.getBlock().getState(); BlockPlaceEvent placeEvent = new BlockPlaceEvent(loc.getBlock(), blockState, loc.getBlock(), igniter.getItemInHand(), igniter, true); Bukkit.getServer().getPluginManager().callEvent(placeEvent); if (placeEvent.isCancelled() || !placeEvent.canBuild()) { placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false); return false; } loc.getWorld().playSound(loc, Sound.ITEM_FLINTANDSTEEL_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F); loc.getBlock().setType(Material.FIRE); return true; }
@EventHandler public void fireSpread(final BlockIgniteEvent e) { if (!cm.fireSpreadControllerEnabled) { return; } if (BlockIgniteEvent.IgniteCause.SPREAD == e.getCause()) { long now = System.currentTimeMillis(); if (now > this.lastfireSpread + cm.fireSpreadInterval) { this.lastfireSpread = now; } else { e.setCancelled(true); } } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onBlockIgnite(BlockIgniteEvent event) { Player player = event.getPlayer(); if (player == null) return; long remaining = getRemaining(player); if (remaining > 0L) { event.setCancelled(true); player.sendMessage(ChatColor.RED + "You cannot ignite blocks as your " + getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + DurationFormatter.getRemaining(remaining, true, false) + ChatColor.RED + " remaining]"); } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { //logger.info("Cause: " + event.getCause().name()); // Because we don't have any info about which player sent the fireball, disable block burning in World only (won't affect nether) if(event.getCause() == BlockIgniteEvent.IgniteCause.FIREBALL && event.getBlock().getWorld().getName().equalsIgnoreCase("World")) { event.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { BlockIgniteEvent.IgniteCause cause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL; if (event.getCause().equals(cause)) { return; } BlockState newState = this.applyState(event.getBlock(), Material.FIRE); this.post(event, event.getBlock().getState(), newState, event.getPlayer()); }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { IgniteCause ic = event.getCause(); if(ic != IgniteCause.FLINT_AND_STEEL) event.setCancelled(true); }
/** * Prevents exiled players from breaking blocks * @param e The event */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerIgnite(BlockIgniteEvent e) { if (e.getCause() == IgniteCause.FLINT_AND_STEEL) { checkAndCancelRule(ExileRule.IGNITE, e, e.getPlayer()); } }
@EventHandler(ignoreCancelled = false) public void onBlockIgnite(cn.nukkit.event.block.BlockIgniteEvent event) { if (canIgnore(BlockIgniteEvent.getHandlerList())) { return; } cn.nukkit.block.Block ignited = event.getBlock(); IgniteCause cause = IgniteCause.FLINT_AND_STEEL; switch (event.getCause()) { case EXPLOSION: cause = IgniteCause.EXPLOSION; break; case FIREBALL: cause = IgniteCause.FIREBALL; break; case FLINT_AND_STEEL: cause = IgniteCause.FLINT_AND_STEEL; break; case LAVA: cause = IgniteCause.LAVA; break; case LIGHTNING: cause = IgniteCause.LIGHTNING; break; case SPREAD: cause = IgniteCause.SPREAD; break; default: cause = IgniteCause.FLINT_AND_STEEL; // Default to Flint and Steel break; } BlockIgniteEvent bukkitEvent = new BlockIgniteEvent(PokkitBlock.toBukkit(ignited), cause, PokkitEntity.toBukkit(event.getEntity())); callCancellable(event, bukkitEvent); }
@EventHandler(priority = EventPriority.LOWEST) public void onBlockIgnite (BlockIgniteEvent igniteEvent) { if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING) { igniteEvent.setCancelled(true); } }
@EventHandler public void onBlockStartBurn(BlockIgniteEvent e){ RedProtect.get().logger.debug("RPBlockListener - Is BlockIgniteEvent event"); if (e.isCancelled()){ return; } Block b = e.getBlock(); Block bignit = e.getIgnitingBlock(); if (b == null){ return; } RedProtect.get().logger.debug("Is BlockIgniteEvent event. Canceled? " + e.isCancelled()); Region r = RedProtect.get().rm.getTopRegion(b.getLocation()); if (r != null && !r.canFire()){ if (e.getIgnitingEntity() != null){ if (e.getIgnitingEntity() instanceof Player){ Player p = (Player) e.getIgnitingEntity(); if (!r.canBuild(p)){ RPLang.sendMessage(p, "blocklistener.region.cantplace"); e.setCancelled(true); return; } } else { e.setCancelled(true); return; } } if (bignit != null && (bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA"))){ e.setCancelled(true); return; } if (e.getCause().equals(IgniteCause.LIGHTNING) || e.getCause().equals(IgniteCause.EXPLOSION) || e.getCause().equals(IgniteCause.FIREBALL)){ e.setCancelled(true); } } }
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockIgnite(BlockIgniteEvent e) { boolean cancelled = false; String w = e.getBlock().getWorld().getName(); for (String p : worlds.keySet()) { for (int i = 0; i < worlds.get(p).size(); i++) { if (worlds.get(p).get(i).equals(w)) { if (!Minigame.getMinigameInstance(p).getConfigManager().isBlockIgniteAllowed()) { e.setCancelled(true); cancelled = true; break; } } } } if (cancelled) { return; } Block adjBlock = MGUtil.getAttachedSign(e.getBlock()); if (adjBlock != null) { for (Minigame mg : Minigame.getMinigameInstances()) { for (LobbySign l : mg.getLobbyManager().signs.values()) { if (l.getX() == adjBlock.getX() && l.getY() == adjBlock.getY() && l.getZ() == adjBlock.getZ() && l.getWorld().equals(adjBlock.getWorld().getName())) { e.setCancelled(true); break; } } } } }
@EventHandler(priority = EventPriority.MONITOR) public void onBlockIgnite(BlockIgniteEvent event) { if (event.getCause() == IgniteCause.FLINT_AND_STEEL) { logAction(WorldLogAction.USE, event.getPlayer(), event.getBlock(), event.isCancelled()); } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onBlockIgnite(BlockIgniteEvent e) { for (CuboidSelection area : protectedAreas) { if (area.contains(e.getBlock().getLocation())) { e.setCancelled(true); break; } } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { if(event.getPlayer() != null) { Lot lot = this.module.getLotManager().getLot(event.getBlock().getLocation()); Town town = this.module.getLotManager().getTown(event.getBlock().getLocation()); if(((lot != null && !lot.canBuild(event.getPlayer())) || (lot == null && town != null)) && !event.getPlayer().hasPermission(LotPermissions.BUILD_ANYWHERE)) { sendMessage(event.getPlayer(), "lots.cannot-do"); event.setCancelled(true); } } else { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockIgnite(BlockIgniteEvent event) { Block block = event.getBlock(); Chunk blockChunk = block.getChunk(); if (config.getClaimed(blockChunk)) { if(!config.isTrusted(blockChunk, event.getPlayer())) { event.getPlayer().sendMessage("This chunk is claimed by: "+config.getConfig().getString(LocationHandeler.toConfigHandler(blockChunk)+".owner")+" thus you cant start fires here."); event.setCancelled(true); } } }
/** * On block ignite. * * @param event * the event */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { Player player = event.getPlayer(); checkForPvpFire(event, player); }
/** * On block ignite. * * @param event * the event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { if(checkForPutFire(event, event.getPlayer())) { event.setCancelled(true); } }
/** * On block ignite. * * @param event the event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(event.getBlock().getLocation()); if (((event.getCause() == IgniteCause.SPREAD || event.getCause() == IgniteCause.LAVA) && land.getFlagAndInherit(FlagList.FIRESPREAD.getFlagType()).getValueBoolean() == false) || land.getFlagAndInherit(FlagList.FIRE.getFlagType()).getValueBoolean() == false) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { if (event.getIgnitingEntity() == null) { return; } Location location = BukkitUtil.adapt(event.getBlock().getLocation()); PlotMapInfo pmi = manager.getMap(location); if (pmi != null) { if (pmi.isDisableIgnition()) { event.setCancelled(true); } else { Plot plot = manager.getPlot(location); if (plot == null) { event.setCancelled(true); } else { if (plot.getOwnerId().equals(event.getPlayer().getUniqueId())) { return; } Optional<Plot.AccessLevel> member = plot.isMember(event.getIgnitingEntity().getUniqueId()); if (member.isPresent()) { if (member.get().equals(Plot.AccessLevel.TRUSTED) && !api.getServerBridge().getOfflinePlayer(plot.getOwnerId()).isOnline()) { event.setCancelled(true); } else if (api.isPlotLocked(plot.getId())) { event.setCancelled(true); } } else { event.setCancelled(true); } } } } }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockIgnite(final BlockIgniteEvent event) { if (event.getCause() != IgniteCause.FLINT_AND_STEEL) { final GeneralRegion region = this.getPlugin().getDb().getPriorByLocation(event.getBlock().getLocation()); if (region != null && region.getFlag(Flag.FIRE)) { event.setCancelled(true); } } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { Block b = event.getBlock(); ArenaManager am = SimpleSurvivalGames.instance.getArenaManager(); // Capture the block for(Arena a : am.getArenas()) if(a.isArenaCuboidSet()) if(a.getArenaCuboid().isInsideCuboid(b)) if(a.getState().equals(ArenaState.PLAYING) || a.getState().equals(ArenaState.STARTING)) a.getPlayerBlockManager().addBlock(b); }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { final ProtectHolder settings = prot.getSettings(); final Block block = event.getBlock(); if (block.getType() == Material.OBSIDIAN || block.getRelative(BlockFace.DOWN).getType() == Material.OBSIDIAN) { event.setCancelled(settings.getData().getPrevent().isPortalCreation()); return; } if (event.getCause().equals(BlockIgniteEvent.IgniteCause.SPREAD)) { event.setCancelled(settings.getData().getPrevent().isFirespread()); return; } if (event.getCause().equals(BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) && event.getPlayer() != null) { event.setCancelled(Permissions.USEFLINTSTEEL.isAuthorized(event.getPlayer())); return; } if (event.getCause().equals(BlockIgniteEvent.IgniteCause.LAVA)) { event.setCancelled(settings.getData().getPrevent().isLavaFirespread()); return; } if (event.getCause().equals(BlockIgniteEvent.IgniteCause.LIGHTNING)) { event.setCancelled(settings.getData().getPrevent().isLightningFirespread()); } }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { event.setCancelled(true); }
@SuppressWarnings("deprecation") public boolean ignite(Player igniter, Location loc, IgniteCause cause) { Random rand = new Random(); loc.add(0.5, 0.5, 0.5); BlockIgniteEvent igniteEvent = new BlockIgniteEvent(loc.getBlock(), cause, (org.bukkit.entity.Entity) igniter); Bukkit.getServer().getPluginManager().callEvent(igniteEvent); if (igniteEvent.isCancelled()) { return false; } List<Location> locations = new ArrayList<Location>(); for(double x = loc.getX() - 2;x <= loc.getX() + 2;x++) { for(double y = loc.getY() - 1;y <= loc.getY() + 1;y++) { for(double z = loc.getZ() - 2;z <= loc.getZ() + 2;z++) { locations.add(new Location(loc.getWorld(),x,y,z)); } } } for(Location l : locations) { BlockIgniteEvent igniteEvent2 = new BlockIgniteEvent(l.getBlock(), cause, (org.bukkit.entity.Entity) igniter); Bukkit.getServer().getPluginManager().callEvent(igniteEvent2); if (igniteEvent2.isCancelled()) { continue; } BlockState blockState = l.getBlock().getState(); BlockPlaceEvent placeEvent = new BlockPlaceEvent(l.getBlock(), blockState, l.getBlock(), igniter.getItemInHand(), igniter, true); Bukkit.getServer().getPluginManager().callEvent(placeEvent); if (placeEvent.isCancelled() || !placeEvent.canBuild()) { continue; } if(l.getBlock() == null || l.getBlock().getType() == Material.AIR) l.getBlock().setType(Material.FIRE); } loc.getWorld().playSound(loc, Sound.ITEM_FIRECHARGE_USE, 1.0F, rand.nextFloat() * 0.4F + 0.8F); return true; }
@EventHandler public void onBlockIgnite(BlockIgniteEvent event) { forbidIfInProtectedTerritory(event.getPlayer(), event.getBlock(), event, true); }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onBlockIgnite(BlockIgniteEvent event) { if (event.getCause() == BlockIgniteEvent.IgniteCause.SPREAD) { event.setCancelled(true); } }
@EventHandler public void captureIgniteEvent(BlockIgniteEvent event) { if (!event.isCancelled()) logAndSend(getLoggableBlockEvent(BlockEventAction.IGNITE, event)); }