13
0
geforkt von Mirrors/Velocity

Suspect this is the fix to #203, but I'm unsure

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-10 04:53:57 -04:00
Ursprung c26dc75c44
Commit 74afcee9ba
2 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@ import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.JoinGame; import com.velocitypowered.proxy.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.protocol.packet.PluginMessage;
import com.velocitypowered.proxy.protocol.util.PluginMessageUtil;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -134,6 +135,14 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
return true; return true;
} }
// We need to specially handle REGISTER and UNREGISTER packets. Later on, we'll write them to
// the client.
if (PluginMessageUtil.isRegister(packet)) {
serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
} else if (PluginMessageUtil.isUnregister(packet)) {
serverConn.getPlayer().getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet));
}
// We always need to handle plugin messages, for Forge compatibility. // We always need to handle plugin messages, for Forge compatibility.
if (serverConn.getPhase().handle(serverConn, serverConn.getPlayer(), packet)) { if (serverConn.getPhase().handle(serverConn, serverConn.getPlayer(), packet)) {
// Handled, but check the server connection phase. // Handled, but check the server connection phase.

Datei anzeigen

@ -44,6 +44,9 @@ class CappedCollectionTest {
assertTrue(coll.addAll(doesFill2), "did not add items"); assertTrue(coll.addAll(doesFill2), "did not add items");
assertThrows(IllegalStateException.class, () -> coll.addAll(overfill), assertThrows(IllegalStateException.class, () -> coll.addAll(overfill),
"items added to collection although it is too full"); "items added to collection although it is too full");
assertFalse(coll.addAll(doesFill1), "added items?!?");
assertEquals(3, coll.size(), "collection grew in size unexpectedly"); assertEquals(3, coll.size(), "collection grew in size unexpectedly");
} }
} }