From 152c0b09d13de22d5b5a3404829c41ddd4b274a5 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Thu, 27 Jul 2017 11:00:35 +0200 Subject: [PATCH] Removed unused copy methods, no longer needed --- .../java/com/mojang/brigadier/context/CommandContext.java | 5 ----- .../com/mojang/brigadier/context/CommandContextBuilder.java | 2 +- .../java/com/mojang/brigadier/context/ParsedArgument.java | 3 --- .../com/mojang/brigadier/context/ParsedArgumentTest.java | 6 ------ 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/com/mojang/brigadier/context/CommandContext.java b/src/main/java/com/mojang/brigadier/context/CommandContext.java index 1773dc9..dbaa51b 100644 --- a/src/main/java/com/mojang/brigadier/context/CommandContext.java +++ b/src/main/java/com/mojang/brigadier/context/CommandContext.java @@ -79,9 +79,4 @@ public class CommandContext { return nodes; } - public CommandContext copy() { - final Map> arguments = Maps.newLinkedHashMap(); - this.arguments.forEach((k, v) -> arguments.put(k, v.copy())); - return new CommandContext<>(source, arguments, command, nodes, input); - } } diff --git a/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java b/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java index 4b9cd7b..9ba1321 100644 --- a/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java +++ b/src/main/java/com/mojang/brigadier/context/CommandContextBuilder.java @@ -55,7 +55,7 @@ public class CommandContextBuilder { public CommandContextBuilder copy() { final CommandContextBuilder copy = new CommandContextBuilder<>(dispatcher, source); copy.command = this.command; - arguments.forEach((k, v) -> copy.arguments.put(k, v.copy())); + copy.arguments.putAll(arguments); copy.nodes.putAll(this.nodes); copy.input.append(input); return copy; diff --git a/src/main/java/com/mojang/brigadier/context/ParsedArgument.java b/src/main/java/com/mojang/brigadier/context/ParsedArgument.java index bfe5b88..b97809c 100644 --- a/src/main/java/com/mojang/brigadier/context/ParsedArgument.java +++ b/src/main/java/com/mojang/brigadier/context/ParsedArgument.java @@ -37,7 +37,4 @@ public class ParsedArgument { return result; } - public ParsedArgument copy() { - return new ParsedArgument<>(raw, result); - } } diff --git a/src/test/java/com/mojang/brigadier/context/ParsedArgumentTest.java b/src/test/java/com/mojang/brigadier/context/ParsedArgumentTest.java index 86be285..349e6d7 100644 --- a/src/test/java/com/mojang/brigadier/context/ParsedArgumentTest.java +++ b/src/test/java/com/mojang/brigadier/context/ParsedArgumentTest.java @@ -16,10 +16,4 @@ public class ParsedArgumentTest { .addEqualityGroup(new ParsedArgument<>("foo", "baz"), new ParsedArgument<>("foo", "baz")) .testEquals(); } - - @Test - public void copy() throws Exception { - final ParsedArgument argument = new ParsedArgument<>("foo", "bar"); - assertThat(argument.copy(), is(equalTo(argument))); - } } \ No newline at end of file