From 8bc312e18d8636b65630aa4cb50266659df515ea Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Mon, 6 Jul 2026 16:09:39 +1000 Subject: [PATCH] Remove deprecated getName method from Item/Block APIs --- .../accepted-core-public-api-changes.json | 32 +++++++++++++++++++ .../worldedit/world/block/BlockType.java | 19 ----------- .../sk89q/worldedit/world/item/ItemType.java | 22 ------------- .../world/registry/BlockRegistry.java | 13 -------- .../world/registry/BundledBlockRegistry.java | 10 ------ .../world/registry/BundledItemRegistry.java | 19 ----------- .../world/registry/ItemRegistry.java | 13 -------- 7 files changed, 32 insertions(+), 96 deletions(-) diff --git a/verification/src/changes/accepted-core-public-api-changes.json b/verification/src/changes/accepted-core-public-api-changes.json index 0eea898956..df55f8bae6 100644 --- a/verification/src/changes/accepted-core-public-api-changes.json +++ b/verification/src/changes/accepted-core-public-api-changes.json @@ -108,6 +108,38 @@ "METHOD_REMOVED", "ANNOTATION_REMOVED" ] + }, + { + "type": "com.sk89q.worldedit.world.block.BlockType", + "member": "Method com.sk89q.worldedit.world.block.BlockType.getName()", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.item.ItemType", + "member": "Method com.sk89q.worldedit.world.item.ItemType.getName()", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.registry.BlockRegistry", + "member": "Method com.sk89q.worldedit.world.registry.BlockRegistry.getName(com.sk89q.worldedit.world.block.BlockType)", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.registry.ItemRegistry", + "member": "Method com.sk89q.worldedit.world.registry.ItemRegistry.getName(com.sk89q.worldedit.world.item.ItemType)", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] } ] } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 66fa710d4c..37f0da6494 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -74,10 +74,6 @@ public class BlockType implements Keyed { = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this)); @SuppressWarnings("this-escape") - @Deprecated - private final LazyReference name = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager() - .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getName(this)); - @SuppressWarnings("this-escape") private final LazyReference legacyId = LazyReference.from(() -> computeLegacy(0)); @SuppressWarnings("this-escape") private final LazyReference legacyData = LazyReference.from(() -> computeLegacy(1)); @@ -123,21 +119,6 @@ public Component getRichName() { .getRegistries().getBlockRegistry().getRichName(this); } - /** - * Gets the name of this block, or the ID if the name cannot be found. - * - * @return The name, or ID - * @deprecated The name is now translatable, use {@link #getRichName()}. - */ - @Deprecated - public String getName() { - String name = this.name.getValue(); - if (name == null || name.isEmpty()) { - return id(); - } - return name; - } - /** * Gets the properties of this BlockType in a {@code key->property} mapping. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index 148e17e672..40f567ccfc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -23,7 +23,6 @@ import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.NamespacedRegistry; -import com.sk89q.worldedit.util.GuavaUtil; import com.sk89q.worldedit.util.concurrency.LazyReference; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.world.block.BlockType; @@ -37,15 +36,6 @@ public class ItemType implements Keyed { public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type", "item_type", "minecraft", true); private final String id; - @SuppressWarnings({"deprecation", "this-escape"}) - private final LazyReference name = LazyReference.from(() -> { - String name = GuavaUtil.firstNonNull( - WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) - .getRegistries().getItemRegistry().getName(this), - "" - ); - return name.isEmpty() ? id() : name; - }); @SuppressWarnings("this-escape") private final LazyReference richName = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) @@ -74,18 +64,6 @@ public Component getRichName() { return richName.getValue(); } - /** - * Gets the name of this item, or the ID if the name cannot be found. - * - * @return The name, or ID - * @deprecated Names are translatable now, use {@link #getRichName()}. - */ - @Deprecated - public String getName() { - return name.getValue(); - } - - /** * Gets whether this item type has a block representation. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index 12f6b51ca1..012b13d849 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -41,19 +41,6 @@ public interface BlockRegistry { */ Component getRichName(BlockType blockType); - /** - * Gets the name for the given block. - * - * @param blockType the block - * @return The name, or null if it's unknown - * @deprecated Names are now translatable, use {@link #getRichName(BlockType)}. - */ - @Deprecated - @Nullable - default String getName(BlockType blockType) { - return getRichName(blockType).toString(); - } - /** * Get the material for the given block. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index 714fb50839..799fe94185 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -57,16 +57,6 @@ public Component getRichName(BlockType blockType) { ); } - @Nullable - @Override - @Deprecated - // dumb_intellij.jpg - @SuppressWarnings("deprecation") - public String getName(BlockType blockType) { - BundledBlockData.BlockEntry blockEntry = BundledBlockData.getInstance().findById(blockType.id()); - return blockEntry != null ? blockEntry.localizedName : null; - } - @Nullable @Override public BlockMaterial getMaterial(BlockType blockType) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java index cd5147117e..3e3d65aa64 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemRegistry.java @@ -57,25 +57,6 @@ public Component getRichName(ItemType itemType) { ); } - @Nullable - @Override - @Deprecated - // dumb_intellij.jpg - @SuppressWarnings({"deprecation", "removal"}) - public String getName(ItemType itemType) { - BundledItemData.ItemEntry itemEntry = getEntryById(itemType); - if (itemEntry != null) { - String localized = itemEntry.localizedName; - if (localized.equals("Air")) { - String id = itemType.id(); - int c = id.indexOf(':'); - return c < 0 ? id : id.substring(c + 1); - } - return localized; - } - return null; - } - @Nullable @Override @Deprecated(forRemoval = true) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index 8f2c432e78..5e9767ca55 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -45,19 +45,6 @@ default Component getRichName(BaseItemStack itemStack) { return getRichName(itemStack.getType()); } - /** - * Gets the name for the given item. - * - * @param itemType the item - * @return The name, or null if it's unknown - * @deprecated Names are now translatable, use {@link #getRichName(ItemType)}. - */ - @Deprecated - @Nullable - default String getName(ItemType itemType) { - return getRichName(itemType).toString(); - } - /** * Get the material for the given item. *