3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Fix plugin message forwarding from server to client.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-11-07 01:28:24 -05:00
Ursprung 73e3e1752a
Commit 762d9a3efb

Datei anzeigen

@ -84,11 +84,6 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(PluginMessage packet) { public boolean handle(PluginMessage packet) {
MinecraftConnection smc = serverConn.getConnection();
if (smc == null) {
return true;
}
if (!canForwardPluginMessage(packet)) { if (!canForwardPluginMessage(packet)) {
return true; return true;
} }
@ -117,14 +112,15 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
return false; return false;
} }
MinecraftConnection clientConn = serverConn.getPlayer().getConnection();
PluginMessageEvent event = new PluginMessageEvent(serverConn, serverConn.getPlayer(), id, PluginMessageEvent event = new PluginMessageEvent(serverConn, serverConn.getPlayer(), id,
packet.getData()); packet.getData());
server.getEventManager().fire(event) server.getEventManager().fire(event)
.thenAcceptAsync(pme -> { .thenAcceptAsync(pme -> {
if (pme.getResult().isAllowed() && serverConn.isActive()) { if (pme.getResult().isAllowed() && !clientConn.isClosed()) {
smc.write(packet); clientConn.write(packet);
} }
}, smc.eventLoop()); }, clientConn.eventLoop());
return true; return true;
} }