Devlin 19 Posted December 18, 2020 Posted December 18, 2020 Hey there! Referring to aCis project, I noticed an issue that if you open a public server from your PC, other players can join but you can't join from the machine that you are running the server (as localhost). Here is the quick fix about that issue, --- a/aCis_gameserver/java/net/sf/l2j/loginserver/network/serverpackets/ServerList.java +++ b/aCis_gameserver/java/net/sf/l2j/loginserver/network/serverpackets/ServerList.java @@ -22,10 +22,13 @@ { _lastServer = client.getLastServer(); + String clientIp = client.getConnection().getInetAddress().getHostAddress(); + boolean isLocalhost = clientIp.equals("127.0.0.1"); + for (GameServerInfo gsi : GameServerManager.getInstance().getRegisteredGameServers().values()) { final StatusType status = (client.getAccessLevel() < 0 || (gsi.getStatus() == StatusType.GM_ONLY && client.getAccessLevel() <= 0)) ? StatusType.DOWN : gsi.getStatus(); - final String hostName = gsi.getHostName(); + final String hostName = isLocalhost ? "127.0.0.1" : gsi.getHostName(); _servers.add(new ServerData(status, hostName, gsi)); } 1 Quote Share this post Link to post Share on other sites
Rootware 118 Posted December 18, 2020 Posted December 18, 2020 Use this code for detecting all local network addresses: public static boolean isLocalResourceByIp(InetAddress address) { if (address == null || address.isLinkLocalAddress() || address.isLoopbackAddress() || address.isAnyLocalAddress() || address.isSiteLocalAddress()) return true; return false; } Otherwise if you try to connect from other local machine you will have fault. Quote Share this post Link to post Share on other sites
HaddWik 0 Posted January 22 Posted January 22 Here is code adapted to 397 https://pastebin.com/tR05rrhN Quote Share this post Link to post Share on other sites
Stive 1 Posted Thursday at 08:52 PM Posted Thursday at 08:52 PM On 1/22/2021 at 10:23 PM, HaddWik said: Here is code adapted to 397 https://pastebin.com/tR05rrhN You are back in l2 scene? Quote Share this post Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.