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
1 changed files with 1 additions and 0 deletions

View File

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