/** * 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); }
private static boolean canWipe(Entity entity, boolean wipeExplosives, boolean wipeVehicles) { if (wipeExplosives) { if (Explosive.class.isAssignableFrom(entity.getClass())) { return true; } } if (wipeVehicles) { if (Boat.class.isAssignableFrom(entity.getClass())) { return true; } else if (Minecart.class.isAssignableFrom(entity.getClass())) { return true; } } Iterator<Class<? extends Entity>> it = WIPEABLES.iterator(); while (it.hasNext()) { if (it.next().isAssignableFrom(entity.getClass())) { return true; } } return false; }
public ExplosiveDamageInfo(@Nonnull Explosive explosive, @Nullable LivingEntity resolvedDamager) { super(resolvedDamager); this.explosive = Preconditions.checkNotNull(explosive); }
public @Nonnull Explosive getExplosive() { return this.explosive; }
public ExplosionPrimeEvent(final Explosive explosive) { this(explosive, explosive.getYield(), explosive.isIncendiary()); }
protected net.canarymod.api.entity.Explosive getExplosive() { if (getHandle() instanceof net.canarymod.api.entity.Explosive) { return (net.canarymod.api.entity.Explosive) getHandle(); } return null; }
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) public void onVehicleDamage (VehicleDamageEvent event) { //all of this is anti theft code if(!GriefPrevention.instance.config_claims_preventTheft) return; //don't track in worlds where claims are not enabled if(!GriefPrevention.instance.claimsEnabledForWorld(event.getVehicle().getWorld())) return; //determine which player is attacking, if any Player attacker = null; Entity damageSource = event.getAttacker(); if(damageSource.getType() == EntityType.PLAYER) { attacker = (Player)damageSource; } else if(damageSource instanceof Projectile) { Projectile arrow = (Projectile)damageSource; if(arrow.getShooter() instanceof Player) { attacker = (Player)arrow.getShooter(); } } //if not a player and not an explosion, always allow if(attacker == null && !(damageSource instanceof Explosive)) { return; } //NOTE: vehicles can be pushed around. //so unless precautions are taken by the owner, a resourceful thief might find ways to steal anyway Claim cachedClaim = null; PlayerData playerData = null; if(attacker != null) { playerData = this.dataStore.getPlayerData(attacker.getUniqueId()); cachedClaim = playerData.lastClaim; } Claim claim = this.dataStore.getClaimAt(event.getVehicle().getLocation(), false, cachedClaim); //if it's claimed if(claim != null) { //if damaged by anything other than a player, cancel the event if(attacker == null) { event.setCancelled(true); } //otherwise the player damaging the entity must have permission else { String noContainersReason = claim.allowContainers(attacker); if(noContainersReason != null) { event.setCancelled(true); String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, claim.getOwnerName()); if(attacker.hasPermission("griefprevention.ignoreclaims")) message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); GriefPrevention.sendMessage(attacker, TextMode.Err, message); event.setCancelled(true); } //cache claim for later if(playerData != null) { playerData.lastClaim = claim; } } } }
public ExplosionPrimeEvent(Explosive explosive) { }