@EventHandler(ignoreCancelled = true) public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity() instanceof TNTPrimed) { Block block = event.getEntity().getLocation().getBlock(); if (!block.getType().equals(Material.TNT)) { return; } Player player = null; if (event instanceof ExplosionPrimeByEntityEvent) { ExplosionPrimeByEntityEvent primeByEntity = (ExplosionPrimeByEntityEvent) event; Entity entity = primeByEntity.getPrimer(); if (entity instanceof Player) { player = (Player) entity; } } this.post(event, block.getState(), this.applyAir(block), player); } }
protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isStatic) { if (movingobjectposition.entity != null) { movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F); } // CraftBukkit start - fire ExplosionPrimeEvent ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this)); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing")); } // CraftBukkit end this.die(); } }
private void ce() { if (!this.world.isStatic) { boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit start float radius = this.isPowered() ? 6.0F : 3.0F; ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); this.die(); } else { this.fuseTicks = 0; } // CraftBukkit end } }
@Override public void trigger(AlmightyNotchPlugin plugin, World world) { PluginManager pluginManager = Bukkit.getPluginManager(); for (LivingEntity entity : world.getLivingEntities()) { if (entity.getType() == EntityType.CREEPER) { Creeper creeper = (Creeper) entity; float power = creeper.isPowered() ? 6.0F : 3.0F; ExplosionPrimeEvent event = new ExplosionPrimeEvent(creeper, power, false); pluginManager.callEvent(event); if (!event.isCancelled()) { creeper.damage(creeper.getHealth()); world.createExplosion(creeper.getLocation(), power); } } } plugin.getMessenger().sendMessage(Bukkit.getServer(), getOccurMessage()); }
protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isStatic) { if (movingobjectposition.entity != null) { movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F); } // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this)); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing")); } // CraftBukkit end this.die(); } }
/** * Event handler called when an explosive is primed. * * We use it to detect impending creeper explosions. The event is fired * immediately before the explosion. */ @EventHandler(ignoreCancelled = true) public void onCreeperDetonate(ExplosionPrimeEvent event) { if (!CONFIG.isAffectedWorld(event)) { return; } if (event.getEntityType() == EntityType.CREEPER) { event.setRadius((float) CONFIG.BLAST_RADIUS_SCALE * event.getRadius()); Entity creeper = event.getEntity(); launchReinforcements(creeper); Location origin = creeper.getLocation(); World world = origin.getWorld(); Firework firework = (Firework) world.spawnEntity(origin, EntityType.FIREWORK); if (firework != null) { FireworkMeta meta = firework.getFireworkMeta(); meta.setPower(random(0, 1)); meta.addEffect(randomFireworkFffect(true)); firework.setFireworkMeta(meta); } } }
/** * On explosion prime. * * @param event the event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity() == null) { return; } Location loc = event.getEntity().getLocation(); IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(loc); EntityType entityType = event.getEntityType(); // Check for Explosion cancel if ((entityType == EntityType.CREEPER && land.getFlagAndInherit(FlagList.CREEPER_EXPLOSION.getFlagType()).getValueBoolean() == false) || ((entityType == EntityType.PRIMED_TNT || entityType == EntityType.MINECART_TNT) && land.getFlagAndInherit(FlagList.TNT_EXPLOSION.getFlagType()).getValueBoolean() == false) || land.getFlagAndInherit(FlagList.EXPLOSION.getFlagType()).getValueBoolean() == false) { event.setCancelled(true); if (entityType == EntityType.CREEPER) { event.getEntity().remove(); } } }
private void explode() { // CraftBukkit start // float f = 4.0F; org.bukkit.craftbukkit.CraftServer server = this.worldObj.getServer(); ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this)); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), true); } // CraftBukkit end }
protected void onImpact(MovingObjectPosition p_70227_1_) { if (!this.worldObj.isRemote) { if (p_70227_1_.entityHit != null) { p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F); } // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.worldObj.getServer(), this)); this.worldObj.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); } // CraftBukkit end this.setDead(); } }
private void func_146077_cc() { if (!this.worldObj.isRemote) { boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); // CraftBukkit start float radius = this.getPowered() ? 6.0F : 3.0F; ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false); this.worldObj.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), flag); this.setDead(); } else { this.timeSinceIgnited = 0; } // CraftBukkit end } }
/** * Handle ExplosionPrime events that involve modifying the event. * * @param event The event to modify */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onExplosionPrime(ExplosionPrimeEvent event) { Entity entity = event.getEntity(); if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) { return; } // We can make this assumption because we (should) be the only ones using this exact metadata Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); if (!UserManager.hasPlayerDataKey(player)) { return; } MiningManager miningManager = UserManager.getPlayer(player).getMiningManager(); if (miningManager.canUseBiggerBombs()) { event.setRadius(miningManager.biggerBombs(event.getRadius())); } }
protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isClientSide) { if (movingobjectposition.entity != null) { movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F); this.a(this.shooter, movingobjectposition.entity); } boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit start - fire ExplosionPrimeEvent ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this)); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); } // CraftBukkit end this.die(); } }
private void dg() { if (!this.world.isClientSide) { boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); float f = this.isPowered() ? 2.0F : 1.0F; // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { this.aU = true; this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); this.die(); } else { fuseTicks = 0; } // CraftBukkit end } }
protected void a(MovingObjectPosition movingobjectposition) { if (!this.world.isStatic) { if (movingobjectposition.entity != null) { movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6); } // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this)); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing")); } // CraftBukkit end this.die(); } }
@EventHandler public void WitherExplode(ExplosionPrimeEvent event){ EntityType eType; try{ eType = event.getEntityType(); }catch(Exception e){ eType = null; } if(eType != null){ if (eType == EntityType.WITHER) { if (plugin.isBlockWitherExplosion()) { event.setCancelled(true); return; } } else if (eType == EntityType.WITHER_SKULL) { if (plugin.isBlockWitherExplosion()) { event.setCancelled(true); return; } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onTNTIgnite(ExplosionPrimeEvent event) { if(!this.tracker.isEnabled(event.getEntity().getWorld())) return; if(event.getEntity() instanceof TNTPrimed) { TNTPrimed tnt = (TNTPrimed) event.getEntity(); Block block = event.getEntity().getWorld().getBlockAt(event.getEntity().getLocation()); if(block != null) { Player placer = this.tracker.setPlacer(block, null); if(placer != null) { this.tracker.setOwner(tnt, placer); } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void setCustomProperties(ExplosionPrimeEvent event) { if(event.getEntity() instanceof TNTPrimed) { TNTPrimed tnt = (TNTPrimed) event.getEntity(); if(this.properties.fuse != null) { tnt.setFuseTicks(this.getFuseTicks()); } if(this.properties.power != null) { tnt.setYield(this.properties.power); // Note: not related to EntityExplodeEvent.yield } } }
@EventWrapper public void onPrimeTNT(ExplosionPrimeEvent event) { if(event.getEntity() instanceof TNTPrimed && !(event instanceof InstantTNTPlaceEvent)) { Block block = event.getEntity().getLocation().getBlock(); if(block.getType() == Material.TNT) { ParticipantState player; if(event instanceof ExplosionPrimeByEntityEvent) { player = entityResolver.getOwner(((ExplosionPrimeByEntityEvent) event).getPrimer()); } else { player = null; } callEvent(event, block.getState(), BlockStateUtils.toAir(block), player); } } }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPrime(ExplosionPrimeEvent event) { if(event.getEntity() instanceof TNTPrimed) { // Some TNT was activated, try to figure out why TNTPrimed tnt = (TNTPrimed) event.getEntity(); TNTInfo info = null; if(event instanceof ExplosionPrimeByEntityEvent) { Entity primer = ((ExplosionPrimeByEntityEvent) event).getPrimer(); if(primer instanceof TNTPrimed) { // Primed by another owned explosive, propagate the damage info (e.g. origin location) info = resolveEntity(primer); } else { ParticipantState owner = entities().getOwner(primer); if(owner != null) { // Primed by some other type of owned entity e.g. flaming arrow, pet creeper, etc. info = new TNTInfo(owner, tnt.getLocation()); } } } if(info == null) { ParticipantState placer = blocks().getOwner(tnt.getLocation().getBlock()); if(placer != null) { // If no primer was resolved for the event, give the TNT entity to the block placer, if any info = new TNTInfo(placer, tnt.getLocation()); } } if(info != null) { entities().trackEntity(tnt, info); } } }
@EventHandler public void onExplode(ExplosionPrimeEvent e) { if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Explosion.Enable")) { if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Explosion.World.All_World")) { if (WorldUtils.getWE().contains(e.getEntity().getWorld().getName())) { e.setCancelled(true); } } else { e.setCancelled(true); } } }
@EventHandler public void onExplosionPrime(ExplosionPrimeEvent event) { event.setFire(false); if (event.getEntity() instanceof Fireball && event.getEntity().hasMetadata("ultimate")){ event.setRadius(0); } }
@EventHandler public void onExplode(ExplosionPrimeEvent event) { if (event.getEntity().getType()==(EntityType.PRIMED_TNT)) { event.setCancelled(true); } else if (event.getEntity().getType()==(EntityType.CREEPER)) { //なんもしねー } }
@EventHandler public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity().getType() == EntityType.PRIMED_TNT) { TNTPrimed tnt = (TNTPrimed) event.getEntity(); Location location = event.getEntity().getLocation(); if (tntPlaced.containsKey(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ())) { UUID playerUUID = tntPlaced.get(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ()); event.getEntity().setMetadata("source", new FixedMetadataValue(GamePlate.getInstance(), playerUUID)); tntPlaced.remove(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ()); } } }
@EventHandler(ignoreCancelled = false) public void onExplosion(cn.nukkit.event.entity.ExplosionPrimeEvent event) { if (canIgnore(PlayerInteractEvent.getHandlerList())) { return; } ExplosionPrimeEvent bukkitEvent = new ExplosionPrimeEvent(PokkitEntity.toBukkit(event.getEntity()), (float) event.getForce(), true); // Always true because Nukkit doesn't have that boolean callCancellable(event, bukkitEvent); }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity() != null && event.getEntityType() == EntityType.CREEPER) { World world = event.getEntity().getWorld(); PluginConfig worldConfig = plugin.getConfig(world); if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.SUPER_CREEPERS)) { event.setRadius((float) worldConfig.getDouble(Config.FEATURE_SUPER_CREEPERS_POWER)); event.setFire(worldConfig.getBoolean(Config.FEATURE_SUPER_CREEPERS_FIRE)); } } }
@EventHandler public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity().getType() == EntityType.PRIMED_TNT) { Location location = event.getEntity().getLocation(); if (tntPlaced.containsKey(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ())) { UUID player = tntPlaced.get(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ()); event.getEntity().setMetadata("source", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), player)); tntPlaced.remove(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ()); } } }
@EventHandler public void onBlockPlace(BlockPlaceEvent event) { Block block = event.getBlock(); if (block.getType().equals(Material.TNT) && instantIgnite) { event.setCancelled(true); ItemStack tntStack = event.getPlayer().getItemInHand(); tntStack.setAmount(tntStack.getAmount() - 1); event.getPlayer().setItemInHand(tntStack); TNTPrimed tnt = (TNTPrimed) GameHandler.getGameHandler().getMatchWorld().spawnEntity(block.getLocation().add(new Vector(0.5, 0.5, 0.5)), EntityType.PRIMED_TNT); tnt.setYield((float) power); Bukkit.getServer().getPluginManager().callEvent(new ExplosionPrimeEvent(tnt, (float) power * 10, false)); } }
@EventHandler public void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getEntity() instanceof TNTPrimed) { if (fuse != 4) { ((TNTPrimed) event.getEntity()).setFuseTicks(fuse * 20); } if (power != 4.0) { event.setRadius((float) power * 10); } } }
private void explode() { // CraftBukkit start // float f = 4.0F; org.bukkit.craftbukkit.CraftServer server = this.world.getServer(); ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this)); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { // give 'this' instead of (Entity) null so we know what causes the damage this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true); } // CraftBukkit end }
public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable()) { return false; } else { if (!this.dead && !this.world.isStatic) { // CraftBukkit start - All non-living entities need this if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) { return false; } // CraftBukkit end this.b = 0; if (this.b <= 0) { this.die(); if (!this.world.isStatic) { // CraftBukkit start ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false); this.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { this.dead = false; return false; } this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true); // CraftBukkit end } } } return true; } }
/** * Method added becouse of visibility of the original. */ private void explode() { CraftServer server = this.world.getServer(); ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this)); server.getPluginManager().callEvent(event); if (event.isCancelled()) return; this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true); }
@EventHandler public void onCreeperExplode(ExplosionPrimeEvent event) { if (!creeperEnabled || !plugin.isSkyWorld(event.getEntity().getWorld())) { return; } if (event.getEntity() instanceof Creeper && !isValidTarget(((Creeper)event.getEntity()).getTarget())) { event.setCancelled(true); } else if (event.getEntity() instanceof TNTPrimed && !isValidTarget(((TNTPrimed) event.getEntity()).getSource())) { event.setCancelled(true); } }
public void l_() { if (this.isAlive()) { this.bp = this.fuseTicks; int i = this.bV(); if (i > 0 && this.fuseTicks == 0) { this.makeSound("random.fuse", 1.0F, 0.5F); } this.fuseTicks += i; if (this.fuseTicks < 0) { this.fuseTicks = 0; } if (this.fuseTicks >= this.maxFuseTicks) { this.fuseTicks = this.maxFuseTicks; if (!this.world.isStatic) { boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit start float radius = this.isPowered() ? 6.0F : 3.0F; ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false); this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); this.die(); } else { this.fuseTicks = 0; } // CraftBukkit end } } } super.l_(); }
@EventHandler public void onExplosion(ExplosionPrimeEvent event){ int id = GameManager.getInstance().getBlockGameId(event.getEntity().getLocation()); if(id != -1){ event.setCancelled(true); } }
@EventHandler public void onTNTExpload(ExplosionPrimeEvent event){ org.bukkit.entity.Entity entity = event.getEntity(); if (entity instanceof TNTPrimed && !Rixor.getRotation().getSlot().getMap().getTntsettings().isBlockDamage()) { event.setCancelled(true); Location explosion = event.getEntity().getLocation(); Rixor.getMap().getWorld().createExplosion(explosion.getX(), explosion.getY(), explosion.getZ(), 2F, false, false); Rixor.getMap().getWorld().playSound(event.getEntity().getLocation(),Sound.EXPLODE,-4,12); } }