Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
Let the normal send go through the event loop. Fix signs are sent before the chunks on a 1.9.4 server with a 1.9-1.9.2 client (#460)
Dieser Commit ist enthalten in:
Ursprung
d164e413c2
Commit
87b1919863
@ -282,8 +282,22 @@ public class PacketWrapper {
|
|||||||
* @param skipCurrentPipeline - Skip the current pipeline
|
* @param skipCurrentPipeline - Skip the current pipeline
|
||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public ChannelFuture send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline) throws Exception {
|
public void send(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline) throws Exception {
|
||||||
if (!isCancelled()) {
|
if (!isCancelled()) {
|
||||||
|
ByteBuf output = constructPacket(packetProtocol, skipCurrentPipeline);
|
||||||
|
user().sendRawPacket(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Let the packet go through the protocol pipes and write it to ByteBuf
|
||||||
|
*
|
||||||
|
* @param packetProtocol - The protocol version of the packet.
|
||||||
|
* @param skipCurrentPipeline - Skip the current pipeline
|
||||||
|
* @return Packet buffer
|
||||||
|
* @throws Exception if it fails to write
|
||||||
|
*/
|
||||||
|
private ByteBuf constructPacket(Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline) throws Exception {
|
||||||
// Apply current pipeline
|
// Apply current pipeline
|
||||||
List<Protocol> protocols = new ArrayList<>(user().get(ProtocolInfo.class).getPipeline().pipes());
|
List<Protocol> protocols = new ArrayList<>(user().get(ProtocolInfo.class).getPipeline().pipes());
|
||||||
// Other way if outgoing
|
// Other way if outgoing
|
||||||
@ -304,9 +318,8 @@ public class PacketWrapper {
|
|||||||
// Send
|
// Send
|
||||||
ByteBuf output = inputBuffer == null ? Unpooled.buffer() : inputBuffer.alloc().buffer();
|
ByteBuf output = inputBuffer == null ? Unpooled.buffer() : inputBuffer.alloc().buffer();
|
||||||
writeToBuffer(output);
|
writeToBuffer(output);
|
||||||
return user().sendRawPacketFuture(output);
|
|
||||||
}
|
return output;
|
||||||
return user().getChannel().newFailedFuture(new Exception("Cancelled packet"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -332,7 +345,11 @@ public class PacketWrapper {
|
|||||||
* @throws Exception if it fails to write
|
* @throws Exception if it fails to write
|
||||||
*/
|
*/
|
||||||
public ChannelFuture sendFuture(Class<? extends Protocol> packetProtocol) throws Exception {
|
public ChannelFuture sendFuture(Class<? extends Protocol> packetProtocol) throws Exception {
|
||||||
return send(packetProtocol, true);
|
if (!isCancelled()) {
|
||||||
|
ByteBuf output = constructPacket(packetProtocol, true);
|
||||||
|
return user().sendRawPacketFuture(output);
|
||||||
|
}
|
||||||
|
return user().getChannel().newFailedFuture(new Exception("Cancelled packet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren