0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-21 18:55:17 +00:00

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?
This commit is contained in:
Robin C. Ladiges 2022-11-07 21:12:23 +01:00 committed by Sanae
parent a0642e6a30
commit 47fc1527bf

View file

@ -172,6 +172,7 @@ server.PacketHandler = (c, p) => {
break; break;
case ShinePacket shinePacket: { case ShinePacket shinePacket: {
if (!Settings.Instance.Shines.Enabled) return false;
if (c.Metadata["loadedSave"] is false) break; if (c.Metadata["loadedSave"] is false) break;
ConcurrentBag<int> playerBag = (ConcurrentBag<int>)c.Metadata["shineSync"]!; ConcurrentBag<int> playerBag = (ConcurrentBag<int>)c.Metadata["shineSync"]!;
shineBag.Add(shinePacket.ShineId); shineBag.Add(shinePacket.ShineId);