Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 5edec6e

Browse files
committed
fix(invalidation): make bank chest properly stay in sync over server crashes
Fixed #58
1 parent ed75e15 commit 5edec6e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Implementation/ProtectorPlugin.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private void Game_PostInitialize(EventArgs e) {
110110
this.PluginCooperationHandler.ChestManager = this.ChestManager;
111111

112112
this.InitUserInteractionHandler();
113-
this.UserInteractionHandler.EnsureProtectionData(TSPlayer.Server);
113+
this.UserInteractionHandler.EnsureProtectionData(TSPlayer.Server, true);
114114

115115
this.hooksEnabled = true;
116116
}
@@ -195,7 +195,6 @@ private void InitUserInteractionHandler() {
195195
return null;
196196

197197
this.Config = Configuration.Read(ProtectorPlugin.ConfigFilePath);
198-
199198
this.ProtectionManager.Config = this.Config;
200199

201200
return this.Config;

Implementation/UserInteractionHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ select pt.TileLocation
483483
return true;
484484
}
485485

486-
this.EnsureProtectionData(args.Player);
486+
this.EnsureProtectionData(args.Player, false);
487487
return true;
488488
}
489489
case "summary":
@@ -3725,13 +3725,13 @@ public bool TrySetUpTradeChest(TSPlayer player, DPoint tileLocation, int sellAmo
37253725
return false;
37263726
}
37273727

3728-
public void EnsureProtectionData(TSPlayer player) {
3728+
public void EnsureProtectionData(TSPlayer player, bool resetBankChestContent) {
37293729
int invalidProtectionsCount;
37303730
int invalidRefillChestCount;
37313731
int invalidBankChestCount;
37323732

37333733
this.ProtectionManager.EnsureProtectionData(
3734-
false, out invalidProtectionsCount, out invalidRefillChestCount, out invalidBankChestCount);
3734+
resetBankChestContent, out invalidProtectionsCount, out invalidRefillChestCount, out invalidBankChestCount);
37353735

37363736
if (player != TSPlayer.Server) {
37373737
if (invalidProtectionsCount > 0)

0 commit comments

Comments
 (0)