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

Unbreak Forge logic.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-10-05 19:04:10 -04:00
Ursprung d59c8874b7
Commit 222e90a9f0

Datei anzeigen

@ -94,22 +94,22 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
serverConn.getPlayer().sendLegacyForgeHandshakeResetPacket(); serverConn.getPlayer().sendLegacyForgeHandshakeResetPacket();
} }
// Always forward these messages during login // Always forward these messages during login. Don't pass it onto the handleGeneric below.
return false; return false;
} }
ChannelIdentifier id = server.getChannelRegistrar().getFromId(packet.getChannel()); ChannelIdentifier id = server.getChannelRegistrar().getFromId(packet.getChannel());
if (id == null) { if (id == null) {
serverConn.getPlayer().getConnection().write(packet); return false;
} else {
PluginMessageEvent event = new PluginMessageEvent(serverConn, serverConn.getPlayer(), id, packet.getData());
server.getEventManager().fire(event)
.thenAcceptAsync(pme -> {
if (pme.getResult().isAllowed()) {
serverConn.getPlayer().getConnection().write(packet);
}
}, serverConn.getConnection().eventLoop());
} }
PluginMessageEvent event = new PluginMessageEvent(serverConn, serverConn.getPlayer(), id, packet.getData());
server.getEventManager().fire(event)
.thenAcceptAsync(pme -> {
if (pme.getResult().isAllowed()) {
serverConn.getPlayer().getConnection().write(packet);
}
}, serverConn.getConnection().eventLoop());
return true; return true;
} }
@ -134,10 +134,8 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
return; return;
} }
if (serverConn.hasCompletedJoin()) { // Just forward the packet on. We don't have anything to handle at this time.
// Just forward the packet on. We don't have anything to handle at this time. serverConn.getPlayer().getConnection().write(packet);
serverConn.getPlayer().getConnection().write(packet);
}
} }
@Override @Override
@ -149,9 +147,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
return; return;
} }
if (serverConn.hasCompletedJoin()) { serverConn.getPlayer().getConnection().write(buf.retain());
serverConn.getPlayer().getConnection().write(buf.retain());
}
} }
@Override @Override