Jump to content

How to get all server players?


Edska

Recommended Posts

Hello.

 

How can I get all my server players? Corrently logged in and offline players. This line return an array of the usernames of all the connected players:

 

MinecraftServer.getServer().getAllUsernames();

 

I need to get all players from my server not only connected at that time.

Link to comment
Share on other sites

Hi,

you could get the player save file names.

 

try something like

MinecraftServer.getServer().getWorldProvider(0).getSaveLocation()

that should give you the location of the world save folder, inside there should be the player saves (i dont know if those are the exact function names, but you should find them).

that should work for multiplayer. i dont know how different the sp save folder looks.

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.