3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

rebased on master

Dieser Commit ist enthalten in:
creeper123123321 2020-06-30 16:06:05 -03:00 committet von Five (Xer)
Ursprung 4813cc3077
Commit 6c3479e739
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F306B10E6330E7
4 geänderte Dateien mit 8 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -26,11 +26,7 @@ import us.myles.ViaVersion.util.GsonUtil;
import us.myles.ViaVersion.velocity.VersionInfo;
import us.myles.ViaVersion.velocity.command.VelocityCommandHandler;
import us.myles.ViaVersion.velocity.command.VelocityCommandSender;
import us.myles.ViaVersion.velocity.platform.VelocityTaskId;
import us.myles.ViaVersion.velocity.platform.VelocityViaAPI;
import us.myles.ViaVersion.velocity.platform.VelocityViaConfig;
import us.myles.ViaVersion.velocity.platform.VelocityViaInjector;
import us.myles.ViaVersion.velocity.platform.VelocityViaLoader;
import us.myles.ViaVersion.velocity.platform.*;
import us.myles.ViaVersion.velocity.service.ProtocolDetectorService;
import us.myles.ViaVersion.velocity.util.LoggerWrapper;

Datei anzeigen

@ -34,14 +34,14 @@ public class VelocityDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
ByteBuf transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
try {
boolean needsCompress = handleCompressionOrder(ctx, draft);
boolean needsCompress = handleCompressionOrder(ctx, bytebuf);
info.transformIncoming(draft, CancelDecoderException::generate);
info.transformIncoming(bytebuf, CancelDecoderException::generate);
if (needsCompress) {
recompress(ctx, draft);
recompress(ctx, bytebuf);
}
out.add(draft.retain());
out.add(bytebuf.retain());
} finally {
transformedBuf.release();
}

Datei anzeigen

@ -46,7 +46,7 @@ public class VelocityEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
}
}
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf draft) throws InvocationTargetException {
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf buf) throws InvocationTargetException {
//if (handledCompression) return false;
int encoderIndex = ctx.pipeline().names().indexOf("compression-encoder");

Datei anzeigen

@ -1,33 +1,11 @@
package us.myles.ViaVersion.velocity.platform;
import io.netty.channel.ServerChannel;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.platform.ViaConnectionManager;
import java.util.Objects;
public class VelocityConnectionManager extends ViaConnectionManager {
@Override
public void onLoginSuccess(UserConnection connection) {
if (connection.isClientSide()) {
System.out.println("backend connect!");
Objects.requireNonNull(connection, "connection is null!");
connections.add(connection);
} else {
System.out.println("frontend connect!");
super.onLoginSuccess(connection);
}
}
@Override
public void onDisconnect(UserConnection connection) {
if (connection.isClientSide()) {
System.out.println("backend disconnect!");
Objects.requireNonNull(connection, "connection is null!");
connections.remove(connection);
} else {
System.out.println("frontend disconnect!");
super.onDisconnect(connection);
}
public boolean isFrontEnd(UserConnection conn) {
return !conn.isClientSide();
}
}