Edenhofer / minecraft-server

Control Script for Minecraft Servers
45 stars 10 forks source link

Is attempting to use the "idle" option doing anything? #12

Open Xarius86 opened 1 year ago

Xarius86 commented 1 year ago

I have netcat installed, and I see the results of the script checking for online players routinely:

> list
[20:53:07 INFO]: [Essentials] CONSOLE issued server command: /list 
[20:53:07 INFO]: There are 0 out of maximum 100 players online.

But, at no point does the server actually seem to idle/turn off. It just keeps checking the online players every X minutes, and never actually stops.

I'm probably missing something simple here that is obvious to others?

I should point out I'm using Purpur with plugins rather than the vanilla jar...perhaps that's my problem?

Edenhofer commented 1 year ago

At least on my machine the idle server with the vanilla minecraft server is running just fine.

I think the problem might be purpur or the plugins. My concrete suspicion is that the idle server is not able to properly parse the output of the modified list command. Can you connect to the idle server session via sudo -u minecraft tmux -L minecraft attach -t idle_server_minecraft (replace the first minecraft with the user under which the game is running and the second minecraft with the session name configured in /etc/conf.d/...) and share the output?

Xarius86 commented 1 year ago

I end up seeing this line repeatedly when there are no active players:

no_player: 0s check_player_time: 30s idle_if_time: 300s

Quick edit: The 30sec check was put there just for this purpose. I obviously normally wouldn't be checking that often.

Edenhofer commented 1 year ago

Nice! Thanks for checking. This confirms my suspicion. The problem is this function here https://github.com/Edenhofer/minecraft-server/blob/703d029/minecraftd.sh.in#L88-L106 .

Would you be willing to have a stab at generalizing it to work with purpur/your plugins? In essence you would run the game_command line manually and then tweak the regex until it is encompasses you case too :)