Closed Salzian closed 6 years ago
Are you sure that fixes it? It's supposed to return the first time, since it's just extracting the file, it shouldn't be modifying it. If that's causing it not to save elevators, that could indicate a problem with when the function is called.
I'll test your modified line...
I tested it for over 4 hours reworking all the code, thinking about saving the elevator data in an own file. In the end, I realized, that the only mistake was this line. When the try/catch gets executed, it either returned false in case of an IOException or true when it was able to read the file. However, in both scenarios it returns, not saving the elevator data to the file.
My config.yml never got modifier prior to this change, now I didn't come across any problems.
As soon as I restarted my server, the server read the empty config.yml elevator array, since the code never saved before properly. The only time the code completely runs was when there was no config.yml file.
Yeah, I tested it. You are correct with the issue. It's a classic case of having the signs backwards. That return true;
belongs in the if, not the else. Of course, I don't really need it anyway, it was only to keep it from messing with the formatting of the comments, which is an issue I fixed a while ago.
So I can definitely take the pull request.
When the server tries to save the config file, it skips the whole saving logic right after checking if the config.yml file exists.