private bool RefillChestTimer_Callback(TimerBase timer)
        {
            RefillChestMetadata refillChest = (RefillChestMetadata)timer.Data;
              lock (this.WorldMetadata.Protections) {
            ProtectionEntry protection = this.WorldMetadata.Protections.Values.SingleOrDefault(p => p.RefillChestData == refillChest);
            if (protection == null)
              return false;

            DPoint chestLocation = protection.TileLocation;
            this.TryRefillChest(chestLocation, refillChest);

            // Returning true would mean the Timer would repeat.
            return false;
              }
        }
示例#2
0
        private bool RefillChestTimer_Callback(TimerBase timer)
        {
            RefillChestMetadata refillChest = (RefillChestMetadata)timer.Data;
              lock (this.WorldMetadata.Protections) {
            ProtectionEntry protection = this.WorldMetadata.Protections.Values.SingleOrDefault(p => p.RefillChestData == refillChest);
            if (protection == null)
              return false;

            DPoint chestLocation = protection.TileLocation;
            try {
              this.TryRefillChest(chestLocation, refillChest);
            } catch (InvalidOperationException) {
              this.PluginTrace.WriteLineWarning($"Chest at position {chestLocation} doesn't seem to exist anymore. Can't refill it.");
              return false;
            }

            // Returning true would mean the Timer would repeat.
            return false;
              }
        }