crewpvp / skcrew

Skript addon contains favorite addons and something more
https://skcrew.crewpvp.xyz/en
GNU General Public License v3.0
15 stars 1 forks source link

Fix ClassCastException in SocketClientListener #19

Closed MiguVT closed 5 months ago

MiguVT commented 5 months ago

Resolved the ClassCastException that was occurring in the SocketClientListener class. The issue was due to an incorrect type being passed to the SpigotServer constructor. The correct InetSocketAddress is now being passed, eliminating the error.

Lotzyprod commented 5 months ago

I don’t really understand what has changed, entry.getKey() returns BaseServer anyway

MiguVT commented 5 months ago

You're correct that entry.getKey() returns a BaseServer. The change was not about what entry.getKey() returns, but rather about how we use it. In the previous version, there was a type mismatch issue causing a ClassCastException. The updated code ensures that we are correctly creating a SpigotServer instance using the BaseServer details. This is done by correctly passing the InetSocketAddress from baseServer.getInetSocketAddress() to the SpigotServer constructor, which was the main cause of the issue.