mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 04:46:37 +00:00
refactor(network): 重构发送包方法以便全部阶段都可发送包
This commit is contained in:
@@ -302,7 +302,7 @@ public class BukkitServerPlayer extends Player {
|
||||
dataPayload = Reflections.constructor$DiscardedPayload.newInstance(channelKey, Unpooled.wrappedBuffer(data));
|
||||
}
|
||||
Object responsePacket = Reflections.constructor$ClientboundCustomPayloadPacket.newInstance(dataPayload);
|
||||
this.nettyChannel().writeAndFlush(responsePacket, true);
|
||||
this.sendPacket(responsePacket, true);
|
||||
} catch (Exception e) {
|
||||
CraftEngine.instance().logger().warn("Failed to send custom payload to " + name(), e);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ public class BukkitServerPlayer extends Player {
|
||||
try {
|
||||
Object reason = ComponentUtils.adventureToMinecraft(message);
|
||||
Object kickPacket = Reflections.constructor$ClientboundDisconnectPacket.newInstance(reason);
|
||||
this.nettyChannel().writeAndFlush(kickPacket, true);
|
||||
this.sendPacket(kickPacket, true);
|
||||
this.nettyChannel().disconnect();
|
||||
} catch (Exception e) {
|
||||
CraftEngine.instance().logger().warn("Failed to kick " + name(), e);
|
||||
|
||||
Reference in New Issue
Block a user