ME1312 / SubServers-2

SubServers – The Minecraft Server Management Platform
Apache License 2.0
91 stars 23 forks source link

Remove small redundancies for removing file #87

Closed indexjoseph closed 8 months ago

indexjoseph commented 8 months ago

What's Been Changed

In this pull request, the file deletion process has undergone significant simplification and consolidation. The changes involve refactoring the code from a verbose and repetitive structure to a more concise and modularized form.

Why It Was Changed

The primary motivation behind these changes was to eliminate redundancies in the file deletion process. The original code exhibited repetitive patterns where the file was deleted, the counter was decremented, and a log entry was made separately.

The refactored code introduces a new method, removeFile, which encapsulates the common logic for file deletion, counter adjustment, and logging. By doing so, we have simplified the original code block, making it more elegant, readable, and maintainable.

ME1312 commented 8 months ago

Thanks for bringing this section of the code to my attention. In addition to being unnecessarily repetitive, this section was also supposed to be scheduled as a repeating task, so, I went ahead and fixed that as well.