Search in sources :

Example 1 with EntityEffectMessage

use of net.glowstone.net.message.play.entity.EntityEffectMessage in project Glowstone by GlowstoneMC.

the class GlowLivingEntity method addPotionEffect.

@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (potionEffects.containsKey(effect.getType())) {
        if (force) {
            removePotionEffect(effect.getType());
        } else {
            return false;
        }
    }
    potionEffects.put(effect.getType(), effect);
    potionEffectsChanged = true;
    EntityEffectMessage msg = new EntityEffectMessage(getEntityId(), effect.getType().getId(), effect.getAmplifier(), effect.getDuration(), effect.hasParticles(), effect.isAmbient());
    for (GlowPlayer player : world.getRawPlayers()) {
        if (player.canSeeEntity(this) || player == this) {
            player.getSession().send(msg);
        }
    }
    return true;
}
Also used : EntityEffectMessage(net.glowstone.net.message.play.entity.EntityEffectMessage)

Aggregations

EntityEffectMessage (net.glowstone.net.message.play.entity.EntityEffectMessage)1