From 7da0ba0016205479bd327362af9312dedbb92071 Mon Sep 17 00:00:00 2001 From: harry-xi Date: Thu, 31 Oct 2024 16:55:07 +0800 Subject: [PATCH] fix: Fix command RemainArgNode default value type --- .../main/java/org/allaymc/api/command/tree/CommandNode.java | 2 +- .../java/org/allaymc/api/command/tree/CommandNodeFactory.java | 2 +- .../allaymc/server/command/tree/AllayCommandNodeFactory.java | 2 +- .../org/allaymc/server/command/tree/node/RemainArgNode.java | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/allaymc/api/command/tree/CommandNode.java b/api/src/main/java/org/allaymc/api/command/tree/CommandNode.java index 2b57c40fd..1bd4d1dda 100644 --- a/api/src/main/java/org/allaymc/api/command/tree/CommandNode.java +++ b/api/src/main/java/org/allaymc/api/command/tree/CommandNode.java @@ -615,7 +615,7 @@ default CommandNode remain(String name) { * * @return This {@code CommandNode}. */ - default CommandNode remain(String name, Object defaultValue) { + default CommandNode remain(String name, List defaultValue) { return addLeaf(getFactory().remain(name, this, defaultValue)); } diff --git a/api/src/main/java/org/allaymc/api/command/tree/CommandNodeFactory.java b/api/src/main/java/org/allaymc/api/command/tree/CommandNodeFactory.java index 6fa8b604c..dec9bac89 100644 --- a/api/src/main/java/org/allaymc/api/command/tree/CommandNodeFactory.java +++ b/api/src/main/java/org/allaymc/api/command/tree/CommandNodeFactory.java @@ -191,7 +191,7 @@ static CommandNodeFactory getFactory() { * * @return a new {@code CommandNode} for the remaining arguments. */ - CommandNode remain(String name, CommandNode parent, Object defaultValue); + CommandNode remain(String name, CommandNode parent, List defaultValue); /** * Creates a command node for a target argument that allows selecting multiple entities. diff --git a/server/src/main/java/org/allaymc/server/command/tree/AllayCommandNodeFactory.java b/server/src/main/java/org/allaymc/server/command/tree/AllayCommandNodeFactory.java index 3e01ae710..b19266390 100644 --- a/server/src/main/java/org/allaymc/server/command/tree/AllayCommandNodeFactory.java +++ b/server/src/main/java/org/allaymc/server/command/tree/AllayCommandNodeFactory.java @@ -87,7 +87,7 @@ public CommandNode msg(String name, CommandNode parent, String defaultValue) { } @Override - public CommandNode remain(String name, CommandNode parent, Object defaultValue) { + public CommandNode remain(String name, CommandNode parent, List defaultValue) { return new RemainArgNode(name, parent, defaultValue); } diff --git a/server/src/main/java/org/allaymc/server/command/tree/node/RemainArgNode.java b/server/src/main/java/org/allaymc/server/command/tree/node/RemainArgNode.java index fba76e0a7..1e039dbf5 100644 --- a/server/src/main/java/org/allaymc/server/command/tree/node/RemainArgNode.java +++ b/server/src/main/java/org/allaymc/server/command/tree/node/RemainArgNode.java @@ -7,12 +7,13 @@ import org.cloudburstmc.protocol.bedrock.data.command.CommandParamData; import java.util.ArrayList; +import java.util.List; /** * @author daoge_cmd */ public class RemainArgNode extends BaseNode { - public RemainArgNode(String name, CommandNode parent, Object defaultValue) { + public RemainArgNode(String name, CommandNode parent, List defaultValue) { super(name, parent, defaultValue); }