FastAsyncWorldEdit

FastAsyncWorldEdit

152k Downloads

Super pickaxe mode toggling does not work with single slash

FabianKoder opened this issue ยท 2 comments

commented

Server Implementation

Paper

Server Version

1.18.1

Describe the bug

Toggling the super pickaxe mode does not work - providing any other argument than true or false as a parameter to //superpickaxe results in a InvocationTargetException.

image

The same happens when providing a range with e.g. //superpickaxe area 5

To Reproduce

  1. Just type //superpickaxe area 5, //superpickaxe single, ... (anything that is not a boolean - //superpickaxe true will work)
  2. Command will fail to run. See screenshot above. No error output in the console.
  3. E.g. //sp area 5 fails with the error message above, /sp area 5 works. But for toggling, /sp will fail with "No sub-command provided" and //sp works.

Expected behaviour

It is expected that the mode of the super pickaxe toggles.

Screenshots / Videos

No response

Error log (if applicable)

No response

Fawe Debugpaste

https://athion.net/ISPaster/paste/view/eeb37f10618747c19ceef32f9c21ab8e

Fawe Version

2.0.1-SNAPSHOT-69;d3696f9

Checklist

Anything else?

After quick investigation (disclaimer: never looked at the FAWE codebase before) it seems to me that the ToolUtilsCommands class that defines //superpickaxe

@Command(
name = "/superpickaxe",
aliases = {",", "/sp", "/pickaxe", "/"},
desc = "Toggle the super pickaxe function"
)
@CommandPermissions("worldedit.superpickaxe")
public void togglePickaxe(
Player player, LocalSession session,
@Arg(desc = "The new super pickaxe state", def = "")
Boolean superPickaxe
) {
boolean hasSuperPickAxe = session.hasSuperPickAxe();
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
player.print(Caption.of(superPickaxe
? "worldedit.tool.superpickaxe.enabled.already"
: "worldedit.tool.superpickaxe.disabled.already"));
return;
}
if (hasSuperPickAxe) {
session.disableSuperPickAxe();
player.print(Caption.of("worldedit.tool.superpickaxe.disabled"));
} else {
session.enableSuperPickAxe();
player.print(Caption.of("worldedit.tool.superpickaxe.enabled"));
}
}

more or less overrides the subcommands of SuperPickaxeCommands, as no matter what arguments you provide it always asks for the superPickaxe parameter, the toggle state boolean of the util command. As I have no idea of how the command system is implemented, I can't provide further details.

commented

I'm testing //superpickaxe area 5 on build 71 at the moment and it works out well.
The toggle is no separate parameter, but the actual command. E.g. you switch between activating and deactivating via //sp, not by appending true or false.

Can you outline again what exactly was not working please?

commented

Alright, just found out how to "work around" this issue. I don't know if that is intended, but it does work by using a single slash.
Toggling only works with //sp, changing mode only works with /sp.
E.g. //sp area 5 fails with the error message above, /sp area 5 works. But for toggling, /sp will fail with "No sub-command provided" and //sp works.
It seems very weird to me to split the same tool (options) into two separate commands that look like they are the same command.