diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java index 6edfff3a01..082b0fdf90 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionEffectType.java @@ -84,6 +84,10 @@ public class CraftPotionEffectType extends PotionEffectType { return "CONDUIT_POWER"; case 30: return "DOLPHINS_GRACE"; + case 31: + return "BAD_OMEN"; + case 32: + return "HERO_OF_THE_VILLAGE"; default: return "UNKNOWN_EFFECT_TYPE_" + getId(); } diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java index a7e276f9ab..d310ffcc47 100644 --- a/src/test/java/org/bukkit/potion/PotionTest.java +++ b/src/test/java/org/bukkit/potion/PotionTest.java @@ -5,6 +5,7 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; import net.minecraft.server.IRegistry; +import net.minecraft.server.MinecraftKey; import net.minecraft.server.MobEffect; import net.minecraft.server.MobEffectList; import net.minecraft.server.PotionRegistry; @@ -30,4 +31,20 @@ public class PotionTest extends AbstractTestingBase { assertEquals(effects.entrySet().size(), PotionType.values().length - /* PotionTypes with no/shared Effects */ 6); } + + @Test + public void testEffectType() { + for (MobEffectList nms : IRegistry.MOB_EFFECT) { + MinecraftKey key = IRegistry.MOB_EFFECT.getKey(nms); + + int id = MobEffectList.getId(nms); + PotionEffectType bukkit = PotionEffectType.getById(id); + + assertNotNull("No Bukkit type for " + key, bukkit); + assertFalse("No name for " + key, bukkit.getName().contains("UNKNOWN")); + + PotionEffectType byName = PotionEffectType.getByName(bukkit.getName()); + assertEquals("Same type not returned by name " + key, bukkit, byName); + } + } }