0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-21 18:55:17 +00:00
SmoOnlineServer/Server
Robin C. Ladiges d6a8df448c
Refactoring ban command (#48)
* rename command: `ban ...` => `ban player ...`

To enable adding other subcommands starting with `ban`.

Moving ban list and crash related code into its own class to tidy the Program class up.

Change Id values of the crash cmds, to fit into the 16 byte max length imposed by ChangeStagePacket.IdSize.

* add command: `ban ip <ipv4-address>`

To add an IPv4 address to the ban list.

* add command: `ban profile <profile-id>`

To add a profile ID to the ban list.

* add command: `unban ip <ipv4-address>`

To remove a banned IPv4 address from the ban list.

* add command: `unban profile <profile-id>`

To remove a banned profile ID from the ban list.

* add commands: `ban enable` and `ban disable`

To set the value of `BanList.Enabled` to `true` or `false` without editing the `settings.json` file.

* add command: `ban list`

To show the current ban list settings.

* fix: actually working ban functionality

Changes:
- ignore new sockets from banned IP addresses way earlier.
- ignore all packets by banned profiles.

Intentionally keeping the connection open instead of d/c banned clients.
This is to prevent endless server logs due to automatically reconnecting clients.

Before:
Reconnecting clients aren't entering `ClientJoined` and therefore the d/c is only working on first connections.
Effectively banned clients got a d/c and then automatically reconnected again without getting a d/c again.
Therefore allowing them to play normally.

* use SortedSet instead of List for settings

To enforce unique entries and maintain a stable order inside of the `settings.json`.

* add commands: `ban stage <stage-name>` and `unban stage <stage-name>`

To kick players from the server when they enter a banned stage.

<stage-name> can also be a kingdom alias, which bans/unbans all stages in that kingdom.

Because we aren't banning the player, d/c them would be no good, because of the client auto reconnect.
Instead send them the crash and ignore all packets by them until they d/c on their own.

This is an alternative solution for issue #43.

* Update Server.cs

---------

Co-authored-by: Sanae <32604996+Sanae6@users.noreply.github.com>
2023-09-05 17:14:54 -06:00
..
BanLists.cs Refactoring ban command (#48) 2023-09-05 17:14:54 -06:00
Client.cs Refactoring ban command (#48) 2023-09-05 17:14:54 -06:00
CommandHandler.cs Added quotable arguments, potential fix for ban * not banning anyone. 2022-07-27 12:14:56 -06:00
DiscordBot.cs only warn about the Discord channel settings when a Token is set 2022-10-10 19:37:37 -06:00
FlipOptions.cs Add scenario merging and run reformatting on solution 2022-03-01 15:08:53 -06:00
Program.cs Refactoring ban command (#48) 2023-09-05 17:14:54 -06:00
Server.cs Refactoring ban command (#48) 2023-09-05 17:14:54 -06:00
Server.csproj Add a simple discord bot to manage the server 2022-06-12 18:48:24 -06:00
Settings.cs Refactoring ban command (#48) 2023-09-05 17:14:54 -06:00
Time.cs Add tag commands and improve command handling 2022-03-14 23:59:23 -06:00