Welcome to MaxCheaters.com

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Code Fix for aCis login issue from server machine


Recommended Posts

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));
 		}

 

  • Upvote 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.