/** * On block spread. * * @param event the events */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { Block blockSource = event.getSource(); ApiPlayerContainerPlayer pc = playerFireLocation.get(blockSource.getLocation()); if (pc != null) { // Add fire for pvp listen playerFireLocation.put(event.getBlock().getLocation(), pc); } }
/* * Called when a block spreads based on world conditions. */ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onBlockSpread(BlockSpreadEvent event) { ConfigurationManager cfg = plugin.getGlobalStateManager(); WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld()); if (cfg.activityHaltToggle) { event.setCancelled(true); return; } int fromType = event.getSource().getTypeId(); if (fromType == BlockID.RED_MUSHROOM || fromType == BlockID.BROWN_MUSHROOM) { if (wcfg.disableMushroomSpread) { event.setCancelled(true); return; } if (wcfg.useRegions && !plugin .getGlobalRegionManager() .allows(DefaultFlag.MUSHROOMS, event.getBlock().getLocation())) { event.setCancelled(true); return; } } if (fromType == BlockID.GRASS) { if (wcfg.disableGrassGrowth) { event.setCancelled(true); return; } if (wcfg.useRegions && !plugin .getGlobalRegionManager() .allows(DefaultFlag.GRASS_SPREAD, event.getBlock().getLocation())) { event.setCancelled(true); return; } } if (fromType == BlockID.MYCELIUM) { if (wcfg.disableMyceliumSpread) { event.setCancelled(true); return; } if (wcfg.useRegions && !plugin .getGlobalRegionManager() .allows(DefaultFlag.MYCELIUM_SPREAD, event.getBlock().getLocation())) { event.setCancelled(true); return; } } if (fromType == BlockID.VINE) { if (wcfg.disableVineGrowth) { event.setCancelled(true); return; } if (wcfg.useRegions && !plugin .getGlobalRegionManager() .allows(DefaultFlag.VINE_GROWTH, event.getBlock().getLocation())) { event.setCancelled(true); return; } } }