/** * Attempts to add the effect represented by this object to the given * {@link LivingEntity}. * * @see LivingEntity#addPotionEffect(PotionEffect) * @param entity The entity to add this effect to * @return Whether the effect could be added */ public boolean apply(LivingEntity entity) { return entity.addPotionEffect(this); }
/** * Gets the EntityType of the Entity involved in this event. * * @return EntityType of the Entity involved in this event */ public EntityType getEntityType() { return entity.getType(); } }
@Override public String getName() { return player.getName(); }
@Override public UUID getUniqueId() { return player.getUniqueId(); }
/** * Constructs the BlockIterator. * * @param entity Information from the entity is used to set up the trace * @param maxDistance This is the maximum distance in blocks for the * trace. Setting this value above 140 may lead to problems with * unloaded chunks. A value of 0 indicates no limit */ public BlockIterator(LivingEntity entity, int maxDistance) { this(entity.getLocation(), entity.getEyeHeight(), maxDistance); }
@Override public String getDisplayName() { return player.getDisplayName(); }
/** * Plays the sound to the given player at the given location. * * @param player Player to which to play the sound * @param location Location at which to play the sound */ public void playTo(Player player, Location location) { player.playSound(location, sound, volume, pitch); } }
@Override public String getCreatureTypeName() { return spawnedType.getName(); }
@Override public void setCreatureTypeByName(String creatureType) { EntityType type = EntityType.fromName(creatureType); if (type != null) { spawnedType = type; } }
@Override public void onEntityStep(GlowBlock block, LivingEntity entity) { entity.damage(1.0, EntityDamageEvent.DamageCause.FIRE); } }
@Override public boolean isTamed() { return entity instanceof Tameable && ((Tameable) entity).isTamed(); }
@Override public boolean isTagged() { return entity instanceof LivingEntity && entity.getCustomName() != null; }
/** * Checks if an Entity of the specified type is allowed to be a leash holder. * * @param type type of the entity which wishes to become a leash holder * @return if the type is allowed as a leash holder true, otherwise false */ public static boolean isAllowedLeashHolder(EntityType type) { return !(EntityType.ENDER_DRAGON.equals(type) || EntityType.WITHER.equals(type) || EntityType.PLAYER.equals(type) || EntityType.BAT.equals(type)); }
public ExplosionPrimeEvent(final Explosive explosive) { this(explosive, explosive.getYield(), explosive.isIncendiary()); }
public GlowEnderDragonPart(EnderDragon parent) { super(parent.getLocation()); this.parent = parent; }
@Override public void damage(double amount, Entity source, EntityDamageEvent.DamageCause cause) { parent.damage(amount, source, cause); }