Java 类org.bukkit.event.block.BlockExplodeEvent 实例源码
项目:TradeShop
文件:ShopProtectionHandler.java
@EventHandler(priority = EventPriority.HIGH)
public void onBlockExplode(BlockExplodeEvent e) {
Iterator<Block> iter = e.blockList().iterator();
while (iter.hasNext()) {
Block b = iter.next();
if (plugin.getAllowedInventories().contains(b.getType())) {
Sign s = findShopSign(b);
if (s != null && ShopType.getType(s).isProtectedFromExplosions()) {
iter.remove();
}
} else if (b.getState() instanceof Sign && findShopChest(b) != null) {
iter.remove();
}
}
}
项目:DiamondGuarantee
文件:DGEventHandler.java
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockExplode(BlockExplodeEvent event)
{
World world = event.getBlock().getWorld();
if(!DiamondGuarantee.instance.worldSettingsManager.Get(world).generateDiamonds) return;
List<Block> blocks = event.blockList();
for(int i = 0; i < blocks.size(); i++)
{
Block block = blocks.get(i);
if(block.getType() == Material.DIAMOND_ORE)
{
blocks.remove(i--);
}
}
}
项目:RedProtect
文件:RPMine18.java
@EventHandler
public void onBlockExplode(BlockExplodeEvent e){
RedProtect.get().logger.debug("Is BlockListener - BlockExplodeEvent event");
List<Block> toRemove = new ArrayList<>();
for (Block b:e.blockList()){
Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
if (!cont.canWorldBreak(b)){
toRemove.add(b);
continue;
}
if (r != null && !r.canFire()){
toRemove.add(b);
}
}
if (!toRemove.isEmpty()){
e.blockList().removeAll(toRemove);
}
}
项目:Peacecraft
文件:LotsListener.java
@EventHandler
public void onBlockExplode(BlockExplodeEvent event) {
Lot lot = this.module.getLotManager().getLot(event.getBlock().getLocation());
Town town = this.module.getLotManager().getTown(event.getBlock().getLocation());
if(lot != null || town != null) {
event.setYield(0);
event.setCancelled(true);
return;
}
for(Block block : event.blockList()) {
Lot l = this.module.getLotManager().getLot(block.getLocation());
Town t = this.module.getLotManager().getTown(block.getLocation());
if(l != null || t != null) {
event.setYield(0);
event.setCancelled(true);
break;
}
}
}
项目:Peacecraft
文件:ProtectListener.java
@EventHandler
public void onBlockExplode(BlockExplodeEvent event) {
BlockProtection blockProtection = this.module.getProtectManager().getBlockProtection(event.getBlock().getLocation());
if(blockProtection.exists()) {
event.setYield(0);
event.setCancelled(true);
return;
}
for(Block block : event.blockList()) {
BlockProtection p = this.module.getProtectManager().getBlockProtection(block.getLocation());
if(p != null) {
event.setYield(0);
event.setCancelled(true);
break;
}
}
}
项目:SavageDeathChest
文件:BlockEventListener.java
/**
* Block explode event handler<br>
* Make death chests explosion proof if chest-protection is enabled
* @param event
*/
@EventHandler
public void onBlockExplode(BlockExplodeEvent event) {
// if chest-protection is not enabled in config, do nothing and return
if (!plugin.getConfig().getBoolean("chest-protection")) {
return;
}
// iterate through all blocks in explosion event and remove those that are DeathChestBlocks
ArrayList<Block> blocks = new ArrayList<Block>(event.blockList());
for (Block block : blocks) {
if (DeathChestBlock.isDeathChestBlock(block)) {
event.blockList().remove(block);
}
}
}
项目:Transport-Pipes
文件:ContainerBlockUtils.java
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent e) {
for (Block b : e.blockList()) {
if (isIdContainerBlock(b.getTypeId())) {
updateDuctNeighborBlockSync(b, false);
}
}
}
项目:ArchersBattle
文件:WorldListener.java
@EventHandler
public void onBE(BlockExplodeEvent e) {
if (!Utils.isArenaWorld(e.getBlock().getWorld())) {
return;
}
e.setCancelled(true);
}
项目:HiddenOre
文件:ExploitListener.java
/**
* Catch explosions
*
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onExplodingThings(BlockExplodeEvent event) {
plugin.getTracking().trackBreak(event.getBlock().getLocation());
debug("Explosion event at {0}", event.getBlock().getLocation());
for (Block b : event.blockList()) {
if (b != null) {
plugin.getTracking().trackBreak(b.getLocation());
}
}
}
项目:BetterShards
文件:BetterShardsListener.java
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void bedBreakExplosion(BlockExplodeEvent event) {
if (config.get("lobby").getBool())
return;
for (Block b : event.blockList()) {
bedBreak(b);
}
}
项目:ShopChest
文件:BlockExplodeListener.java
@EventHandler
public void onBlockExplode(BlockExplodeEvent e) {
if (plugin.getShopChestConfig().explosion_protection) {
ArrayList<Block> bl = new ArrayList<>(e.blockList());
for (Block b : bl) {
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
if (plugin.getShopUtils().isShop(b.getLocation())) e.blockList().remove(b);
}
}
}
}
项目:PlotMe-Core
文件:BukkitPlotListener.java
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent event) {
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
PlotMapInfo pmi = manager.getMap(location);
if (pmi != null && pmi.isDisableExplosion()) {
event.setCancelled(true);
} else {
PlotId id = manager.getPlotId(location);
if (id == null) {
event.setCancelled(true);
}
}
}
项目:ObsidianDestroyer
文件:SpigotListener.java
@EventHandler(ignoreCancelled = true)
public void onEntityExplode(BlockExplodeEvent event) {
if (event == null || ChunkManager.getInstance().getDisabledWorlds().contains(event.getBlock().getLocation().getWorld().getName())) {
return; // do not do anything in case explosions get cancelled
}
final Block detonatorBlock = event.getBlock();
if (detonatorBlock == null) {
return;
}
if (detonatorBlock.hasMetadata("ObbyEntity")) {
return;
}
if (event.getYield() <= 0) {
return;
}
// feeling batty?! Spawn a bat to tie onto the EntityExplodeEvent.
try {
Bat bat = (Bat) Bukkit.getWorld(detonatorBlock.getWorld().getName()).spawnEntity(detonatorBlock.getLocation(), EntityType.BAT);
if (bat != null) {
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100, 1), true);
}
// Construct a new event but don't call it.
EntityExplodeEvent entityExplodeEvent = new EntityExplodeEvent(bat, event.getBlock().getLocation(), event.blockList(), event.getYield());
ChunkManager.getInstance().handleExplosion(entityExplodeEvent, event.getBlock().getLocation());
if (bat != null) {
bat.remove(); // bye
}
} catch (Exception e) {
ObsidianDestroyer.debug(e.toString());
}
}
项目:CropControl
文件:CropControlEventHandler.java
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent e) {
doMultiblockHandler(e.blockList(), BreakType.EXPLOSION, null);
}
项目:EscapeLag
文件:ExplosionController.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onExplode(BlockExplodeEvent evt) {
handleExplode(evt, evt.blockList());
}
项目:ProjectAres
文件:LongRangeExplosionMatchModule.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void blockExplode(BlockExplodeEvent event) {
render(event.getBlock().getLocation());
}
项目:KingdomFactions
文件:NexusProtectionListener.java
@EventHandler
public void onExplode(BlockExplodeEvent e) {
if (NexusModule.getInstance().containsNexus((e.blockList()))) {
e.setCancelled(true);
}
}
项目:Transport-Pipes
文件:BlockChangeListener.java
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent e) {
handleExplosionSync(e.blockList());
}
项目:ExoticGarden
文件:PlantsListener.java
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
void onBlockExplode(BlockExplodeEvent e)
{
e.blockList().removeAll(explosionHandler(e.blockList()));
}
项目:CleanShop
文件:EventListener.java
@EventHandler
public void onBlockExplodeEvent(BlockExplodeEvent event) {
Block b=event.getBlock();
if(isChest(b))
handleChestDestruction(b, null);
}
项目:StarQuestCode
文件:Explosions.java
@EventHandler
public void onBlockExplosion(BlockExplodeEvent event) {
Fireball fireball = (Fireball) event.getBlock().getWorld().spawnEntity(event.getBlock().getLocation(), EntityType.FIREBALL);
fireball.setYield(0.0f);
Bukkit.getServer().getPluginManager().callEvent(new EntityExplodeEvent(fireball, event.getBlock().getLocation(), event.blockList(), event.getYield()));
fireball.remove();
}