mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-11-21 11:35:16 +01:00
Update ViaVersion, try to fix UserConnection#sendRawPacket
This commit is contained in:
parent
53be441e01
commit
2f0ea9d55e
@ -36,7 +36,7 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shade ('us.myles:viaversion:1.4.1') { transitive = false }
|
||||
shade ('us.myles:viaversion:1.4.2-SNAPSHOT') { transitive = false }
|
||||
implementation 'org.dimdev:mixin:0.7.11-SNAPSHOT'
|
||||
compile 'org.dimdev.rift:Rift:1.0.1:dev'
|
||||
}
|
||||
|
@ -37,17 +37,19 @@ public class VRInHandler extends ByteToMessageDecoder {
|
||||
// Transform
|
||||
ByteBuf newPacket = msg.alloc().buffer();
|
||||
|
||||
try {
|
||||
PacketWrapper wrapper = new PacketWrapper(id, msg, user);
|
||||
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
|
||||
protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper);
|
||||
wrapper.writeToBuffer(newPacket);
|
||||
msg = newPacket;
|
||||
} catch (Exception e) {
|
||||
if (!(e instanceof CancelException))
|
||||
e.printStackTrace();
|
||||
msg.clear();
|
||||
throw e;
|
||||
if (id != PacketWrapper.PASSTHROUGH_ID) {
|
||||
try {
|
||||
PacketWrapper wrapper = new PacketWrapper(id, msg, user);
|
||||
ProtocolInfo protInfo = user.get(ProtocolInfo.class);
|
||||
protInfo.getPipeline().transform(Direction.OUTGOING, protInfo.getState(), wrapper);
|
||||
wrapper.writeToBuffer(newPacket);
|
||||
msg = newPacket;
|
||||
} catch (Exception e) {
|
||||
if (!(e instanceof CancelException))
|
||||
e.printStackTrace();
|
||||
msg.clear();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import io.netty.channel.socket.SocketChannel;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.util.PipelineUtil;
|
||||
|
||||
|
||||
public class VRUserConnection extends UserConnection {
|
||||
@ -28,14 +29,14 @@ public class VRUserConnection extends UserConnection {
|
||||
final Channel channel = this.getChannel();
|
||||
if (currentThread) {
|
||||
try {
|
||||
channel.pipeline().context("decoder").fireChannelRead(copy);
|
||||
PipelineUtil.getContextBefore("decoder", channel.pipeline()).fireChannelRead(copy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
channel.eventLoop().submit(() -> {
|
||||
try {
|
||||
channel.pipeline().context("decoder").fireChannelRead(copy);
|
||||
PipelineUtil.getContextBefore("decoder", channel.pipeline()).fireChannelRead(copy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -55,7 +56,7 @@ public class VRUserConnection extends UserConnection {
|
||||
packet.release();
|
||||
final Channel channel = this.getChannel();
|
||||
try {
|
||||
channel.pipeline().context("decoder").fireChannelRead(copy);
|
||||
PipelineUtil.getContextBefore("decoder", channel.pipeline()).fireChannelRead(copy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user