Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Improve backwards-compatibility with 1.0.x due to RawCommand changes
Dieser Commit ist enthalten in:
Ursprung
6d2e1bf379
Commit
8bf9e0e829
@ -1,7 +1,6 @@
|
|||||||
package com.velocitypowered.proxy.command;
|
package com.velocitypowered.proxy.command;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.velocitypowered.api.command.Command;
|
import com.velocitypowered.api.command.Command;
|
||||||
@ -158,28 +157,32 @@ public class VelocityCommandManager implements CommandManager {
|
|||||||
|
|
||||||
private static class RegularCommandWrapper implements RawCommand {
|
private static class RegularCommandWrapper implements RawCommand {
|
||||||
|
|
||||||
private static final Splitter ARGS_SPLITTER = Splitter.on(' ').omitEmptyStrings();
|
|
||||||
private final Command delegate;
|
private final Command delegate;
|
||||||
|
|
||||||
private RegularCommandWrapper(Command delegate) {
|
private RegularCommandWrapper(Command delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String[] split(String line) {
|
||||||
|
if (line.isEmpty()) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
return line.split(" ", -1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSource source, String commandLine) {
|
public void execute(CommandSource source, String commandLine) {
|
||||||
delegate.execute(source, ARGS_SPLITTER.splitToList(commandLine).toArray(new String[0]));
|
delegate.execute(source, split(commandLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> suggest(CommandSource source, String currentLine) {
|
public List<String> suggest(CommandSource source, String currentLine) {
|
||||||
return delegate.suggest(source, ARGS_SPLITTER.splitToList(currentLine)
|
return delegate.suggest(source, split(currentLine));
|
||||||
.toArray(new String[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(CommandSource source, String commandLine) {
|
public boolean hasPermission(CommandSource source, String commandLine) {
|
||||||
return delegate.hasPermission(source, ARGS_SPLITTER.splitToList(commandLine)
|
return delegate.hasPermission(source, split(commandLine));
|
||||||
.toArray(new String[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RawCommand wrap(Command command) {
|
static RawCommand wrap(Command command) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren