/** * Prevent fire spread * @param e */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); plugin.getLogger().info(e.getSource().getType().toString()); } if (e.getSource().getType() == Material.FIRE) { if (!Util.inWorld(e.getBlock())) { //plugin.getLogger().info("DEBUG: Not in world"); return; } if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) { return; } e.setCancelled(true); } }
@EventHandler(ignoreCancelled = false) public void onBlockSpread(cn.nukkit.event.block.BlockSpreadEvent event) { if (canIgnore(BlockSpreadEvent.getHandlerList())) { return; } cn.nukkit.block.Block spreading = event.getBlock(); cn.nukkit.block.Block newState = event.getNewState(); newState.position(spreading); newState.setLevel(spreading.level); BlockSpreadEvent bukkitEvent = new BlockSpreadEvent(PokkitBlock.toBukkit(spreading), PokkitBlock.toBukkit(newState), PokkitBlockState.getBlockState(PokkitBlock.toBukkit(newState))); callCancellable(event, bukkitEvent); }
@EventHandler(priority = EventPriority.HIGH) public void onBlockSpread(final BlockSpreadEvent event) { if (event.isCancelled()) return; final Block block = event.getBlock(); // Ok so a frame block fire spreads // Find the nearest gate! final WorldCoord blockCoord = new WorldCoord(block); final Gate nearestGate = Gates.gateFromFrameAndSurround(blockCoord); if (nearestGate != null) { event.setCancelled(true); } }
/** * Prevents LOGS from growing above the beacon * @param event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void onBlockSpread(BlockSpreadEvent event) { World world = event.getBlock().getWorld(); if (!world.equals(getBeaconzWorld())) { return; } BeaconObj beacon = getRegister().getBeaconAt(event.getBlock().getX(),event.getBlock().getZ()); if (beacon != null && beacon.getY() < event.getBlock().getY()) { switch (event.getBlock().getType()) { // Allow leaves to grow over the beacon case LEAVES: case LEAVES_2: break; default: // For everything else, make sure there is air event.getBlock().setType(Material.AIR); } } }
/** * Prevent fire spread * @param e */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); plugin.getLogger().info(e.getSource().getType().toString()); } if (e.getSource().getType() == Material.FIRE) { if (!inWorld(e.getBlock())) { //plugin.getLogger().info("DEBUG: Not in world"); return; } if (actionAllowed(e.getBlock().getLocation(), SettingsFlag.FIRE_SPREAD)) { return; } e.setCancelled(true); } }
@EventHandler public void blockSpread(BlockSpreadEvent event) { Location source = event.getSource().getLocation(); Tribe sourceGroup = TribeProtect.getBlockOwnership(source); Location spread = event.getBlock().getLocation(); Tribe spreadGroup = TribeProtect.getBlockOwnership(spread); //if spreadgroup == null, allow //if sourcegroup == null, do not allow where spreadgroup != null if (!sourceGroup.isValid()) { if (!spreadGroup.isValid()) return; else event.setCancelled(true); } else { if (!spreadGroup.isValid()) return; else { if (sourceGroup != spreadGroup) event.setCancelled(true); } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onSpread(BlockSpreadEvent event) { if (event.getNewState().getType() == FIRE) { Block oldBlock = event.getBlock(); IgniteSpread action = this.newAction(IgniteSpread.class, oldBlock.getWorld()); if (action != null) { action.setOldBlock(oldBlock.getState()); action.setNewBlock(event.getNewState()); action.setLocation(oldBlock.getLocation()); action.setSource(event.getSource().getLocation()); this.logAction(action); } } }
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent e) { Block source = e.getSource(); WorldChunk sourceChunk = CropControl.getDAO().getChunk(source.getChunk()); int sourceX = source.getX(); int sourceY = source.getY(); int sourceZ = source.getZ(); Block block = e.getBlock(); WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk()); int x = block.getX(); int y = block.getY(); int z = block.getZ(); if (!harvestableCrops.containsKey(source.getType()) && source.getType() != Material.CHORUS_FLOWER && source.getType() != Material.CHORUS_PLANT && block.getType() != Material.CHORUS_FLOWER && block.getType() != Material.CHORUS_PLANT) return; Crop sourceCrop = sourceChunk.getCrop(sourceX, sourceY, sourceZ); if (sourceCrop != null) { UUID placerUUID = sourceCrop.getPlacer(); Crop.create(chunk, x, y, z, source.getType().toString(), null, placerUUID, System.currentTimeMillis(), true); return; } TreeComponent treeComponent = sourceChunk.getTreeComponent(sourceX, sourceY, sourceZ); if (treeComponent != null) { treeComponent.setHarvestable(true); // TODO: should we differentiate between flower and plant here? TreeComponent.create(treeComponent.getTreeID(), chunk, x, y, z, Material.CHORUS_PLANT.toString(), treeComponent.getPlacer(), true); } }
@EventWrapper public void onBlockSpread(final BlockSpreadEvent event) { // This fires for: fire, grass, mycelium, mushrooms, and vines // Fire is already handled by BlockIgniteEvent if(event.getNewState().getType() != Material.FIRE) { this.callEvent(new BlockTransformEvent(event, event.getBlock().getState(), event.getNewState())); } }
@EventHandler(ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { if (!event.getNewState().getType().equals(Material.FIRE)) { this.post(event, event.getBlock().getState(), event.getNewState()); } }
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) { if (!ScriptLoader.isCurrentEvent(BlockSpreadEvent.class)) { Skript.error("You can not use Source Block expression in any event but 'on spread:' event!"); return false; } return true; }
@EventHandler(priority = EventPriority.LOWEST) public void onBlockSpread (BlockSpreadEvent spreadEvent) { if(spreadEvent.getSource().getType() != Material.FIRE) return; if(!GriefPrevention.instance.config_fireSpreads) { spreadEvent.setCancelled(true); Block underBlock = spreadEvent.getSource().getRelative(BlockFace.DOWN); if(underBlock.getType() != Material.NETHERRACK) { spreadEvent.getSource().setType(Material.AIR); } return; } //don't track in worlds where claims are not enabled if(!GriefPrevention.instance.claimsEnabledForWorld(spreadEvent.getBlock().getWorld())) return; //never spread into a claimed area, regardless of settings if(this.dataStore.getClaimAt(spreadEvent.getBlock().getLocation(), false, null) != null) { spreadEvent.setCancelled(true); //if the source of the spread is not fire on netherrack, put out that source fire to save cpu cycles Block source = spreadEvent.getSource(); if(source.getRelative(BlockFace.DOWN).getType() != Material.NETHERRACK) { source.setType(Material.AIR); } } }
@EventHandler(ignoreCancelled = true) public void onSpread(BlockSpreadEvent spread) { if (spread.getBlock() == null) { return; } Game game = BedwarsRel.getInstance().getGameManager() .getGameByLocation(spread.getBlock().getLocation()); if (game == null) { return; } if (game.getState() != GameState.RUNNING) { return; } if (spread.getNewState() == null || spread.getSource() == null) { return; } if (spread.getNewState().getType().equals(Material.FIRE)) { spread.setCancelled(true); return; } if (game.getRegion().isPlacedBlock(spread.getSource())) { game.getRegion().addPlacedBlock(spread.getBlock(), spread.getBlock().getState()); } else { game.getRegion().addPlacedUnbreakableBlock(spread.getBlock(), spread.getBlock().getState()); } }
@EventHandler public void onFireSpread(BlockSpreadEvent e){ if (e.isCancelled()){ return; } Block b = e.getSource(); Region r = RedProtect.get().rm.getTopRegion(b.getLocation()); if (r != null){ return; } if ((b.getType().equals(Material.FIRE) || b.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName()+".fire-spread")){ e.setCancelled(true); } }
@EventHandler public void onFireSpread(BlockSpreadEvent e){ RedProtect.get().logger.debug("RPBlockListener - Is BlockSpreadEvent event"); if (e.isCancelled()){ return; } Block bfrom = e.getSource(); Block bto = e.getBlock(); RedProtect.get().logger.debug("Is BlockSpreadEvent event, source is " + bfrom.getType().name()); Region rfrom = RedProtect.get().rm.getTopRegion(bfrom.getLocation()); Region rto = RedProtect.get().rm.getTopRegion(bto.getLocation()); if ((bfrom.getType().equals(Material.FIRE) || bfrom.getType().name().contains("LAVA")) && rfrom != null && !rfrom.canFire()){ e.setCancelled(true); return; } //deny blocks spread in/out regions if (rfrom != null && rto != null && rfrom != rto && !rfrom.sameLeaders(rto)){ e.setCancelled(true); return; } if (rfrom == null && rto != null){ e.setCancelled(true); return; } if (rfrom != null && rto == null){ e.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockSpread(BlockSpreadEvent e) { 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().isBlockSpreadAllowed()) { e.setCancelled(true); break; } } } } }
/** * Prevents trees from growing into this space * @param event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) public void onBlockSpread(BlockSpreadEvent event) { World world = event.getBlock().getWorld(); if (!world.equals(getBeaconzWorld())) { return; } if (event.getBlock().getY() == BLOCK_HEIGHT) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBS(final BlockSpreadEvent e) { final Block b = e.getBlock(); final Location loc = BukkitUtil.getLocation(b.getLocation()); if (PlotSquared.isPlotWorld(loc.getWorld())) { if (MainUtil.isPlotRoad(loc)) { e.setCancelled(true); } } }
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { Lot from = this.module.getLotManager().getLot(event.getSource().getLocation()); Lot to = this.module.getLotManager().getLot(event.getBlock().getLocation()); Town fromTown = this.module.getLotManager().getTown(event.getSource().getLocation()); Town toTown = this.module.getLotManager().getTown(event.getBlock().getLocation()); if((event.getBlock().getType() == Material.FIRE && (from != null || to != null || fromTown != null || toTown != null)) || (from != null && to == null) || (from == null && to != null) || from != to || (fromTown != null && toTown == null) || (fromTown == null && toTown != null) || fromTown != toTown) { event.setCancelled(true); } }
/** * On block spread. * * @param event the event */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Block blockSource = event.getSource(); IPlayerContainerPlayer pc = playerFireLocation.get(blockSource.getLocation()); if(pc != null) { // Add fire for pvp listen playerFireLocation.put(event.getBlock().getLocation(), pc); } }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Location location = BukkitUtil.adapt(event.getBlock().getLocation()); if (manager.isPlotWorld(location)) { PlotId id = manager.getPlotId(location); if (id == null) { event.setCancelled(true); } else { event.setCancelled(api.isPlotLocked(id)); } } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Block block = event.getBlock(); Location location = BukkitUtil.getLocation(block.getLocation()); if (location.isPlotRoad()) { event.setCancelled(true); return; } PlotArea area = location.getPlotArea(); if (area == null) { return; } Plot plot = area.getOwnedPlot(location); if (plot == null) { return; } switch (event.getSource().getType()) { case GRASS: if (Flags.GRASS_GROW.isFalse(plot)) { event.setCancelled(true); } break; case MYCEL: if (Flags.MYCEL_GROW.isFalse(plot)) { event.setCancelled(true); } break; case VINE: if (Flags.VINE_GROW.isFalse(plot)) { event.setCancelled(true); } break; } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onSpread(BlockSpreadEvent event) { if (event.getNewState().getType() != FIRE) { this.setAndLog(BlockSpread.class, event.getBlock().getState(), event.getNewState()); } }
@EventHandler public void firespreads(BlockSpreadEvent e) { if(e.getNewState().getType() == Material.FIRE) { e.setCancelled(true); } }
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { Block source = event.getSource(); Block to = event.getBlock(); ArenaManager am = SimpleSurvivalGames.instance.getArenaManager(); // Block spreading out and into the arena for(Arena arena : am.getArenas()) if(arena.isArenaCuboidSet()) if((arena.getArenaCuboid().isInsideCuboid(source) && !arena.getArenaCuboid().isInsideCuboid(to)) || (arena.getArenaCuboid().isInsideCuboid(to) && !arena.getArenaCuboid().isInsideCuboid(source))) event.setCancelled(true); }
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { event.setCancelled(true); }
@EventHandler(priority = EventPriority.HIGH) public void noSpread(final BlockSpreadEvent event) { event.setCancelled(true); }
@Nullable protected Block[] get(Event e) { return new Block[]{((BlockSpreadEvent)e).getSource()}; }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { RollbackAgent.checkBlockChange(event.getBlock().getLocation(), event.getBlock().getState(), event); }
public void a(World world, int i, int j, int k, Random random) { final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit if (random.nextInt(25) == 0) { byte b0 = 4; int l = 5; int i1; int j1; int k1; for (i1 = i - b0; i1 <= i + b0; ++i1) { for (j1 = k - b0; j1 <= k + b0; ++j1) { for (k1 = j - 1; k1 <= j + 1; ++k1) { if (world.getType(i1, k1, j1) == this) { --l; if (l <= 0) { return; } } } } } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; for (int l1 = 0; l1 < 4; ++l1) { if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) { i = i1; j = j1; k = k1; } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; } if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) { // CraftBukkit start org.bukkit.World bworld = world.getWorld(); BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2 BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState); world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } // CraftBukkit end } } }
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { if(event.getBlock().getType() == Material.FIRE) { event.setCancelled(true); } }
public void a(World world, int i, int j, int k, Random random) { final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot byte b0 = 4; int l = 5; int i1; int j1; int k1; for (i1 = i - b0; i1 <= i + b0; ++i1) { for (j1 = k - b0; j1 <= k + b0; ++j1) { for (k1 = j - 1; k1 <= j + 1; ++k1) { if (world.getTypeId(i1, k1, j1) == this.id) { --l; if (l <= 0) { return; } } } } } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; for (int l1 = 0; l1 < 4; ++l1) { if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) { i = i1; j = j1; k = k1; } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; } if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) { // CraftBukkit start org.bukkit.World bworld = world.getWorld(); BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); blockState.setTypeId(this.id); // nms: this.id, 0, 2 BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState); world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } // CraftBukkit end } } }
public void a(World world, int i, int j, int k, Random random) { final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot byte b0 = 4; int l = 5; int i1; int j1; int k1; for (i1 = i - b0; i1 <= i + b0; ++i1) { for (j1 = k - b0; j1 <= k + b0; ++j1) { for (k1 = j - 1; k1 <= j + 1; ++k1) { if (world.getType(i1, k1, j1) == this) { --l; if (l <= 0) { return; } } } } } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; for (int l1 = 0; l1 < 4; ++l1) { if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) { i = i1; j = j1; k = k1; } i1 = i + random.nextInt(3) - 1; j1 = j + random.nextInt(2) - random.nextInt(2); k1 = k + random.nextInt(3) - 1; } if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) { // CraftBukkit start org.bukkit.World bworld = world.getWorld(); BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2 BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState); world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } // CraftBukkit end } } }
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { final int sourceX = p_149674_2_, sourceY = p_149674_3_, sourceZ = p_149674_4_; // CraftBukkit if (p_149674_5_.nextInt(Math.max(1, (int) p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().mushroomModifier * 25)) == 0) // Spigot // Cauldron { byte b0 = 4; int l = 5; int i1; int j1; int k1; for (i1 = p_149674_2_ - b0; i1 <= p_149674_2_ + b0; ++i1) { for (j1 = p_149674_4_ - b0; j1 <= p_149674_4_ + b0; ++j1) { for (k1 = p_149674_3_ - 1; k1 <= p_149674_3_ + 1; ++k1) { if (p_149674_1_.getBlock(i1, k1, j1) == this) { --l; if (l <= 0) { return; } } } } } i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1; j1 = p_149674_3_ + p_149674_5_.nextInt(2) - p_149674_5_.nextInt(2); k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; for (int l1 = 0; l1 < 4; ++l1) { if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1)) { p_149674_2_ = i1; p_149674_3_ = j1; p_149674_4_ = k1; } i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1; j1 = p_149674_3_ + p_149674_5_.nextInt(2) - p_149674_5_.nextInt(2); k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1; } if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1)) { // CraftBukkit start org.bukkit.World bworld = p_149674_1_.getWorld(); BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); blockState.setTypeId(Block.getIdFromBlock(this)); // nms: this.id, 0, 2 BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState); p_149674_1_.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } // CraftBukkit end } } }
@EventHandler public void onBlockSpread(BlockSpreadEvent event) { if (filter.evaluate(event.getBlock(), event).equals(FilterState.DENY) && region.contains(new BlockRegion(null, event.getBlock().getLocation().toVector()))) { event.setCancelled(true); } }
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { final int sourceX = blockposition.getX(), sourceY = blockposition.getY(), sourceZ = blockposition.getZ(); // CraftBukkit if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.mushroomModifier) * 25)) == 0) { // Spigot int i = 5; boolean flag = true; Iterator iterator = BlockPosition.b(blockposition.a(-4, -1, -4), blockposition.a(4, 1, 4)).iterator(); while (iterator.hasNext()) { BlockPosition blockposition1 = (BlockPosition) iterator.next(); if (world.getType(blockposition1).getBlock() == this) { --i; if (i <= 0) { return; } } } BlockPosition blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1); for (int j = 0; j < 4; ++j) { if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) { blockposition = blockposition2; } blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1); } if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) { // CraftBukkit start // world.setTypeAndData(blockposition2, this.getBlockData(), 2); org.bukkit.World bworld = world.getWorld(); BlockState blockState = bworld.getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ()).getState(); blockState.setType(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this)); // nms: this.id, 0, 2 BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState); world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { blockState.update(true); } // CraftBukkit end } } }