SigmacellHQ / msgroom-custom-server

A custom Windows 96 MsgRoom Server by nolanwhy & Kelbaz
Other
5 stars 4 forks source link

you can ban a person multiple times #2

Closed NanderTGA closed 11 months ago

NanderTGA commented 11 months ago

The array with bans can have duplicates, making it extremely hard to unban someone. The workaround is to spam the unban command. The solution is to remove duplicates from this array when loading it from the JSON file by converting it to a set and then converting it back to an array. You can remove duplicates like this. I would also recommend just keeping it as a Set in memory so you can use its has() method, which is more efficient. Next, make your ban and unban commands check if a user is already banned or unbanned before trying to ban/unban. And please also make the admin-action handler tell the user if they are not an admin before doing anything else and return right away.

nolanwhy commented 11 months ago

admin-action doesn't say anything if you aren't admin and you try executing a command (on normal msgroom) so we won't add that. but, we will fix the ban duplicates