Closed turt2live closed 9 years ago
Imagine the following piece of code (in a plugin f.e.):
LivingEntity#addPotionEffect(new PotionEffect(PoitionEffectType.HUNGER, ...));
This will call (GlowLivingEntity.java):
Map<PotionEffectType, PotionEffect> potionEffects = ...;
...
boolean addPotionEffect(PotionEffect effect) {
potionEffects.put(effect.getType(), effect);
}
and then throw the exception here (GlowLivingEntity.java):
void pulse() {
List<PotionEffect> effects = new ArrayList<>(potionEffects.values());
for (PotionEffect effect : effects) {
//effect.getType() == PoitionEffectType.HUNGER
//effect.getType() instanceof PotionEffectTypeWrapper
//ClassCastExcpetion:
GlowPotionEffect type = (GlowPotionEffect) effect.getType();
}
}
To solve this problem, addPotionEffect should be changed so it only uses GlowPotionEffect, and no PotionEffectTypeWrapper. See:
boolean addPotionEffect(PotionEffect effect) {
GlowPotionEffect type = (GlowPotionEffect) PotionEffectType.getById(effect.getType().getId());
potionEffects.put(type, effect);
}
Warning: I only spend a few minutes with looking at this bug, so this might correct, but further investigation has to be done.
Looks like the potion code in master is not complete.
Root cause: Plugin induced failure (Essentials) relating to potion effects. Valid issue for Glowstone to resolve.
General Information:
Error appears several thousand times in the log (L629) (see additional information) after a plugin-added potion effect is added to the player.
Applicable Log Segment:
Additional Information:
Testing has not been done to verify this issue is valid. If you have any information, please post it below.
Change History
/vanish
) and not VanishNoPacket