Skip to content

Commit 19c0bf1

Browse files
throw error if VIAaaS tries to connect to itself
1 parent 5d57b8c commit 19c0bf1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/main/kotlin/com/viaversion/aas/handler/state/LoginState.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,18 @@ class LoginState : ConnectionState {
5757
is SetCompression -> handleCompression(handler, packet)
5858
is LoginAck -> handleLoginAck(handler, packet)
5959
is UnknownPacket -> throw StacklessException("unknown packet ${packet.id}")
60+
is PluginRequest -> handlePluginRequest(handler, packet)
6061
else -> forward(handler, packet)
6162
}
6263
}
6364

65+
private fun handlePluginRequest(handler: MinecraftHandler, packet: PluginRequest) {
66+
if (packet.channel == "oam:join") {
67+
throw StacklessException("VIAaaS connection loop detected")
68+
}
69+
forward(handler, packet)
70+
}
71+
6472
private fun handleLoginAck(handler: MinecraftHandler, packet: LoginAck) {
6573
handler.data.setBothStates(ConfigurationState())
6674
forward(handler, packet)

0 commit comments

Comments
 (0)