diff --git a/verification/src/changes/accepted-core-public-api-changes.json b/verification/src/changes/accepted-core-public-api-changes.json index 0034d07467..df55f8bae6 100644 --- a/verification/src/changes/accepted-core-public-api-changes.json +++ b/verification/src/changes/accepted-core-public-api-changes.json @@ -67,5 +67,79 @@ "CONSTRUCTOR_REMOVED" ] } + ], + "Removal of deprecated API for WorldEdit 8": [ + { + "type": "com.sk89q.worldedit.world.biome.BiomeData", + "member": "Class com.sk89q.worldedit.world.biome.BiomeData", + "changes": [ + "CLASS_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.BiomeData", + "member": "Method com.sk89q.worldedit.world.biome.BiomeData.getName()", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.Biomes", + "member": "Class com.sk89q.worldedit.world.biome.Biomes", + "changes": [ + "CLASS_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.biome.Biomes", + "member": "Method com.sk89q.worldedit.world.biome.Biomes.findBiomeByName(java.util.Collection,java.lang.String,com.sk89q.worldedit.world.registry.BiomeRegistry)", + "changes": [ + "METHOD_REMOVED", + "ANNOTATION_REMOVED" + ] + }, + { + "type": "com.sk89q.worldedit.world.registry.BiomeRegistry", + "member": "Method com.sk89q.worldedit.world.registry.BiomeRegistry.getData(com.sk89q.worldedit.world.biome.BiomeType)", + "changes": [ + "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-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java index 0655308a26..5103901daf 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBiomeRegistry.java @@ -22,12 +22,8 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import org.bukkit.block.Biome; - -import javax.annotation.Nullable; /** * A biome registry for Bukkit. @@ -43,14 +39,4 @@ public Component getRichName(BiomeType biomeType) { TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - @SuppressWarnings({ "removal" }) - @Deprecated - @Nullable - @Override - public BiomeData getData(BiomeType biome) { - final Biome bukkitBiome = BukkitAdapter.adapt(biome); - return bukkitBiome == null ? null : bukkitBiome::name; - } - } diff --git a/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java b/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java index 818e83502b..55ceb6d8c1 100644 --- a/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java +++ b/worldedit-core-mc/src/main/java/com/sk89q/worldedit/coremc/internal/CoreMcBiomeRegistry.java @@ -21,7 +21,6 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.registry.BiomeRegistry; import net.minecraft.resources.Identifier; @@ -36,31 +35,4 @@ public final class CoreMcBiomeRegistry implements BiomeRegistry { public Component getRichName(BiomeType biomeType) { return TranslatableComponent.of(Util.makeDescriptionId("biome", Identifier.parse(biomeType.id()))); } - - @Deprecated - @Override - public BiomeData getData(BiomeType biome) { - return new CoreMcBiomeData(biome); - } - - @Deprecated - private static final class CoreMcBiomeData implements BiomeData { - private final BiomeType biome; - - /** - * Create a new instance. - * - * @param biome the base biome - */ - private CoreMcBiomeData(BiomeType biome) { - this.biome = biome; - } - - @SuppressWarnings("deprecation") - @Override - public String getName() { - return biome.id(); - } - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java deleted file mode 100644 index 72307720f6..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeData.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -/** - * Provides information about a biome. - * - * @deprecated This no longer returns useful information. - */ -@Deprecated -public interface BiomeData { - - /** - * Get the name of the biome, which does not have to follow any - * particular convention. - * - * @return the biome's name - * @deprecated This method does not work on the server. - * Use {@link BiomeRegistry#getRichName(BiomeType)}. - */ - @Deprecated - String getName(); - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java deleted file mode 100644 index 6c7e338c93..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeName.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.google.common.base.Function; -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Returns the name of a biome using a given {@code BiomeRegistry}. - * - * @deprecated for removal, appears to be unused - */ -@Deprecated -class BiomeName implements Function { - - private final BiomeRegistry registry; - - /** - * Create a new instance. - * - * @param registry the biome registry - */ - BiomeName(BiomeRegistry registry) { - checkNotNull(registry); - this.registry = registry; - } - - @Nullable - @Override - public String apply(BiomeType input) { - BiomeData data = registry.getData(input); - if (data != null) { - return data.getName(); - } else { - return null; - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java deleted file mode 100644 index 9e0b3fac89..0000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/Biomes.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.world.biome; - -import com.google.common.base.Functions; -import com.sk89q.worldedit.util.WeightedChoice; -import com.sk89q.worldedit.util.WeightedChoice.Choice; -import com.sk89q.worldedit.util.function.LevenshteinDistance; -import com.sk89q.worldedit.world.registry.BiomeRegistry; - -import java.util.Collection; -import java.util.Optional; -import java.util.function.Function; -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Utility methods related to biomes. - * - * @deprecated Only method is being deprecated for removal. - */ -@Deprecated -public final class Biomes { - - private Biomes() { - } - - /** - * Find a biome that matches the given input name. - * - * @param biomes a list of biomes - * @param name the name to test - * @param registry a biome registry - * @return a biome or null - * @deprecated This uses the outdated name system. Find names by comparing with their ID instead. - */ - @Deprecated - @Nullable - public static BiomeType findBiomeByName(Collection biomes, String name, BiomeRegistry registry) { - checkNotNull(biomes); - checkNotNull(name); - checkNotNull(registry); - - Function compare = new LevenshteinDistance(name, false, LevenshteinDistance.STANDARD_CHARS); - WeightedChoice chooser = new WeightedChoice<>(Functions.compose(compare::apply, new BiomeName(registry)), 0); - for (BiomeType biome : biomes) { - chooser.consider(biome); - } - Optional> choice = chooser.getChoice(); - if (choice.isPresent() && choice.get().getScore() <= 1) { - return choice.get().getValue(); - } else { - return null; - } - } - -} 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/BiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java index 3e18c47773..7403583f0d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BiomeRegistry.java @@ -20,11 +20,8 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; -import javax.annotation.Nullable; - /** * Provides information on biomes. */ @@ -38,16 +35,4 @@ public interface BiomeRegistry { */ Component getRichName(BiomeType biomeType); - /** - * Get data about a biome. - * - * @param biome the biome - * @return a data object or null if information is not known - * @deprecated This method no longer returns any useful information. - * Use {@link #getRichName(BiomeType)} for the name of the biome. - */ - @Deprecated - @Nullable - BiomeData getData(BiomeType biome); - } 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. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java index 9625e6f0fd..c14d5d5d0f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/NullBiomeRegistry.java @@ -22,11 +22,8 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeType; -import javax.annotation.Nullable; - /** * A biome registry that knows nothing. */ @@ -44,14 +41,4 @@ public Component getRichName(BiomeType biomeType) { TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - // Suppress InlineMeSuggester: This method cannot be made final due to backwards compatibility - @SuppressWarnings("InlineMeSuggester") - @Deprecated - @Nullable - @Override - public BiomeData getData(BiomeType biome) { - return null; - } - } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java index 66e1b9c427..e91619cc31 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeBiomeRegistry.java @@ -22,12 +22,7 @@ import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.translation.TranslationManager; -import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.registry.BiomeRegistry; -import org.spongepowered.api.registry.RegistryReference; -import org.spongepowered.api.world.biome.Biome; - -import javax.annotation.Nullable; /** * Provides access to biome data in Sponge. @@ -40,32 +35,4 @@ public Component getRichName(com.sk89q.worldedit.world.biome.BiomeType biomeType TranslationManager.makeTranslationKey("biome", biomeType.id()) ); } - - @Deprecated - @Nullable - @Override - public BiomeData getData(com.sk89q.worldedit.world.biome.BiomeType biome) { - return new SpongeBiomeData(SpongeAdapter.adapt(biome)); - } - - @Deprecated - private static class SpongeBiomeData implements BiomeData { - private final RegistryReference biome; - - /** - * Create a new instance. - * - * @param biome the base biome - */ - private SpongeBiomeData(RegistryReference biome) { - this.biome = biome; - } - - @SuppressWarnings("deprecation") - @Override - public String getName() { - return biome.location().asString(); - } - } - }