diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommandManager.java b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommandManager.java index bb9ae8b6b..9a2c2f008 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommandManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommandManager.java @@ -1,6 +1,7 @@ package com.velocitypowered.proxy.command; import com.google.common.base.Preconditions; +import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.velocitypowered.api.command.Command; @@ -157,6 +158,7 @@ public class VelocityCommandManager implements CommandManager { private static class RegularCommandWrapper implements RawCommand { + private static final Splitter ARGS_SPLITTER = Splitter.on(' ').omitEmptyStrings(); private final Command delegate; private RegularCommandWrapper(Command delegate) { @@ -165,17 +167,19 @@ public class VelocityCommandManager implements CommandManager { @Override public void execute(CommandSource source, String commandLine) { - delegate.execute(source, commandLine.split(" ", -1)); + delegate.execute(source, ARGS_SPLITTER.splitToList(commandLine).toArray(new String[0])); } @Override public List suggest(CommandSource source, String currentLine) { - return delegate.suggest(source, currentLine.split(" ", -1)); + return delegate.suggest(source, ARGS_SPLITTER.splitToList(currentLine) + .toArray(new String[0])); } @Override public boolean hasPermission(CommandSource source, String commandLine) { - return delegate.hasPermission(source, commandLine.split(" ", -1)); + return delegate.hasPermission(source, ARGS_SPLITTER.splitToList(commandLine) + .toArray(new String[0])); } static RawCommand wrap(Command command) { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java index 6f32e7ad1..b8d7ed75f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java @@ -167,7 +167,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler { return true; } - serverConn.getPlayer().getMinecraftConnection().write(packet); + serverConn.getPlayer().getMinecraftConnection().write(packet.retain()); return true; } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialConnectSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialConnectSessionHandler.java index 59c2e9255..1d1485ef8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialConnectSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialConnectSessionHandler.java @@ -26,7 +26,7 @@ public class InitialConnectSessionHandler implements MinecraftSessionHandler { } else if (PluginMessageUtil.isUnregister(packet)) { player.getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet)); } - serverConn.ensureConnected().write(packet); + serverConn.ensureConnected().write(packet.retain()); } return true; }