To exclude specific shines to be synced to other clients.
Pre-initialized with shine 496 (Moon Shards in the Sand) that causes people to get stuck in front of the inverted pyramid.
This commit fixes issue #31
Because the tag packet received from the client could have an UpdateType that isn't both State and Time.
(Though currently the client always updates both together.)
* 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>
- Send empty `TagPacket` and `CapturePacket` on new connections, to reset old data back that other players might still have in their puppet from an
earlier connection.
- Cache and send `CostumePacket`, `CapturePacket`, `TagPacket`, `GamePacket` and `PlayerPacket` to (re-)connecting players.
- Clear Metadata cache for existing clients that connect fresh (after a game restart).
Changes:
- Moved alias mapping from Constants.cs to Stages.cs.
- Added `odyssey` as an alias.
- Hardcoded all known stage values.
- Verfify that the stage input is either a alias or a known stage name.
- Added an option to append `!` to a stage name to force sending even if the stage is not known (e.g. for custom kingdoms).
Before it only checked that it was a known alias or that it contained `Stage` or `Zone`.
That made it impossible to send players to`MoonWorldShopRoom` and `MoonWorldSphinxRoom`.
And a typo would have resulted in a game crash.
The breaks make the function return true, which causes the shine packets to be broadcasted to all connected clients.
Returning false will prevent the broadcast of the current shine packet.
Note: If shines are enabled, the clients will receive every shine twice.
Once from the `SyncShineBag();` and then a second time from the default broadcast caused by the remaining breaks.
We should probably replace every `break;` with `return false;` here?
Otherwise clients might connect to the server before everything is ready for them.
E.g. when restarting the server, the clients will immediately try to reconnect.
Clients might connect before the `PacketHandler` is initialized, which results in some packets not being processed by the server correctly.
Same goes for the commands: Discord might send in commands before all commands were added to the `CommandHandler`.
Without the `ClientJoined` action, clients might even be allowed to connect if they are on the banlist.
(Though without this initialization they or regular clients might be broken in some ways?)
(cherry picked from commit 92e540aaa6)