13
0
geforkt von Mirrors/Velocity

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