From d9a704e3f60442496d282e1885f4b34fba9ecca4 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 24 Apr 2024 01:15:00 +1000 Subject: [PATCH] SPIGOT-5336: Field name parity with Minecraft keys By: DerFrZocker --- .../main/java/org/bukkit/MusicInstrument.java | 16 ++-- .../src/main/java/org/bukkit/Particle.java | 64 ++++++------- .../org/bukkit/block/banner/PatternType.java | 16 ++-- .../org/bukkit/enchantments/Enchantment.java | 90 ++++--------------- .../java/org/bukkit/entity/EntityType.java | 51 ++++------- .../org/bukkit/potion/PotionEffectType.java | 48 ++-------- .../java/org/bukkit/potion/PotionType.java | 10 +-- 7 files changed, 96 insertions(+), 199 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/MusicInstrument.java b/paper-api/src/main/java/org/bukkit/MusicInstrument.java index a7573ce8c6..eae90e72b1 100644 --- a/paper-api/src/main/java/org/bukkit/MusicInstrument.java +++ b/paper-api/src/main/java/org/bukkit/MusicInstrument.java @@ -9,14 +9,14 @@ import org.jetbrains.annotations.Nullable; public abstract class MusicInstrument implements Keyed { - public static final MusicInstrument PONDER = getInstrument("ponder_goat_horn"); - public static final MusicInstrument SING = getInstrument("sing_goat_horn"); - public static final MusicInstrument SEEK = getInstrument("seek_goat_horn"); - public static final MusicInstrument FEEL = getInstrument("feel_goat_horn"); - public static final MusicInstrument ADMIRE = getInstrument("admire_goat_horn"); - public static final MusicInstrument CALL = getInstrument("call_goat_horn"); - public static final MusicInstrument YEARN = getInstrument("yearn_goat_horn"); - public static final MusicInstrument DREAM = getInstrument("dream_goat_horn"); + public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn"); + public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn"); + public static final MusicInstrument SEEK_GOAT_HORN = getInstrument("seek_goat_horn"); + public static final MusicInstrument FEEL_GOAT_HORN = getInstrument("feel_goat_horn"); + public static final MusicInstrument ADMIRE_GOAT_HORN = getInstrument("admire_goat_horn"); + public static final MusicInstrument CALL_GOAT_HORN = getInstrument("call_goat_horn"); + public static final MusicInstrument YEARN_GOAT_HORN = getInstrument("yearn_goat_horn"); + public static final MusicInstrument DREAM_GOAT_HORN = getInstrument("dream_goat_horn"); /** * Returns a {@link MusicInstrument} by a {@link NamespacedKey}. diff --git a/paper-api/src/main/java/org/bukkit/Particle.java b/paper-api/src/main/java/org/bukkit/Particle.java index d547a258f5..698ffe0c76 100644 --- a/paper-api/src/main/java/org/bukkit/Particle.java +++ b/paper-api/src/main/java/org/bukkit/Particle.java @@ -6,59 +6,53 @@ import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; public enum Particle implements Keyed { - EXPLOSION_NORMAL("poof"), - EXPLOSION_LARGE("explosion"), - EXPLOSION_HUGE("explosion_emitter"), - FIREWORKS_SPARK("firework"), - WATER_BUBBLE("bubble"), - WATER_SPLASH("splash"), - WATER_WAKE("fishing"), - SUSPENDED("underwater"), - SUSPENDED_DEPTH("underwater", false), + POOF("poof"), + EXPLOSION("explosion"), + EXPLOSION_EMITTER("explosion_emitter"), + FIREWORK("firework"), + BUBBLE("bubble"), + SPLASH("splash"), + FISHING("fishing"), + UNDERWATER("underwater"), CRIT("crit"), - CRIT_MAGIC("enchanted_hit"), - SMOKE_NORMAL("smoke"), - SMOKE_LARGE("large_smoke"), - SPELL("effect"), - SPELL_INSTANT("instant_effect"), + ENCHANTED_HIT("enchanted_hit"), + SMOKE("smoke"), + LARGE_SMOKE("large_smoke"), + EFFECT("effect"), + INSTANT_EFFECT("instant_effect"), /** * Uses {@link Color} as DataType */ - SPELL_MOB("entity_effect", Color.class), - SPELL_WITCH("witch"), - DRIP_WATER("dripping_water"), - DRIP_LAVA("dripping_lava"), - VILLAGER_ANGRY("angry_villager"), - VILLAGER_HAPPY("happy_villager"), - TOWN_AURA("mycelium"), + ENTITY_EFFECT("entity_effect", Color.class), + WITCH("witch"), + DRIPPING_WATER("dripping_water"), + DRIPPING_LAVA("dripping_lava"), + ANGRY_VILLAGER("angry_villager"), + HAPPY_VILLAGER("happy_villager"), + MYCELIUM("mycelium"), NOTE("note"), PORTAL("portal"), - ENCHANTMENT_TABLE("enchant"), + ENCHANT("enchant"), FLAME("flame"), LAVA("lava"), CLOUD("cloud"), /** * Uses {@link Particle.DustOptions} as DataType */ - REDSTONE("dust", DustOptions.class), - SNOWBALL("item_snowball"), - SNOW_SHOVEL("item_snowball", false), - SLIME("item_slime"), + DUST("dust", DustOptions.class), + ITEM_SNOWBALL("item_snowball"), + ITEM_SLIME("item_slime"), HEART("heart"), /** * Uses {@link ItemStack} as DataType */ - ITEM_CRACK("item", ItemStack.class), + ITEM("item", ItemStack.class), /** * Uses {@link BlockData} as DataType */ - BLOCK_CRACK("block", BlockData.class), - /** - * Uses {@link BlockData} as DataType - */ - BLOCK_DUST("block", BlockData.class, false), - WATER_DROP("rain"), - MOB_APPEARANCE("elder_guardian"), + BLOCK("block", BlockData.class), + RAIN("rain"), + ELDER_GUARDIAN("elder_guardian"), DRAGON_BREATH("dragon_breath"), END_ROD("end_rod"), DAMAGE_INDICATOR("damage_indicator"), @@ -67,7 +61,7 @@ public enum Particle implements Keyed { * Uses {@link BlockData} as DataType */ FALLING_DUST("falling_dust", BlockData.class), - TOTEM("totem_of_undying"), + TOTEM_OF_UNDYING("totem_of_undying"), SPIT("spit"), SQUID_INK("squid_ink"), BUBBLE_POP("bubble_pop"), diff --git a/paper-api/src/main/java/org/bukkit/block/banner/PatternType.java b/paper-api/src/main/java/org/bukkit/block/banner/PatternType.java index a5457f6404..0d250d0c13 100644 --- a/paper-api/src/main/java/org/bukkit/block/banner/PatternType.java +++ b/paper-api/src/main/java/org/bukkit/block/banner/PatternType.java @@ -24,7 +24,7 @@ public enum PatternType implements Keyed { STRIPE_MIDDLE("ms", "stripe_middle"), STRIPE_DOWNRIGHT("drs", "stripe_downright"), STRIPE_DOWNLEFT("dls", "stripe_downleft"), - STRIPE_SMALL("ss", "small_stripes"), + SMALL_STRIPES("ss", "small_stripes"), CROSS("cr", "cross"), STRAIGHT_CROSS("sc", "straight_cross"), TRIANGLE_BOTTOM("bt", "triangle_bottom"), @@ -32,15 +32,15 @@ public enum PatternType implements Keyed { TRIANGLES_BOTTOM("bts", "triangles_bottom"), TRIANGLES_TOP("tts", "triangles_top"), DIAGONAL_LEFT("ld", "diagonal_left"), - DIAGONAL_RIGHT("rd", "diagonal_up_right"), //PAIL - Why are these keys swapped? - DIAGONAL_LEFT_MIRROR("lud", "diagonal_up_left"), - DIAGONAL_RIGHT_MIRROR("rud", "diagonal_right"), //PAIL - Why are these keys swapped? - CIRCLE_MIDDLE("mc", "circle"), - RHOMBUS_MIDDLE("mr", "rhombus"), + DIAGONAL_UP_RIGHT("rd", "diagonal_up_right"), + DIAGONAL_UP_LEFT("lud", "diagonal_up_left"), + DIAGONAL_RIGHT("rud", "diagonal_right"), + CIRCLE("mc", "circle"), + RHOMBUS("mr", "rhombus"), HALF_VERTICAL("vh", "half_vertical"), HALF_HORIZONTAL("hh", "half_horizontal"), - HALF_VERTICAL_MIRROR("vhr", "half_vertical_right"), - HALF_HORIZONTAL_MIRROR("hhb", "half_horizontal_bottom"), + HALF_VERTICAL_RIGHT("vhr", "half_vertical_right"), + HALF_HORIZONTAL_BOTTOM("hhb", "half_horizontal_bottom"), BORDER("bo", "border"), CURLY_BORDER("cbo", "curly_border"), CREEPER("cre", "creeper"), diff --git a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java index 70e13bf748..f9965740ff 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -19,37 +19,37 @@ public abstract class Enchantment implements Keyed, Translatable { /** * Provides protection against environmental damage */ - public static final Enchantment PROTECTION_ENVIRONMENTAL = getEnchantment("protection"); + public static final Enchantment PROTECTION = getEnchantment("protection"); /** * Provides protection against fire damage */ - public static final Enchantment PROTECTION_FIRE = getEnchantment("fire_protection"); + public static final Enchantment FIRE_PROTECTION = getEnchantment("fire_protection"); /** * Provides protection against fall damage */ - public static final Enchantment PROTECTION_FALL = getEnchantment("feather_falling"); + public static final Enchantment FEATHER_FALLING = getEnchantment("feather_falling"); /** * Provides protection against explosive damage */ - public static final Enchantment PROTECTION_EXPLOSIONS = getEnchantment("blast_protection"); + public static final Enchantment BLAST_PROTECTION = getEnchantment("blast_protection"); /** * Provides protection against projectile damage */ - public static final Enchantment PROTECTION_PROJECTILE = getEnchantment("projectile_protection"); + public static final Enchantment PROJECTILE_PROTECTION = getEnchantment("projectile_protection"); /** * Decreases the rate of air loss whilst underwater */ - public static final Enchantment OXYGEN = getEnchantment("respiration"); + public static final Enchantment RESPIRATION = getEnchantment("respiration"); /** * Increases the speed at which a player may mine underwater */ - public static final Enchantment WATER_WORKER = getEnchantment("aqua_affinity"); + public static final Enchantment AQUA_AFFINITY = getEnchantment("aqua_affinity"); /** * Damages the attacker @@ -74,17 +74,17 @@ public abstract class Enchantment implements Keyed, Translatable { /** * Increases damage against all targets */ - public static final Enchantment DAMAGE_ALL = getEnchantment("sharpness"); + public static final Enchantment SHARPNESS = getEnchantment("sharpness"); /** * Increases damage against undead targets */ - public static final Enchantment DAMAGE_UNDEAD = getEnchantment("smite"); + public static final Enchantment SMITE = getEnchantment("smite"); /** * Increases damage against arthropod targets */ - public static final Enchantment DAMAGE_ARTHROPODS = getEnchantment("bane_of_arthropods"); + public static final Enchantment BANE_OF_ARTHROPODS = getEnchantment("bane_of_arthropods"); /** * All damage to other targets will knock them back when hit @@ -99,7 +99,7 @@ public abstract class Enchantment implements Keyed, Translatable { /** * Provides a chance of gaining extra loot when killing monsters */ - public static final Enchantment LOOT_BONUS_MOBS = getEnchantment("looting"); + public static final Enchantment LOOTING = getEnchantment("looting"); /** * Increases damage against targets when using a sweep attack @@ -109,7 +109,7 @@ public abstract class Enchantment implements Keyed, Translatable { /** * Increases the rate at which you mine/dig */ - public static final Enchantment DIG_SPEED = getEnchantment("efficiency"); + public static final Enchantment EFFICIENCY = getEnchantment("efficiency"); /** * Allows blocks to drop themselves instead of fragments (for example, @@ -120,37 +120,37 @@ public abstract class Enchantment implements Keyed, Translatable { /** * Decreases the rate at which a tool looses durability */ - public static final Enchantment DURABILITY = getEnchantment("unbreaking"); + public static final Enchantment UNBREAKING = getEnchantment("unbreaking"); /** * Provides a chance of gaining extra loot when destroying blocks */ - public static final Enchantment LOOT_BONUS_BLOCKS = getEnchantment("fortune"); + public static final Enchantment FORTUNE = getEnchantment("fortune"); /** * Provides extra damage when shooting arrows from bows */ - public static final Enchantment ARROW_DAMAGE = getEnchantment("power"); + public static final Enchantment POWER = getEnchantment("power"); /** * Provides a knockback when an entity is hit by an arrow from a bow */ - public static final Enchantment ARROW_KNOCKBACK = getEnchantment("punch"); + public static final Enchantment PUNCH = getEnchantment("punch"); /** * Sets entities on fire when hit by arrows shot from a bow */ - public static final Enchantment ARROW_FIRE = getEnchantment("flame"); + public static final Enchantment FLAME = getEnchantment("flame"); /** * Provides infinite arrows when shooting a bow */ - public static final Enchantment ARROW_INFINITE = getEnchantment("infinity"); + public static final Enchantment INFINITY = getEnchantment("infinity"); /** * Decreases odds of catching worthless junk */ - public static final Enchantment LUCK = getEnchantment("luck_of_the_sea"); + public static final Enchantment LUCK_OF_THE_SEA = getEnchantment("luck_of_the_sea"); /** * Increases rate of fish biting your hook @@ -350,7 +350,6 @@ public abstract class Enchantment implements Keyed, Translatable { return null; } - name = convertLegacy(name); return getByKey(NamespacedKey.fromString(name.toLowerCase())); } @@ -365,55 +364,4 @@ public abstract class Enchantment implements Keyed, Translatable { public static Enchantment[] values() { return Lists.newArrayList(Registry.ENCHANTMENT).toArray(new Enchantment[0]); } - - private static String convertLegacy(String from) { - if (from == null) { - return null; - } - - switch (from.toLowerCase()) { - case "protection_environmental": - return "protection"; - case "protection_fire": - return "fire_protection"; - case "protection_fall": - return "feather_falling"; - case "protection_explosions": - return "blast_protection"; - case "protection_projectile": - return "projectile_protection"; - case "oxygen": - return "respiration"; - case "water_worker": - return "aqua_affinity"; - case "damage_all": - return "sharpness"; - case "damage_undead": - return "smite"; - case "damage_arthropods": - return "bane_of_arthropods"; - case "loot_bonus_mobs": - return "looting"; - case "sweeping": - return "sweeping_edge"; - case "dig_speed": - return "efficiency"; - case "durability": - return "unbreaking"; - case "loot_bonus_blocks": - return "fortune"; - case "arrow_damage": - return "power"; - case "arrow_knockback": - return "punch"; - case "arrow_fire": - return "flame"; - case "arrow_infinite": - return "infinity"; - case "luck": - return "luck_of_the_sea"; - } - - return from; - } } diff --git a/paper-api/src/main/java/org/bukkit/entity/EntityType.java b/paper-api/src/main/java/org/bukkit/entity/EntityType.java index 2ed972573f..b975f11d34 100644 --- a/paper-api/src/main/java/org/bukkit/entity/EntityType.java +++ b/paper-api/src/main/java/org/bukkit/entity/EntityType.java @@ -33,7 +33,7 @@ public enum EntityType implements Keyed, Translatable { * Spawn with {@link World#dropItem(Location, ItemStack)} or {@link * World#dropItemNaturally(Location, ItemStack)} */ - DROPPED_ITEM("item", Item.class, 1, false), + ITEM("item", Item.class, 1, false), /** * An experience orb. */ @@ -61,7 +61,7 @@ public enum EntityType implements Keyed, Translatable { /** * A leash attached to a fencepost. */ - LEASH_HITCH("leash_knot", LeashHitch.class, 8), + LEASH_KNOT("leash_knot", LeashHitch.class, 8), /** * A painting on a wall. */ @@ -89,15 +89,15 @@ public enum EntityType implements Keyed, Translatable { /** * An ender eye signal. */ - ENDER_SIGNAL("eye_of_ender", EnderSignal.class, 15), + EYE_OF_ENDER("eye_of_ender", EnderSignal.class, 15), /** * A flying splash potion. */ - SPLASH_POTION("potion", ThrownPotion.class, 16, false), + POTION("potion", ThrownPotion.class, 16, false), /** * A flying experience bottle. */ - THROWN_EXP_BOTTLE("experience_bottle", ThrownExpBottle.class, 17), + EXPERIENCE_BOTTLE("experience_bottle", ThrownExpBottle.class, 17), /** * An item frame on a wall. */ @@ -109,7 +109,7 @@ public enum EntityType implements Keyed, Translatable { /** * Primed TNT that is about to explode. */ - PRIMED_TNT("tnt", TNTPrimed.class, 20), + TNT("tnt", TNTPrimed.class, 20), /** * A block that is going to or is about to fall. */ @@ -117,7 +117,7 @@ public enum EntityType implements Keyed, Translatable { /** * Internal representation of a Firework once it has been launched. */ - FIREWORK("firework_rocket", Firework.class, 22, false), + FIREWORK_ROCKET("firework_rocket", Firework.class, 22, false), /** * @see Husk */ @@ -181,7 +181,7 @@ public enum EntityType implements Keyed, Translatable { /** * @see CommandMinecart */ - MINECART_COMMAND("command_block_minecart", CommandMinecart.class, 40), + COMMAND_BLOCK_MINECART("command_block_minecart", CommandMinecart.class, 40), /** * A placed boat. */ @@ -193,23 +193,23 @@ public enum EntityType implements Keyed, Translatable { /** * @see StorageMinecart */ - MINECART_CHEST("chest_minecart", StorageMinecart.class, 43), + CHEST_MINECART("chest_minecart", StorageMinecart.class, 43), /** * @see PoweredMinecart */ - MINECART_FURNACE("furnace_minecart", PoweredMinecart.class, 44), + FURNACE_MINECART("furnace_minecart", PoweredMinecart.class, 44), /** * @see ExplosiveMinecart */ - MINECART_TNT("tnt_minecart", ExplosiveMinecart.class, 45), + TNT_MINECART("tnt_minecart", ExplosiveMinecart.class, 45), /** * @see HopperMinecart */ - MINECART_HOPPER("hopper_minecart", HopperMinecart.class, 46), + HOPPER_MINECART("hopper_minecart", HopperMinecart.class, 46), /** * @see SpawnerMinecart */ - MINECART_MOB_SPAWNER("spawner_minecart", SpawnerMinecart.class, 47), + SPAWNER_MINECART("spawner_minecart", SpawnerMinecart.class, 47), CREEPER("creeper", Creeper.class, 50), SKELETON("skeleton", Skeleton.class, 51), SPIDER("spider", Spider.class, 52), @@ -236,8 +236,8 @@ public enum EntityType implements Keyed, Translatable { CHICKEN("chicken", Chicken.class, 93), SQUID("squid", Squid.class, 94), WOLF("wolf", Wolf.class, 95), - MUSHROOM_COW("mooshroom", MushroomCow.class, 96), - SNOWMAN("snow_golem", Snowman.class, 97), + MOOSHROOM("mooshroom", MushroomCow.class, 96), + SNOW_GOLEM("snow_golem", Snowman.class, 97), OCELOT("ocelot", Ocelot.class, 98), IRON_GOLEM("iron_golem", IronGolem.class, 99), HORSE("horse", Horse.class, 100), @@ -247,7 +247,7 @@ public enum EntityType implements Keyed, Translatable { LLAMA_SPIT("llama_spit", LlamaSpit.class, 104), PARROT("parrot", Parrot.class, 105), VILLAGER("villager", Villager.class, 120), - ENDER_CRYSTAL("end_crystal", EnderCrystal.class, 200), + END_CRYSTAL("end_crystal", EnderCrystal.class, 200), TURTLE("turtle", Turtle.class, -1), PHANTOM("phantom", Phantom.class, -1), TRIDENT("trident", Trident.class, -1), @@ -305,13 +305,13 @@ public enum EntityType implements Keyed, Translatable { /** * A fishing line and bobber. */ - FISHING_HOOK("fishing_bobber", FishHook.class, -1, false), + FISHING_BOBBER("fishing_bobber", FishHook.class, -1, false), /** * A bolt of lightning. *

* Spawn with {@link World#strikeLightning(Location)}. */ - LIGHTNING("lightning_bolt", LightningStrike.class, -1, false), + LIGHTNING_BOLT("lightning_bolt", LightningStrike.class, -1, false), PLAYER("player", Player.class, -1, false), /** * An unknown entity without an Entity Class @@ -336,21 +336,6 @@ public enum EntityType implements Keyed, Translatable { ID_MAP.put(type.typeId, type); } } - - // Add legacy names - NAME_MAP.put("xp_orb", EXPERIENCE_ORB); - NAME_MAP.put("eye_of_ender_signal", ENDER_SIGNAL); - NAME_MAP.put("xp_bottle", THROWN_EXP_BOTTLE); - NAME_MAP.put("fireworks_rocket", FIREWORK); - NAME_MAP.put("evocation_fangs", EVOKER_FANGS); - NAME_MAP.put("evocation_illager", EVOKER); - NAME_MAP.put("vindication_illager", VINDICATOR); - NAME_MAP.put("illusion_illager", ILLUSIONER); - NAME_MAP.put("commandblock_minecart", MINECART_COMMAND); - NAME_MAP.put("snowman", SNOWMAN); - NAME_MAP.put("villager_golem", IRON_GOLEM); - NAME_MAP.put("ender_crystal", ENDER_CRYSTAL); - NAME_MAP.put("zombie_pigman", ZOMBIFIED_PIGLIN); } private EntityType(/*@Nullable*/ String name, /*@Nullable*/ Class clazz, int typeId) { diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java index b6afe1cff5..7feeb33f89 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -27,42 +27,42 @@ public abstract class PotionEffectType implements Keyed, Translatable { /** * Decreases movement speed. */ - public static final PotionEffectType SLOW = getPotionEffectType(2, "slowness"); + public static final PotionEffectType SLOWNESS = getPotionEffectType(2, "slowness"); /** * Increases dig speed. */ - public static final PotionEffectType FAST_DIGGING = getPotionEffectType(3, "haste"); + public static final PotionEffectType HASTE = getPotionEffectType(3, "haste"); /** * Decreases dig speed. */ - public static final PotionEffectType SLOW_DIGGING = getPotionEffectType(4, "mining_fatigue"); + public static final PotionEffectType MINING_FATIGUE = getPotionEffectType(4, "mining_fatigue"); /** * Increases damage dealt. */ - public static final PotionEffectType INCREASE_DAMAGE = getPotionEffectType(5, "strength"); + public static final PotionEffectType STRENGTH = getPotionEffectType(5, "strength"); /** * Heals an entity. */ - public static final PotionEffectType HEAL = getPotionEffectType(6, "instant_health"); + public static final PotionEffectType INSTANT_HEALTH = getPotionEffectType(6, "instant_health"); /** * Hurts an entity. */ - public static final PotionEffectType HARM = getPotionEffectType(7, "instant_damage"); + public static final PotionEffectType INSTANT_DAMAGE = getPotionEffectType(7, "instant_damage"); /** * Increases jump height. */ - public static final PotionEffectType JUMP = getPotionEffectType(8, "jump_boost"); + public static final PotionEffectType JUMP_BOOST = getPotionEffectType(8, "jump_boost"); /** * Warps vision on the client. */ - public static final PotionEffectType CONFUSION = getPotionEffectType(9, "nausea"); + public static final PotionEffectType NAUSEA = getPotionEffectType(9, "nausea"); /** * Regenerates health. @@ -72,7 +72,7 @@ public abstract class PotionEffectType implements Keyed, Translatable { /** * Decreases damage dealt to an entity. */ - public static final PotionEffectType DAMAGE_RESISTANCE = getPotionEffectType(11, "resistance"); + public static final PotionEffectType RESISTANCE = getPotionEffectType(11, "resistance"); /** * Stops fire damage. @@ -340,7 +340,6 @@ public abstract class PotionEffectType implements Keyed, Translatable { @Deprecated public static PotionEffectType getByName(@NotNull String name) { Preconditions.checkArgument(name != null, "name cannot be null"); - name = convertLegacy(name); return Registry.EFFECT.get(NamespacedKey.fromString(name.toLowerCase(java.util.Locale.ENGLISH))); } @@ -353,33 +352,4 @@ public abstract class PotionEffectType implements Keyed, Translatable { public static PotionEffectType[] values() { return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]); } - - private static String convertLegacy(String from) { - if (from == null) { - return null; - } - - switch (from.toLowerCase()) { - case "slow": - return "slowness"; - case "fast_digging": - return "haste"; - case "slow_digging": - return "mining_fatigue"; - case "increase_damage": - return "strength"; - case "heal": - return "instant_health"; - case "harm": - return "instant_damage"; - case "jump": - return "jump_boost"; - case "confusion": - return "nausea"; - case "damage_resistance": - return "resistance"; - } - - return from; - } } diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionType.java b/paper-api/src/main/java/org/bukkit/potion/PotionType.java index 783c1a9a2b..310833ace1 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionType.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionType.java @@ -24,12 +24,12 @@ public enum PotionType implements Keyed { LONG_NIGHT_VISION("long_night_vision"), INVISIBILITY("invisibility"), LONG_INVISIBILITY("long_invisibility"), - JUMP("leaping"), + LEAPING("leaping"), LONG_LEAPING("long_leaping"), STRONG_LEAPING("strong_leaping"), FIRE_RESISTANCE("fire_resistance"), LONG_FIRE_RESISTANCE("long_fire_resistance"), - SPEED("swiftness"), + SWIFTNESS("swiftness"), LONG_SWIFTNESS("long_swiftness"), STRONG_SWIFTNESS("strong_swiftness"), SLOWNESS("slowness"), @@ -37,14 +37,14 @@ public enum PotionType implements Keyed { STRONG_SLOWNESS("strong_slowness"), WATER_BREATHING("water_breathing"), LONG_WATER_BREATHING("long_water_breathing"), - INSTANT_HEAL("healing"), + HEALING("healing"), STRONG_HEALING("strong_healing"), - INSTANT_DAMAGE("harming"), + HARMING("harming"), STRONG_HARMING("strong_harming"), POISON("poison"), LONG_POISON("long_poison"), STRONG_POISON("strong_poison"), - REGEN("regeneration"), + REGENERATION("regeneration"), LONG_REGENERATION("long_regeneration"), STRONG_REGENERATION("strong_regeneration"), STRENGTH("strength"),