From f22b51222f562d8579bad972e9518f1d240f6880 Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Sat, 28 Feb 2026 11:44:18 +1000 Subject: [PATCH] Remove deprecated tool aliases --- .../sk89q/worldedit/command/ToolCommands.java | 51 ++----------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index a68492f4da..acbc98d24d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.command; -import com.google.common.collect.Collections2; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -45,7 +44,6 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; -import com.sk89q.worldedit.internal.command.CommandUtil; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; @@ -57,14 +55,11 @@ import com.sk89q.worldedit.world.item.ItemType; import org.enginehub.piston.CommandManager; import org.enginehub.piston.CommandManagerService; -import org.enginehub.piston.CommandMetadata; -import org.enginehub.piston.CommandParameters; import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.param.Arg; import org.enginehub.piston.part.SubCommandPart; -import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -88,58 +83,21 @@ public static void register(CommandRegistrationHandler registration, new ToolCommands(worldEdit) ); - // Register deprecated global commands - Set commands = collect.getAllCommands() - .collect(Collectors.toSet()); - for (org.enginehub.piston.Command command : commands) { - if (command.getAliases().contains("unbind")) { - // Don't register new /tool alias - command = command.toBuilder().aliases( - Collections2.filter(command.getAliases(), alias -> !"unbind".equals(alias)) - ).build(); - } - if (command.getName().equals("stacker")) { - // Don't register /stacker - continue; - } - commandManager.register(CommandUtil.deprecate( - command, "Global tool names cause conflicts " - + "and will be removed in WorldEdit 8", - CommandUtil.ReplacementMessageGenerator.forNewCommand(ToolCommands::asNonGlobal) - )); - } - - // Remove aliases with / in them, since it doesn't make sense for sub-commands. - Set nonGlobalCommands = commands.stream() - .map(command -> - command.toBuilder().aliases( - Collections2.filter(command.getAliases(), alias -> !alias.startsWith("/")) - ).build() - ) - .collect(Collectors.toSet()); + Set commands = collect.getAllCommands().collect(Collectors.toSet()); commandManager.register("tool", command -> { command.addPart(SubCommandPart.builder( TranslatableComponent.of("tool"), TextComponent.of("The tool to bind") ) - .withCommands(nonGlobalCommands) + .withCommands(commands) .required() .build()); command.description(TextComponent.of("Binds a tool to the item in your hand")); - command.condition(new SubCommandPermissionCondition.Generator(nonGlobalCommands).build()); + command.condition(new SubCommandPermissionCondition.Generator(commands).build()); }); } - private static String asNonGlobal(org.enginehub.piston.Command oldCommand, - CommandParameters oldParameters) { - String name = Optional.ofNullable(oldParameters.getMetadata()) - .map(CommandMetadata::getCalledName) - .filter(n -> !n.startsWith("/")) - .orElseGet(oldCommand::getName); - return "/tool " + name; - } - static void setToolNone(Player player, LocalSession session, boolean isBrush) throws InvalidToolBindException { ItemType type = player.getItemInHand(HandSide.MAIN_HAND).getType(); @@ -183,7 +141,6 @@ public void none(Player player, LocalSession session) throws WorldEditException @Command( name = "selwand", - aliases = "/selwand", desc = "Selection wand tool" ) @CommandPermissions("worldedit.setwand") @@ -193,7 +150,6 @@ public void selwand(Player player, LocalSession session) throws WorldEditExcepti @Command( name = "navwand", - aliases = "/navwand", desc = "Navigation wand tool" ) @CommandPermissions("worldedit.setwand") @@ -295,7 +251,6 @@ public void farwand(Player player, LocalSession session) throws WorldEditExcepti @Command( name = "lrbuild", - aliases = { "/lrbuild" }, desc = "Long-range building tool" ) @CommandPermissions("worldedit.tool.lrbuild")