diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java index 6126c0a915..b7341d66ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java @@ -14,47 +14,47 @@ import org.bukkit.potion.PotionData; public class CraftPotionUtil { private static final BiMap regular = ImmutableBiMap.builder() - .put(PotionType.UNCRAFTABLE, "minecraft:empty") - .put(PotionType.WATER, "minecraft:water") - .put(PotionType.MUNDANE, "minecraft:mundane") - .put(PotionType.THICK, "minecraft:thick") - .put(PotionType.AWKWARD, "minecraft:awkward") - .put(PotionType.NIGHT_VISION, "minecraft:night_vision") - .put(PotionType.INVISIBILITY, "minecraft:invisibility") - .put(PotionType.JUMP, "minecraft:leaping") - .put(PotionType.FIRE_RESISTANCE, "minecraft:fire_resistance") - .put(PotionType.SPEED, "minecraft:swiftness") - .put(PotionType.SLOWNESS, "minecraft:slowness") - .put(PotionType.WATER_BREATHING, "minecraft:water_breathing") - .put(PotionType.INSTANT_HEAL, "minecraft:healing") - .put(PotionType.INSTANT_DAMAGE, "minecraft:harming") - .put(PotionType.POISON, "minecraft:poison") - .put(PotionType.REGEN, "minecraft:regeneration") - .put(PotionType.STRENGTH, "minecraft:strength") - .put(PotionType.WEAKNESS, "minecraft:weakness") - .put(PotionType.LUCK, "minecraft:luck") + .put(PotionType.UNCRAFTABLE, "empty") + .put(PotionType.WATER, "water") + .put(PotionType.MUNDANE, "mundane") + .put(PotionType.THICK, "thick") + .put(PotionType.AWKWARD, "awkward") + .put(PotionType.NIGHT_VISION, "night_vision") + .put(PotionType.INVISIBILITY, "invisibility") + .put(PotionType.JUMP, "leaping") + .put(PotionType.FIRE_RESISTANCE, "fire_resistance") + .put(PotionType.SPEED, "swiftness") + .put(PotionType.SLOWNESS, "slowness") + .put(PotionType.WATER_BREATHING, "water_breathing") + .put(PotionType.INSTANT_HEAL, "healing") + .put(PotionType.INSTANT_DAMAGE, "harming") + .put(PotionType.POISON, "poison") + .put(PotionType.REGEN, "regeneration") + .put(PotionType.STRENGTH, "strength") + .put(PotionType.WEAKNESS, "weakness") + .put(PotionType.LUCK, "luck") .build(); private static final BiMap upgradeable = ImmutableBiMap.builder() - .put(PotionType.JUMP, "minecraft:strong_leaping") - .put(PotionType.SPEED, "minecraft:strong_swiftness") - .put(PotionType.INSTANT_HEAL, "minecraft:strong_healing") - .put(PotionType.INSTANT_DAMAGE, "minecraft:strong_harming") - .put(PotionType.POISON, "minecraft:strong_poison") - .put(PotionType.REGEN, "minecraft:strong_regeneration") - .put(PotionType.STRENGTH, "minecraft:strong_strength") + .put(PotionType.JUMP, "strong_leaping") + .put(PotionType.SPEED, "strong_swiftness") + .put(PotionType.INSTANT_HEAL, "strong_healing") + .put(PotionType.INSTANT_DAMAGE, "strong_harming") + .put(PotionType.POISON, "strong_poison") + .put(PotionType.REGEN, "strong_regeneration") + .put(PotionType.STRENGTH, "strong_strength") .build(); private static final BiMap extendable = ImmutableBiMap.builder() - .put(PotionType.NIGHT_VISION, "minecraft:long_night_vision") - .put(PotionType.INVISIBILITY, "minecraft:long_invisibility") - .put(PotionType.JUMP, "minecraft:long_leaping") - .put(PotionType.FIRE_RESISTANCE, "minecraft:long_fire_resistance") - .put(PotionType.SPEED, "minecraft:long_swiftness") - .put(PotionType.SLOWNESS, "minecraft:long_slowness") - .put(PotionType.WATER_BREATHING, "minecraft:long_water_breathing") - .put(PotionType.POISON, "minecraft:long_poison") - .put(PotionType.REGEN, "minecraft:long_regeneration") - .put(PotionType.STRENGTH, "minecraft:long_strength") - .put(PotionType.WEAKNESS, "minecraft:long_weakness") + .put(PotionType.NIGHT_VISION, "long_night_vision") + .put(PotionType.INVISIBILITY, "long_invisibility") + .put(PotionType.JUMP, "long_leaping") + .put(PotionType.FIRE_RESISTANCE, "long_fire_resistance") + .put(PotionType.SPEED, "long_swiftness") + .put(PotionType.SLOWNESS, "long_slowness") + .put(PotionType.WATER_BREATHING, "long_water_breathing") + .put(PotionType.POISON, "long_poison") + .put(PotionType.REGEN, "long_regeneration") + .put(PotionType.STRENGTH, "long_strength") + .put(PotionType.WEAKNESS, "long_weakness") .build(); public static String fromBukkit(PotionData data) { @@ -68,6 +68,9 @@ public class CraftPotionUtil { } public static PotionData toBukkit(String type) { + if (type.startsWith("minecraft:")) { + type = type.substring(10); + } PotionType potionType = null; potionType = extendable.inverse().get(type); if (potionType != null) { @@ -77,7 +80,11 @@ public class CraftPotionUtil { if (potionType != null) { return new PotionData(potionType, false, true); } - return new PotionData(regular.inverse().get(type), false, false); + potionType = regular.inverse().get(type); + if (potionType != null) { + return new PotionData(potionType, false, true); + } + return new PotionData(PotionType.UNCRAFTABLE, false, false); } public static MobEffect fromBukkit(PotionEffect effect) {