0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-22 03:05:16 +00:00
Commit graph

93 commits

Author SHA1 Message Date
Robin C. Ladiges
082e480b1e crash ignored players
Otherwise they keep sending all their packets (including positional updates) to the server which costs bandwidth and processing power.
2024-04-27 15:14:38 -04:00
Robin C. Ladiges
dc20a9c831 small refactorings
- use brackets when possible
- set client.Id and client.Name earlier
- use client.Id instead of header.Id
- rename firstConn to isClientNew
2024-04-27 15:14:38 -04:00
Robin C. Ladiges
61e6fcf2a3 new setting: Shines/Excluded
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
2024-04-27 14:46:43 -04:00
Robin C. Ladiges
20ee74d0d6 fix: construct tag packet instead of caching it in memory
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.)
2024-04-27 14:45:41 -04:00
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
Robin C. Ladiges
86c79177fd fix: synchronization issues
- 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).
2023-09-05 16:51:58 -06:00
Robin C. Ladiges
71bb96bf1e verify stage values for send and sendall
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.
2023-03-22 16:50:38 -06:00
Robin C. Ladiges
47fc1527bf fix: don't process and broadcast shine packets when shine sync is disabled
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?
2022-12-16 13:18:07 -06:00
Robin C. Ladiges
a0642e6a30 fix: only send shines to connected clients and save only after sending
otherwise it will save that the client got it to the bag and then fail sending it, therefore forever preventing the client to get the shine.
2022-12-16 13:18:07 -06:00
Robin C. Ladiges
472c8856bc move the client.CurrentCostume update to the PacketHandler and log the packet
(cherry picked from commit 47505dbdd5)
2022-10-10 11:09:39 -06:00
Robin C. Ladiges
53442b598e only start listening for clients once everything is initialized
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)
2022-10-10 11:08:38 -06:00
Jack Baron
e14616030c move clear task 2022-09-05 18:56:24 -06:00
Jack Baron
24a34c35a1 ignore file not found errors 2022-09-05 18:56:24 -06:00
Sanae
9c01f30c5e Add the ability to disable shine sync 2022-08-20 23:31:31 -06:00
raym55
c86be55717 PIPERS 2022-08-10 15:03:34 -06:00
Sanae
e7a3347a37
Merge pull request #19 from TheUbMunster/restart-command 2022-07-29 13:19:04 -06:00
TheUbMunster
8baf75155e removed testing code 2022-07-29 12:55:14 -06:00
TheUbMunster
fc2f9b1417 "banning the same person multiple times" should now be fixed 2022-07-29 12:55:14 -06:00
TheUbMunster
33fdd69e15 readded persisten shinies 2022-07-29 12:55:14 -06:00
TheUbMunster
5af8001398 Fixed adding quotes around Ambiguous for "user": , fixed showing correct casing of arguments. 2022-07-29 12:55:14 -06:00
TheUbMunster
ba02c88b13 added !* variants for ban, crash, rejoin 2022-07-29 12:55:14 -06:00
TheUbMunster
95c918b5c4 Removed fire-and-forget warnings, null-forgave some metadata. 2022-07-29 12:55:01 -06:00
TheUbMunster
3a8e7ffb93 Changed "Running (pid)" to "Server Running on (pid)" 2022-07-28 18:00:18 -06:00
TheUbMunster
d2c8c8d3cd Fixed race condition with restart to make sure it only happens after the listener closes. 2022-07-28 00:11:40 -06:00
TheUbMunster
068cc7c06d Added restart server command 2022-07-27 23:56:50 -06:00
TheUbMunster
db05586dd0 Added quotable arguments, potential fix for ban * not banning anyone. 2022-07-27 12:14:56 -06:00
TheUbMunster
d604c59a77 Added quotable arguments, potential fix for ban * not banning anyone. 2022-07-27 12:14:56 -06:00
TheUbMunster
5ca5b10db8 Fixed backwards ternaries in ban, crash, rejoin, 0 arguments no longer valid. 2022-07-27 12:14:56 -06:00
Jack Baron
f305c3001b save/load moons from file 2022-07-22 18:56:00 -06:00
CraftyBoss
967a89a55b Merge branch 'master' of https://github.com/Sanae6/SmoOnlineServer 2022-07-08 23:13:44 +00:00
CraftyBoss
11015bd445 only send game packet on join to connected clients 2022-07-08 23:13:35 +00:00
raym55
787491456f Update Program.cs 2022-06-29 06:54:14 +01:00
Sanae
72061215ce Add wildcard to rejoin, crash, ban commands 2022-06-28 14:34:03 -06:00
Sanae
f9c20e73a8 Fix accidental squashed command handler 2022-06-20 13:10:35 -06:00
Sanae
b5825b537f Implements Added Bot Reconnect Command (#1)
Add dscrestart command
Update Program.cs
2022-06-20 12:55:01 -06:00
Sanae
5d78814620 Reformat Program.cs 2022-06-20 12:52:46 -06:00
Sanae
e9136704c1 Fix response messages for ban and send commands 2022-06-19 19:33:08 -06:00
Sanae
c4c0616fb7 Make some commands accept ids and partial names 2022-06-18 02:09:40 -06:00
Sanae
1f5ea97272 Finish ban implementation 2022-06-17 21:18:08 -06:00
Sanae
561d633e40 Add a simple discord bot to manage the server 2022-06-12 18:48:24 -06:00
Sanae
774ef20bb4 Multiple users on commands 2022-05-31 16:02:12 -06:00
Sanae
74c00aa0f8 The user management update 2022-05-31 15:48:57 -06:00
Sanae
d898f4754b Add max players command and remove savesettigns 2022-05-31 14:48:48 -06:00
Sanae
ab318db1b8 Clean up logging from testing 2022-04-27 21:32:52 -06:00
Sanae
df2e976782 balls 2022-04-27 14:09:50 -06:00
Sanae
7a088eb314 Fix 2, electric boogaloo 2022-04-26 23:06:27 -06:00
CraftyBoss
3e462ddb64 Merge branch 'master' of https://github.com/Sanae6/SmoOnlineServer 2022-04-27 04:43:48 +00:00
CraftyBoss
ff570a17c7 only show connected players in list command 2022-04-27 04:43:46 +00:00
Sanae
eaadb90ee3 Probably fix scenario merging for real this time 2022-04-26 22:40:02 -06:00
CraftyBoss
a89471de54 Merge branch 'master' of https://github.com/Sanae6/SmoOnlineServer 2022-04-05 19:35:15 +00:00