Allow saving unnamed waypoints by position

This commit is contained in:
ZacSharp 2021-10-17 13:53:55 +02:00
parent bcc33362b8
commit 1b04386b01
No known key found for this signature in database
GPG Key ID: 9453647B005083A3

View File

@ -129,7 +129,7 @@ public class WaypointsCommand extends Command {
if (tag == null) { if (tag == null) {
throw new CommandInvalidStateException(String.format("'%s' is not a tag ", args.consumedString())); throw new CommandInvalidStateException(String.format("'%s' is not a tag ", args.consumedString()));
} }
String name = args.hasAny() ? args.getString() : ""; String name = (args.hasExactlyOne() || args.hasExactly(4)) ? args.getString() : "";
BetterBlockPos pos = args.hasAny() BetterBlockPos pos = args.hasAny()
? args.getDatatypePost(RelativeBlockPos.INSTANCE, ctx.playerFeet()) ? args.getDatatypePost(RelativeBlockPos.INSTANCE, ctx.playerFeet())
: ctx.playerFeet(); : ctx.playerFeet();
@ -292,6 +292,7 @@ public class WaypointsCommand extends Command {
"Usage:", "Usage:",
"> wp [l/list] - List all waypoints.", "> wp [l/list] - List all waypoints.",
"> wp <s/save> <tag> - Save your current position as an unnamed waypoint with the specified tag.", "> wp <s/save> <tag> - Save your current position as an unnamed waypoint with the specified tag.",
"> wp <s/save> <tag> <pos> - Save an unnamed waypoint with the specified tag and position.",
"> wp <s/save> <tag> <name> - Save the waypoint with the specified name.", "> wp <s/save> <tag> <name> - Save the waypoint with the specified name.",
"> wp <s/save> <tag> <name> <pos> - Save the waypoint with the specified name and position.", "> wp <s/save> <tag> <name> <pos> - Save the waypoint with the specified name and position.",
"> wp <i/info/show> <tag> - Show info on a waypoint by tag.", "> wp <i/info/show> <tag> - Show info on a waypoint by tag.",