You are browsing as a guest. Sign up (or log in) to start making projects!

5h 44m 52s logged

Monicraft - Player Manager, NBT Parsing & More :python:


It’s been a few long session with alot of thinking and implementing:nvs: . I never thought that getting the online players would be so hard. At first, I wanted to use minecraft’s list command and then parse the output from the terminal, but that was way too hard and would not work on big servers with terminals full of commands. So I decided to use the mcstatus library to get a list of all online players. This is done by:

  1. Sending a query to the server.
  2. If queries are disabled on the server or the query simply fails, it sends a normal status request (server list ping) to the server.

I then use the name to get the UUID of a player stored in the usercache.json file in the root directory of every minecraft server. That UUID is then used to get the saved {UUID}.dat file in the worlds folder. All the player’s data (e.g. health, hunger, position, gamemode, etc.) is stored in there. This brings the restriction of the server’s autosave time (which is 5 minutes by default). So I’ve also added a refresh button which saves the game and updates the player list. The player list is automatically updated every ten seconds and based off the lastest safe file.


New Features:

  • Player Manager: A way to see all online players and their statistics. You can also kick and ban people by just selecting them and clicking a button.

Future Plans:

  • Adding the functionality to toggle the visibility of offline players in the player list.
  • Adding functionality to the following buttons: Stats, Message, Gamemode
  • Adding a player stats screen (viewed by clicking the stats button) which shows all the statistics of a single player (e.g. mobs killed, blocks broken, distance ran, etc.)
0
35

Comments 0

No comments yet. Be the first!