Adds /launchpad abort #3

This commit is contained in:
Kristian Knarvik 2023-06-30 13:06:48 +02:00
parent d9c9813994
commit 11f969a3f8
3 changed files with 12 additions and 3 deletions

View File

@ -19,8 +19,6 @@ public class LaunchpadCommand implements CommandExecutor {
return false;
}
// TODO: Add an abort action to clear the player's modification requests
// TODO: Properly allow nulling (unsetting) values
if (arguments.length < 1) {
@ -44,6 +42,12 @@ public class LaunchpadCommand implements CommandExecutor {
case ADD, REMOVE -> request = new ModificationRequest(action, null);
case VERTICAL_VELOCITY, HORIZONTAL_VELOCITY, FIXED_DIRECTION ->
request = new ModificationRequest(action, arguments[1]);
case ABORT -> {
// Retrieving modification requests also removes them
ModificationRequestHandler.getRequests(player.getUniqueId());
commandSender.sendMessage("Launchpad modifications cleared");
return true;
}
}
ModificationRequestHandler.addRequest(player.getUniqueId(), request);
commandSender.sendMessage("Right-click the block to modify launchpad properties for");

View File

@ -33,6 +33,11 @@ public enum ModificationAction {
* The action of setting the fixed direction of a launchpad
*/
FIXED_DIRECTION("fixedDirection", true),
/**
* The action of aborting previous actions
*/
ABORT("abort", false),
;
private final @NotNull String commandName;

View File

@ -12,7 +12,7 @@ commands:
description: Used to reload the Launchpad plugin
permission: launchpad.reload
launchpad:
usage: /<command> <add|remove|verticalVelocity|horizontalVelocity|fixedDirection> [value]
usage: /<command> <add | remove | abort | verticalVelocity | horizontalVelocity | fixedDirection> [value]
description: Used to alter launchpads
permission: launchpad.modify