public static void ServerAddEnergyCharge(IItemsContainer container, double energyAmountToAdd) { if (energyAmountToAdd <= 0 || container == null || container.IsDestroyed) { return; } ITempList <IItem> tempItemsList; if (container.Owner is ICharacter ownerCharacter) { tempItemsList = SharedGetTempListPowerBanksForCharacter(ownerCharacter, onlyEquippedDevices: false); } else { tempItemsList = Api.Shared.GetTempList <IItem>(); SharedFindPowerBanks(container, tempItemsList); if (container.Owner is IWorldObject worldObject) { foreach (var character in InteractionCheckerSystem.SharedEnumerateCurrentInteractionCharacters( worldObject)) { using var tempCharacterPowerBanks = SharedGetTempListPowerBanksForCharacter(character, onlyEquippedDevices: false); tempItemsList.AddRange(tempCharacterPowerBanks.AsList()); } } } ServerAddEnergyInternal(energyAmountToAdd, tempItemsList.AsList()); tempItemsList.Dispose(); }