geforkt von Mirrors/Velocity
Avoid unneeded copy in BackendPlaySessionHandler plugin messages
Dieser Commit ist enthalten in:
Ursprung
8a3b6403da
Commit
d51f357fa8
@ -146,7 +146,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
||||
.thenAcceptAsync(pme -> {
|
||||
if (pme.getResult().isAllowed() && !playerConnection.isClosed()) {
|
||||
PluginMessage copied = new PluginMessage(packet.getChannel(),
|
||||
Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(copy)));
|
||||
Unpooled.wrappedBuffer(copy));
|
||||
playerConnection.write(copied);
|
||||
}
|
||||
}, playerConnection.eventLoop())
|
||||
|
@ -225,12 +225,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
backendConn.write(packet.retain());
|
||||
} else {
|
||||
byte[] copy = ByteBufUtil.getBytes(packet.content());
|
||||
PluginMessageEvent event = new PluginMessageEvent(player, serverConn, id,
|
||||
ByteBufUtil.getBytes(packet.content()));
|
||||
PluginMessageEvent event = new PluginMessageEvent(player, serverConn, id, copy);
|
||||
server.getEventManager().fire(event).thenAcceptAsync(pme -> {
|
||||
if (pme.getResult().isAllowed()) {
|
||||
PluginMessage message = new PluginMessage(packet.getChannel(),
|
||||
Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(copy)));
|
||||
Unpooled.wrappedBuffer(copy));
|
||||
backendConn.write(message);
|
||||
}
|
||||
}, backendConn.eventLoop())
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren