NullPointerException on water bottles when potion blocking is enabled
LadyCailinBot opened this issue ยท 2 comments
WORLDGUARD-2281 - Reported by rtcabooservb
Build 700
java.lang.IllegalArgumentException: Water bottles don't have a level!
at org.apache.commons.lang.Validate.isTrue(Validate.java:157)
at org.bukkit.potion.Potion.(Potion.java:70)
at org.bukkit.potion.Potion.fromDamage(Potion.java:374)
at org.bukkit.potion.Potion.fromItemStack(Potion.java:389)
at com.sk89q.worldguard.bukkit.WorldGuardPlayerListener.onPlayerInteract(WorldGuardPlayerListener.java:431)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:339)
... 16 more
Comment by sk89q
This appears to be a Bukkit issue.
{code:java} public static Potion fromDamage(int damage) {
PotionType type = PotionType.getByDamageValue(damage & POTION_BIT);
Potion potion;
if (type == null || (type == PotionType.WATER && damage != 0)) {
// *** This portion of the code is not being reached ***
potion = new Potion(damage & NAME_BIT);
} else {
int level = (damage & TIER_BIT) >> TIER_SHIFT;
level++;
potion = new Potion(type, level);
}
if ((damage & SPLASH_BIT) > 0) {
potion = potion.splash();
}
if ((damage & EXTENDED_BIT) > 0) {
potion = potion.extend();
}
return potion;
}
Comment by sk89q
Worked around the bug in:
d18fe6f