crowbarmaster / BedrockManagementService

A multiple host, multiple server, Minecraft bedrock server management service and GUI manager.
Apache License 2.0
33 stars 5 forks source link

Start commands list dropping the last command in the list #4

Closed crowbarmaster closed 2 years ago

crowbarmaster commented 2 years ago

The start commands list is dropping the last command in the list (length -1 coding error?). So if you have just 1 command, it wont execute. 2 commands will execute just the first one, and 3 commands, it will execute the first 2. There is no way to delete a command in the list (just blanking them out works, but is not pretty). ...

Originally posted by @tiamat2012 in https://github.com/crowbarmaster/BedrockManagementService/issues/2#issuecomment-988427211

tiamat2012 commented 2 years ago

I am not sure if this is related to another bug or not, but I cannot edit the start commands through the client. It doesn't seem to update the .conf file when I select Save. And if I edit the conf file directly, and use the client to restart the minecraft server, it doesn't seem to re-read the config file. A full stop/start of the service or reboot has to be performed.

crowbarmaster commented 2 years ago

It would seem like this was a simple timing issue. Even though the server started message had printed, the commands to be run at server startup still need to be delayed a bit. I already had a one second delay in place, so I changed that up to 3 seconds. Commands now run as intended! Needs testing in VM grounds still, but the problem existed on hardware as well. As for the saving commands issue, I cannot reproduce that, everything seems to work okay here. I am going to clean up a few more things and do some VM based testing, I will see if it happens then.

tiamat2012 commented 2 years ago

Yep, I just tried it again. Edit an existing command and change it to something else. The client shows the new commands if you edit it again, but the actual commands run on the server are the old ones, and the conf file still shows the old commands.

Here I changed the first command and last command (swapped them), saved it, and then the server automatically restarted. I can see that it didn't make the change in the logs, and I opened the editor again to confirm that I changed it in the client (so this is the screenshot after I saved and reopened it in the client).

image

If you press save again, the change is made for this second save and the server used it:

image

This could also explain why I thought it was leaving off the last command - because I was adding a new command at the end in the client but it didn't actually save the first time (so the output didn't show the last command being executed).

tiamat2012 commented 2 years ago

BTW - README.md has the wrong keyword mentioned:

# StartCmds Distracted=help 1 // Any of these optional fields will send following command to server on startup.

crowbarmaster commented 2 years ago

Yep! I found that bug this morning, I simply had the client sending the updates back at the wrong time, simply sending back the current commands. Explains why doing it twice makes it happen, since the on the client end those updated at the time of sending the info back. This fix will ship in the next release, and that will be soon! BTW, if you can build with VS 2022, I keep the repo updated daily, all of my recent changes are up there! Have to use the protoASP branch. Good catch on that issue with the readme!

tiamat2012 commented 2 years ago

Sorry, but I haven't programmed in .NET or C# (or Windows for that matter). As you can probably tell, I have a programming background (30+ years), but learning your code is more than I can handle at the moment. I have a lot of other code to write and improve on. I hope you are ok with me doing the testing and helping in that regard.

crowbarmaster commented 2 years ago

Fine by me man! I was just shooting that out there in the case you didn't want to wait for releases. That being said, I will be shipping one out in the next couple days!

tiamat2012 commented 2 years ago

The service and bedrock server are working fine and backups are running nightly, I made the necessary changes by hand as work arounds for the bugs, so we have been playing 1.18.2 for a few days. I don't anticipate making a lot of changes right now via the client, so the bug fixes are mostly for people setting up new servers. Probably the most useful change to me at the moment would be the live backups, because now that we are playing, after we get done with some significant building, I need to take a backup (kicking people off to do so).

I can still do testing of these bugs this week, but next week is going to be difficult. I can also check the week after. So don't rush anything on my behalf.

tiamat2012 commented 2 years ago

This bug is fixed in v2.53

crowbarmaster commented 2 years ago

Acknowledged and closing issue!