Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit 924c477

Browse files
committed
🐛 Fix joined arguments
1 parent fffdc8f commit 924c477

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/fr/bakaaless/api/command/CommandManager.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
4343
if (concatenateArgs.getFirst()) {
4444
if (arg.endsWith("\"") && !arg.endsWith("\\\"") && concatenateArgs.getSecond().equalsIgnoreCase("\"")) {
4545
concatenateArgs = Pair.from(false, "");
46-
builder.append(" ").append(arg, 0, arg.length() - 1).append(",");
46+
builder.append(" ").append(arg, 0, arg.length() - 1).append("\n");
4747
} else if (arg.endsWith("'") && !arg.endsWith("\\'") && concatenateArgs.getSecond().equalsIgnoreCase("'")) {
4848
concatenateArgs = Pair.from(false, "");
49-
builder.append(" ").append(arg, 0, arg.length() - 1).append(",");
49+
builder.append(" ").append(arg, 0, arg.length() - 1).append("\n");
5050
} else
5151
builder.append(" ").append(arg);
5252
} else {
@@ -57,15 +57,15 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
5757
concatenateArgs = Pair.from(true, "'");
5858
builder.append(arg.substring(1));
5959
} else
60-
builder.append(arg).append(",");
60+
builder.append(arg).append("\n");
6161

6262
}
6363
}
6464

6565
String argument = "";
6666
if (rawArgs.length() > 0) {
6767
rawArgs.deleteCharAt(0);
68-
argument = (builder.charAt(builder.length() - 1) == ',' ? builder.deleteCharAt(builder.length() - 1).toString() : builder.toString());
68+
argument = (builder.charAt(builder.length() - 1) == '\n' ? builder.deleteCharAt(builder.length() - 1).toString() : builder.toString()).replace("\\\"", "\"");
6969
}
7070

7171
String containsCommand = "";
@@ -95,7 +95,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
9595
continue;
9696
for (final String aliases : annotation.subCommand()) {
9797

98-
if (!argument.toLowerCase().startsWith(aliases.replace(" ", ",").toLowerCase()))
98+
if (!argument.toLowerCase().startsWith(aliases.replace(" ", "\n").toLowerCase()))
9999
continue;
100100

101101
if (isCommandInExec) {
@@ -149,12 +149,12 @@ else if (toExec.getSecond().length() < aliases.length())
149149
}
150150
}
151151

152-
final String finalArg = argument.replace(toExec.getSecond().replace(" ", ","), "")
153-
.replaceFirst("[,]", "");
152+
final String finalArg = argument.replace(toExec.getSecond().replace(" ", "\n"), "")
153+
.replaceFirst("[\n]", "");
154154

155155
final List<String> arguments = (finalArg.equals("") ?
156156
new ArrayList<>() :
157-
new ArrayList<>(Arrays.asList(finalArg.split(",")))
157+
new ArrayList<>(Arrays.asList(finalArg.split("\n")))
158158
);
159159

160160
if (arguments.size() >= argumentSize) {

0 commit comments

Comments
 (0)