From 689f61cd2f1bc755b9390efa6ba0b28402c2d4a3 Mon Sep 17 00:00:00 2001 From: jmp Date: Fri, 8 Jan 2021 19:38:51 -0800 Subject: [PATCH 1/6] Add Location2DArgument, mapped to NMS Vec2I argument --- .../bukkit/BukkitBrigadierMapper.java | 21 +- .../bukkit/BukkitCommandManager.java | 4 + .../bukkit/parsers/location/Location2D.java | 54 ++++ .../parsers/location/Location2DArgument.java | 269 ++++++++++++++++++ .../parsers/location/LocationArgument.java | 2 +- 5 files changed, 346 insertions(+), 4 deletions(-) create mode 100644 cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java create mode 100644 cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitBrigadierMapper.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitBrigadierMapper.java index ed15eed51..3b4353a46 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitBrigadierMapper.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitBrigadierMapper.java @@ -28,6 +28,7 @@ import cloud.commandframework.bukkit.arguments.selector.MultiplePlayerSelector; import cloud.commandframework.bukkit.arguments.selector.SingleEntitySelector; import cloud.commandframework.bukkit.arguments.selector.SinglePlayerSelector; +import cloud.commandframework.bukkit.parsers.location.Location2D; import com.mojang.brigadier.arguments.ArgumentType; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -88,6 +89,8 @@ public BukkitBrigadierMapper( this.mapComplexNMS(MultiplePlayerSelector.class, this.getEntitySelectorArgument(false, true)); /* Map Vec3 */ this.mapComplexNMS(Location.class, this.getArgumentVec3()); + /* Map Vec2I */ + this.mapComplexNMS(Location2D.class, this.getArgumentVec2I()); } catch (final Exception e) { this.commandManager.getOwningPlugin() .getLogger() @@ -100,7 +103,7 @@ public BukkitBrigadierMapper( * @param playersOnly Whether the selector is for players only (true), or for all entities (false) * @return The NMS ArgumentType */ - private Supplier> getEntitySelectorArgument( + private @NonNull Supplier> getEntitySelectorArgument( final boolean single, final boolean playersOnly ) { @@ -117,13 +120,25 @@ private Supplier> getEntitySelectorArgument( } @SuppressWarnings("UnnecessaryLambda") - private Supplier> getArgumentVec3() { + private @NonNull Supplier> getArgumentVec3() { return () -> { try { return (ArgumentType) this.getNMSArgument("Vec3").getDeclaredConstructor(boolean.class) .newInstance(true); } catch (final Exception e) { - this.commandManager.getOwningPlugin().getLogger().log(Level.INFO, "Failed to retrieve vector argument", e); + this.commandManager.getOwningPlugin().getLogger().log(Level.INFO, "Failed to retrieve Vec3D argument", e); + return null; + } + }; + } + + @SuppressWarnings("UnnecessaryLambda") + private @NonNull Supplier> getArgumentVec2I() { + return () -> { + try { + return (ArgumentType) this.getNMSArgument("Vec2I").getDeclaredConstructor().newInstance(); + } catch (final Exception e) { + this.commandManager.getOwningPlugin().getLogger().log(Level.INFO, "Failed to retrieve Vec2I argument", e); return null; } }; diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandManager.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandManager.java index d12735748..c0a116813 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandManager.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/BukkitCommandManager.java @@ -36,7 +36,9 @@ import cloud.commandframework.bukkit.parsers.OfflinePlayerArgument; import cloud.commandframework.bukkit.parsers.PlayerArgument; import cloud.commandframework.bukkit.parsers.WorldArgument; +import cloud.commandframework.bukkit.parsers.location.Location2D; import cloud.commandframework.bukkit.parsers.location.LocationArgument; +import cloud.commandframework.bukkit.parsers.location.Location2DArgument; import cloud.commandframework.bukkit.parsers.selector.MultipleEntitySelectorArgument; import cloud.commandframework.bukkit.parsers.selector.MultiplePlayerSelectorArgument; import cloud.commandframework.bukkit.parsers.selector.SingleEntitySelectorArgument; @@ -172,6 +174,8 @@ public BukkitCommandManager( new EnchantmentArgument.EnchantmentParser<>()); this.getParserRegistry().registerParserSupplier(TypeToken.get(Location.class), parserParameters -> new LocationArgument.LocationParser<>()); + this.getParserRegistry().registerParserSupplier(TypeToken.get(Location2D.class), parserParameters -> + new Location2DArgument.Location2DParser<>()); /* Register Entity Selector Parsers */ this.getParserRegistry().registerParserSupplier(TypeToken.get(SingleEntitySelector.class), parserParameters -> new SingleEntitySelectorArgument.SingleEntitySelectorParser<>()); diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java new file mode 100644 index 000000000..04a6a61e2 --- /dev/null +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java @@ -0,0 +1,54 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg & Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package cloud.commandframework.bukkit.parsers.location; + +import org.bukkit.Location; +import org.bukkit.World; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + +/** + * {@link Location} which defaults the Y position to 0 + * + * @since 1.4.0 + */ +public class Location2D extends Location { + + private Location2D(final @Nullable World world, final double x, final double z) { + super(world, x, 0, z); + } + + /** + * Get a new Location2D + * + * @param world World this location is in + * @param x X position for this location + * @param z Z position for this location + * @return Location2D + */ + public static @NonNull Location2D from(final @Nullable World world, final double x, final double z) { + return new Location2D(world, x, z); + } + +} diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java new file mode 100644 index 000000000..68e22830c --- /dev/null +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java @@ -0,0 +1,269 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg & Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package cloud.commandframework.bukkit.parsers.location; + +import cloud.commandframework.arguments.CommandArgument; +import cloud.commandframework.arguments.parser.ArgumentParseResult; +import cloud.commandframework.arguments.parser.ArgumentParser; +import cloud.commandframework.arguments.standard.IntegerArgument; +import cloud.commandframework.bukkit.parsers.location.LocationArgument.LocationParseException; +import cloud.commandframework.context.CommandContext; +import io.leangen.geantyref.TypeToken; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.command.BlockCommandSender; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.util.Vector; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.function.BiFunction; +import java.util.stream.Collectors; + +/** + * Argument parser that parses {@link Location2D} from two doubles. This will use the command + * senders world when it exists, or else it'll use the first loaded Bukkit world + * + * @param Command sender type + * @since 1.4.0 + */ +public final class Location2DArgument extends CommandArgument { + + private Location2DArgument( + final boolean required, + final @NonNull String name, + final @NonNull String defaultValue, + final @Nullable BiFunction, String, List> suggestionsProvider, + final @NonNull Collection<@NonNull BiFunction<@NonNull CommandContext, + @NonNull Queue<@NonNull String>, @NonNull ArgumentParseResult>> argumentPreprocessors + ) { + super( + required, + name, + new Location2DParser<>(), + defaultValue, + TypeToken.get(Location2D.class), + suggestionsProvider, + argumentPreprocessors + ); + } + + /** + * Create a new argument builder + * + * @param name Argument name + * @param Command sender type + * @return Builder instance + */ + public static @NonNull Builder newBuilder( + final @NonNull String name + ) { + return new Builder<>(name); + } + + /** + * Create a new required argument + * + * @param name Argument name + * @param Command sender type + * @return Constructed argument + */ + public static @NonNull CommandArgument of( + final @NonNull String name + ) { + return Location2DArgument.newBuilder( + name + ).asRequired().build(); + } + + /** + * Create a new optional argument + * + * @param name Argument name + * @param Command sender type + * @return Constructed argument + */ + public static @NonNull CommandArgument optional( + final @NonNull String name + ) { + return Location2DArgument.newBuilder( + name + ).asOptional().build(); + } + + + public static final class Builder extends CommandArgument.Builder { + + private Builder( + final @NonNull String name + ) { + super( + TypeToken.get(Location2D.class), + name + ); + } + + @Override + public @NonNull CommandArgument<@NonNull C, @NonNull Location2D> build() { + return new Location2DArgument<>( + this.isRequired(), + this.getName(), + this.getDefaultValue(), + this.getSuggestionsProvider(), + new LinkedList<>() + ); + } + + } + + + public static final class Location2DParser implements ArgumentParser { + + private static final int EXPECTED_PARAMETER_COUNT = 2; + + private final LocationCoordinateParser locationCoordinateParser = new LocationCoordinateParser<>(); + + @Override + public @NonNull ArgumentParseResult<@NonNull Location2D> parse( + final @NonNull CommandContext<@NonNull C> commandContext, + final @NonNull Queue<@NonNull String> inputQueue + ) { + if (inputQueue.size() < 2) { + final StringBuilder input = new StringBuilder(); + for (int i = 0; i < inputQueue.size(); i++) { + input.append(((LinkedList) inputQueue).get(i)); + } + return ArgumentParseResult.failure( + new LocationParseException( + commandContext, + LocationParseException.FailureReason.WRONG_FORMAT, + input.toString() + ) + ); + } + final LocationCoordinate[] coordinates = new LocationCoordinate[2]; + for (int i = 0; i < 2; i++) { + final ArgumentParseResult<@NonNull LocationCoordinate> coordinate = this.locationCoordinateParser.parse( + commandContext, + inputQueue + ); + if (coordinate.getFailure().isPresent()) { + return ArgumentParseResult.failure( + coordinate.getFailure().get() + ); + } + coordinates[i] = coordinate.getParsedValue().orElseThrow(NullPointerException::new); + } + final Location originalLocation; + final CommandSender bukkitSender = commandContext.get("BukkitCommandSender"); + + if (bukkitSender instanceof BlockCommandSender) { + originalLocation = ((BlockCommandSender) bukkitSender).getBlock().getLocation(); + } else if (bukkitSender instanceof Entity) { + originalLocation = ((Entity) bukkitSender).getLocation(); + } else { + originalLocation = new Location(Bukkit.getWorlds().get(0), 0, 0, 0); + } + + if (coordinates[0].getType() == LocationCoordinateType.LOCAL && coordinates[1].getType() != LocationCoordinateType.LOCAL) { + return ArgumentParseResult.failure( + new LocationParseException( + commandContext, + LocationParseException.FailureReason.MIXED_LOCAL_ABSOLUTE, + "" + ) + ); + } + + if (coordinates[0].getType() == LocationCoordinateType.ABSOLUTE) { + originalLocation.setX(coordinates[0].getCoordinate()); + } else if (coordinates[0].getType() == LocationCoordinateType.RELATIVE) { + originalLocation.add(coordinates[0].getCoordinate(), 0, 0); + } + + if (coordinates[1].getType() == LocationCoordinateType.ABSOLUTE) { + originalLocation.setZ(coordinates[1].getCoordinate()); + } else if (coordinates[1].getType() == LocationCoordinateType.RELATIVE) { + originalLocation.add(0, 0, coordinates[1].getCoordinate()); + } else { + final double multiplier = 0.017453292D; + final double f = Math.cos((originalLocation.getYaw() + 90.0F) * multiplier); + final double f1 = Math.sin((originalLocation.getY() + 90.0F) * multiplier); + final double f2 = Math.cos(-originalLocation.getPitch() * multiplier); + final double f3 = Math.sin(-originalLocation.getPitch() * multiplier); + final double f4 = Math.cos((-originalLocation.getPitch() + 90.0F) * multiplier); + final double f5 = Math.sin((-originalLocation.getPitch() + 90.0F) * multiplier); + final Vector vec1 = new Vector(f * f2, f3, f1 * f2); + final Vector vec2 = new Vector(f * f4, f5, f1 * f4); + final Vector vec3 = vec1.crossProduct(vec2).multiply(-1); + final Vector vec4 = new Vector( + vec1.getX() * vec2.getX() * coordinates[1].getCoordinate() + vec3.getX() * coordinates[0].getCoordinate(), + 0, + vec1.getZ() * coordinates[1].getCoordinate() + vec2.getZ() * coordinates[1].getCoordinate() + + vec3.getZ() * coordinates[0].getCoordinate() + ); + originalLocation.add(vec4); + } + + return ArgumentParseResult.success(Location2D.from( + originalLocation.getWorld(), + originalLocation.getX(), + originalLocation.getZ() + )); + } + + @Override + public @NonNull List<@NonNull String> suggestions( + final @NonNull CommandContext commandContext, + final @NonNull String input + ) { + final String workingInput; + final String prefix; + if (input.startsWith("~") || input.startsWith("^")) { + prefix = Character.toString(input.charAt(0)); + workingInput = input.substring(1); + } else { + prefix = ""; + workingInput = input; + } + return IntegerArgument.IntegerParser.getSuggestions( + Integer.MIN_VALUE, + Integer.MAX_VALUE, + workingInput + ).stream().map(string -> prefix + string).collect(Collectors.toList()); + } + + @Override + public int getRequestedArgumentCount() { + return EXPECTED_PARAMETER_COUNT; + } + + } + +} diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java index 215373026..a8abda661 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java @@ -283,7 +283,7 @@ public int getRequestedArgumentCount() { } - private static class LocationParseException extends ParserException { + static class LocationParseException extends ParserException { private static final long serialVersionUID = -3261835227265878218L; From e7ce7295cbcfa59a245f53638ce919fb136439ae Mon Sep 17 00:00:00 2001 From: jmp Date: Fri, 8 Jan 2021 19:45:27 -0800 Subject: [PATCH 2/6] Duplicate less code --- .../parsers/location/Location2DArgument.java | 17 +---------------- .../parsers/location/LocationArgument.java | 7 +++++++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java index 68e22830c..39d2c6e34 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java @@ -26,7 +26,6 @@ import cloud.commandframework.arguments.CommandArgument; import cloud.commandframework.arguments.parser.ArgumentParseResult; import cloud.commandframework.arguments.parser.ArgumentParser; -import cloud.commandframework.arguments.standard.IntegerArgument; import cloud.commandframework.bukkit.parsers.location.LocationArgument.LocationParseException; import cloud.commandframework.context.CommandContext; import io.leangen.geantyref.TypeToken; @@ -44,7 +43,6 @@ import java.util.List; import java.util.Queue; import java.util.function.BiFunction; -import java.util.stream.Collectors; /** * Argument parser that parses {@link Location2D} from two doubles. This will use the command @@ -243,20 +241,7 @@ public static final class Location2DParser implements ArgumentParser commandContext, final @NonNull String input ) { - final String workingInput; - final String prefix; - if (input.startsWith("~") || input.startsWith("^")) { - prefix = Character.toString(input.charAt(0)); - workingInput = input.substring(1); - } else { - prefix = ""; - workingInput = input; - } - return IntegerArgument.IntegerParser.getSuggestions( - Integer.MIN_VALUE, - Integer.MAX_VALUE, - workingInput - ).stream().map(string -> prefix + string).collect(Collectors.toList()); + return LocationArgument.LocationParser.getSuggestions(commandContext, input); } @Override diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java index a8abda661..125249dd8 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java @@ -258,6 +258,13 @@ public static final class LocationParser implements ArgumentParser suggestions( final @NonNull CommandContext commandContext, final @NonNull String input + ) { + return LocationArgument.LocationParser.getSuggestions(commandContext, input); + } + + public static @NonNull List<@NonNull String> getSuggestions( + final @NonNull CommandContext commandContext, + final @NonNull String input ) { final String workingInput; final String prefix; From 3702b76f3ceb5e79c93db5677f59f4123a8dfe5b Mon Sep 17 00:00:00 2001 From: jmp Date: Fri, 8 Jan 2021 19:49:22 -0800 Subject: [PATCH 3/6] Fix build --- .../bukkit/parsers/location/LocationArgument.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java index 125249dd8..b29fc7ec3 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java @@ -262,7 +262,7 @@ public static final class LocationParser implements ArgumentParser @NonNull List<@NonNull String> getSuggestions( + static @NonNull List<@NonNull String> getSuggestions( final @NonNull CommandContext commandContext, final @NonNull String input ) { From 990da9c4b8e60729ee70db1ae5882710dbc7e8a7 Mon Sep 17 00:00:00 2001 From: jmp Date: Fri, 8 Jan 2021 20:29:11 -0800 Subject: [PATCH 4/6] Move local coordinate space calculation to a separate method --- .../parsers/location/Location2DArgument.java | 24 ++++----- .../parsers/location/LocationArgument.java | 49 ++++++++++++------- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java index 39d2c6e34..6aebfe7d2 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2DArgument.java @@ -210,23 +210,17 @@ public static final class Location2DParser implements ArgumentParser implements ArgumentParser implements ArgumentParser suggestions( final @NonNull CommandContext commandContext, From 78d2b42dd124646d809e3cc00f76f9a262493ee0 Mon Sep 17 00:00:00 2001 From: jmp Date: Fri, 8 Jan 2021 20:33:31 -0800 Subject: [PATCH 5/6] Make checkstyle happy --- .../commandframework/bukkit/parsers/location/Location2D.java | 2 +- .../bukkit/parsers/location/LocationArgument.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java index 04a6a61e2..303382585 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java @@ -35,7 +35,7 @@ */ public class Location2D extends Location { - private Location2D(final @Nullable World world, final double x, final double z) { + protected Location2D(final @Nullable World world, final double x, final double z) { super(world, x, 0, z); } diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java index fe6c0abd4..148d3e435 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/LocationArgument.java @@ -243,7 +243,7 @@ public static final class LocationParser implements ArgumentParser Date: Sat, 9 Jan 2021 00:12:50 -0800 Subject: [PATCH 6/6] Update cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Söderberg <4096670+Citymonstret@users.noreply.github.com> --- .../commandframework/bukkit/parsers/location/Location2D.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java index 303382585..331556243 100644 --- a/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java +++ b/cloud-minecraft/cloud-bukkit/src/main/java/cloud/commandframework/bukkit/parsers/location/Location2D.java @@ -29,7 +29,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** - * {@link Location} which defaults the Y position to 0 + * {@link Location} projected onto the XZ-plane * * @since 1.4.0 */