Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super pickaxe mode toggling does not work with single slash #1547

Closed
2 tasks done
Fabb111 opened this issue Jan 16, 2022 · 2 comments · Fixed by #1553
Closed
2 tasks done

Super pickaxe mode toggling does not work with single slash #1547

Fabb111 opened this issue Jan 16, 2022 · 2 comments · Fixed by #1553
Labels
Approved Added if an issue has been approved by a maintainer Bug Something isn't working

Comments

@Fabb111
Copy link

Fabb111 commented Jan 16, 2022

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.

@Fabb111 Fabb111 added the Requires Testing This is a new issue which needs to be approved before labeled with "bug" label Jan 16, 2022
@NotMyFault
Copy link
Member

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?

@NotMyFault NotMyFault added Awaiting Response Waiting on the creator for delivering the information requested and removed Requires Testing This is a new issue which needs to be approved before labeled with "bug" labels Jan 19, 2022
@Fabb111
Copy link
Author

Fabb111 commented Jan 19, 2022

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.

@NotMyFault NotMyFault added Approved Added if an issue has been approved by a maintainer Bug Something isn't working and removed Awaiting Response Waiting on the creator for delivering the information requested labels Jan 19, 2022
@NotMyFault NotMyFault changed the title Super pickaxe mode toggling does not work Super pickaxe mode toggling does not work with single slash Jan 19, 2022
NotMyFault added a commit that referenced this issue Jan 19, 2022
NotMyFault added a commit that referenced this issue Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Added if an issue has been approved by a maintainer Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants