use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.
the class MobScanner method scanMobs.
public void scanMobs(int passiveStackAmount) {
for (World world : worldList) {
Iterator<LivingEntity> iterator = world.getLivingEntities().iterator();
while (iterator.hasNext()) {
Entity entity = iterator.next();
if (ValidAgressiveMobFilter.ValidAgressiveMobFilter(entity)) {
//scan for naturally/command/plugin spawned EliteMobs
if (entity.hasMetadata(MetadataHandler.ELITE_MOB_MD) && entity.getMetadata(MetadataHandler.ELITE_MOB_MD).get(0).asInt() != 1 && ((Damageable) entity).getMaxHealth() == DefaultMaxHealthGuesser.defaultMaxHealthGuesser(entity)) {
HealthHandler.naturalAgressiveHealthHandler(entity, entity.getMetadata(MetadataHandler.ELITE_MOB_MD).get(0).asInt());
customAggressiveName(entity);
PowerHandler.powerHandler(entity);
ArmorHandler.ArmorHandler(entity);
}
//scan for stacked EliteMobs
if (ConfigValues.defaultConfig.getBoolean("Allow aggressive EliteMobs") && ConfigValues.defaultConfig.getBoolean("Aggressive mob stacking") && !entity.hasMetadata(MetadataHandler.FORBIDDEN_MD)) {
if (!(entity.hasMetadata(MetadataHandler.ELITE_MOB_MD) && entity.getMetadata(MetadataHandler.ELITE_MOB_MD).get(0).asInt() >= ConfigValues.defaultConfig.getInt("Aggressive mob stacking cap")) && !entity.hasMetadata(MetadataHandler.FORBIDDEN_MD)) {
scanValidAggressiveLivingEntity(entity);
}
if (entity.hasMetadata(MetadataHandler.ELITE_MOB_MD)) {
PowerHandler.powerHandler(entity);
ArmorHandler.ArmorHandler(entity);
}
}
}
//scan for passive mobs
if (ConfigValues.defaultConfig.getBoolean("Allow Passive EliteMobs")) {
//scan for passive mobs that might have lost their metadata
if (ValidPassiveMobFilter.ValidPassiveMobFilter(entity) && ((LivingEntity) entity).getMaxHealth() != DefaultMaxHealthGuesser.defaultMaxHealthGuesser(entity) && ((LivingEntity) entity).getMaxHealth() == DefaultMaxHealthGuesser.defaultMaxHealthGuesser(entity) * ConfigValues.defaultConfig.getInt("Passive EliteMob stack amount")) {
customPassiveName(entity, plugin);
}
//scan for new passive supermobs
if (ValidPassiveMobFilter.ValidPassiveMobFilter(entity) && !entity.hasMetadata(MetadataHandler.PASSIVE_ELITE_MOB_MD)) {
scanValidPassiveLivingEntity(entity);
}
//spawn chicken eggs, really wish there were an event for this
ChickenHandler.superEggs(entity, passiveStackAmount);
}
//scan for iron golems with missing metadata
if (!entity.hasMetadata(MetadataHandler.ELITE_MOB_MD) && entity instanceof IronGolem && ((IronGolem) entity).getMaxHealth() != DefaultMaxHealthGuesser.defaultMaxHealthGuesser(entity)) {
entity.setMetadata(MetadataHandler.ELITE_MOB_MD, new FixedMetadataValue(plugin, ScalingFormula.reversePowerFormula(((IronGolem) entity).getMaxHealth(), DefaultMaxHealthGuesser.defaultMaxHealthGuesser(entity))));
customAggressiveName(entity);
}
}
}
}
use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.
the class AttackWeb method applyPowers.
@Override
public void applyPowers(Entity entity) {
entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
minorPowerPowerStance.itemEffect(entity);
}
use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.
the class BonusLoot method applyPowers.
@Override
public void applyPowers(Entity entity) {
entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
minorPowerPowerStance.itemEffect(entity);
}
use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.
the class InvulnerabilityFallDamage method applyPowers.
@Override
public void applyPowers(Entity entity) {
entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
minorPowerPowerStance.itemEffect(entity);
}
use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.
the class MovementSpeed method applyPowers.
@Override
public void applyPowers(Entity entity) {
entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 2));
MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
minorPowerPowerStance.itemEffect(entity);
}
Aggregations