Search in sources :

Example 46 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class Taunt method nametagProcessor.

private void nametagProcessor(Entity entity, List<String> list) {
    if (entity.hasMetadata(MetadataHandler.TAUNT_NAME)) {
        return;
    }
    entity.setMetadata(MetadataHandler.TAUNT_NAME, new FixedMetadataValue(plugin, true));
    String originalName = entity.getCustomName();
    int randomizedKey = random.nextInt(list.size());
    String tempName = list.get(randomizedKey);
    entity.setCustomName(chatColorConverter(tempName));
    new BukkitRunnable() {

        @Override
        public void run() {
            if (!entity.isValid()) {
                return;
            }
            if (entity.hasMetadata(MetadataHandler.CUSTOM_NAME)) {
                entity.setCustomName(originalName);
            } else {
                entity.setCustomName(NameHandler.customAggressiveName(entity));
            }
            entity.removeMetadata(MetadataHandler.TAUNT_NAME, plugin);
        }
    }.runTaskLater(plugin, 4 * 20);
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable)

Example 47 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class Taunt method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
    minorPowerPowerStance.itemEffect(entity);
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)

Example 48 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class DoubleDamage method applyPowers.

@Override
public void applyPowers(Entity entity) {
    if (!(entity instanceof IronGolem)) {
        entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
        MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
        minorPowerPowerStance.itemEffect(entity);
    }
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance) IronGolem(org.bukkit.entity.IronGolem)

Example 49 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class Invisibility method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
    MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
    minorPowerPowerStance.itemEffect(entity);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) PotionEffect(org.bukkit.potion.PotionEffect) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)

Example 50 with FixedMetadataValue

use of org.bukkit.metadata.FixedMetadataValue in project EliteMobs by MagmaGuy.

the class InvulnerabilityArrow method applyPowers.

@Override
public void applyPowers(Entity entity) {
    entity.setMetadata(powerMetadata, new FixedMetadataValue(plugin, true));
    MinorPowerPowerStance minorPowerPowerStance = new MinorPowerPowerStance();
    minorPowerPowerStance.itemEffect(entity);
}
Also used : FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) MinorPowerPowerStance(com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)

Aggregations

FixedMetadataValue (org.bukkit.metadata.FixedMetadataValue)56 MinorPowerPowerStance (com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance)22 Entity (org.bukkit.entity.Entity)10 EventHandler (org.bukkit.event.EventHandler)9 LivingEntity (org.bukkit.entity.LivingEntity)7 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)7 Player (org.bukkit.entity.Player)6 ItemStack (org.bukkit.inventory.ItemStack)6 MajorPowerPowerStance (com.magmaguy.elitemobs.powerstances.MajorPowerPowerStance)4 Item (org.bukkit.entity.Item)4 Zombie (org.bukkit.entity.Zombie)4 Vector (org.bukkit.util.Vector)4 Location (org.bukkit.Location)3 Block (org.bukkit.block.Block)3 IronGolem (org.bukkit.entity.IronGolem)3 PotionEffect (org.bukkit.potion.PotionEffect)3 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Random (java.util.Random)2