Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
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 -> {
|
.thenAcceptAsync(pme -> {
|
||||||
if (pme.getResult().isAllowed() && !playerConnection.isClosed()) {
|
if (pme.getResult().isAllowed() && !playerConnection.isClosed()) {
|
||||||
PluginMessage copied = new PluginMessage(packet.getChannel(),
|
PluginMessage copied = new PluginMessage(packet.getChannel(),
|
||||||
Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(copy)));
|
Unpooled.wrappedBuffer(copy));
|
||||||
playerConnection.write(copied);
|
playerConnection.write(copied);
|
||||||
}
|
}
|
||||||
}, playerConnection.eventLoop())
|
}, playerConnection.eventLoop())
|
||||||
|
@ -225,12 +225,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
backendConn.write(packet.retain());
|
backendConn.write(packet.retain());
|
||||||
} else {
|
} else {
|
||||||
byte[] copy = ByteBufUtil.getBytes(packet.content());
|
byte[] copy = ByteBufUtil.getBytes(packet.content());
|
||||||
PluginMessageEvent event = new PluginMessageEvent(player, serverConn, id,
|
PluginMessageEvent event = new PluginMessageEvent(player, serverConn, id, copy);
|
||||||
ByteBufUtil.getBytes(packet.content()));
|
|
||||||
server.getEventManager().fire(event).thenAcceptAsync(pme -> {
|
server.getEventManager().fire(event).thenAcceptAsync(pme -> {
|
||||||
if (pme.getResult().isAllowed()) {
|
if (pme.getResult().isAllowed()) {
|
||||||
PluginMessage message = new PluginMessage(packet.getChannel(),
|
PluginMessage message = new PluginMessage(packet.getChannel(),
|
||||||
Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(copy)));
|
Unpooled.wrappedBuffer(copy));
|
||||||
backendConn.write(message);
|
backendConn.write(message);
|
||||||
}
|
}
|
||||||
}, backendConn.eventLoop())
|
}, backendConn.eventLoop())
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren