Jump to content

Get latest visited server or server list


TheASTRO

Recommended Posts

You can make a new instance of ServerList using the Minecraft class (AKA client-side-only), and call the ServerData#loadServerList method, which will read the servers into a List<ServerData>. ServerData has multiple methods to get/remove/modify the List<ServerData>.

 

This might not be the best way to do it, I couldn't find a better way in the little time I spend researching.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

45 minutes ago, larsgerrits said:

You can make a new instance of ServerList using the Minecraft class (AKA client-side-only), and call the ServerData#loadServerList method, which will read the servers into a List<ServerData>. ServerData has multiple methods to get/remove/modify the List<ServerData>.

 

This might not be the best way to do it, I couldn't find a better way in the little time I spend researching.

 

How can I make that instance? I surfed the internet, but I found nothing. If you can-please, help with this :3

Link to comment
Share on other sites

new ServerList?

Edited by larsgerrits

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Yes, the constructor of ServerList takes an instance of the Minecraft class, which you can get using Minecraft.getMinecraft().

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

3 minutes ago, larsgerrits said:

Yes, the constructor of ServerList takes an instance of the Minecraft class, which you can get using Minecraft.getMinecraft().

 

Holy, I am so stupid even in this simple part of code. Sorry again. So I`ve typed this:

Minecraft mc = Minecraft.getMinecraft();

What I have to do next?

Link to comment
Share on other sites

15 hours ago, larsgerrits said:

call the ServerData#loadServerList method, which will read the servers into a List<ServerData>. ServerData has multiple methods to get/remove/modify the List<ServerData>.

 
 

ServerData contains the name, IP and other information about a server.

Edited by larsgerrits

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

4 hours ago, larsgerrits said:

ServerData contains the name, IP and other information about a server.

@larsgerrits

void getServers() {
  ServerList list = new ServerList(Minecraft.getMinecraft());
  list.loadServerList();
}

Is that correct on this point? What must I do next? Sorry for being stupid... You wrote about ServerData. How can I call it? Can`t get it at all...

Link to comment
Share on other sites

If you look at the class, you can see all the methods you can call on it, including ways to get an instance of ServerData (ServerList#getServerData(index)). 

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.