C#:
namespace Oxide.Plugins;
[Info("Upkeep Display Fix", "WhiteThunder", "1.0.3")]
[Description("Fixes a display bug where buildings appear to be decaying when using decay.scale 0.")]
internal class UpkeepDisplayFix : CovalencePlugin
{
private const int DisplayMinutesWhenNoDecay = 44640; // 31 days, so that you always see "> 30 days"
private void OnServerInitialized()
{
if (ConVar.Decay.scale != 0)
{
LogWarning($"This plugin is only useful for servers using decay.scale 0. Your server is currently using decay.scale {ConVar.Decay.scale}, so you should uninstall this plugin unless you are planning to use decay.scale 0.");
}
}
private void OnEntitySaved(BuildingPrivlidge buildingPrivilege, BaseNetworkable.SaveInfo saveInfo)
{
if (ConVar.Decay.scale != 0)
return;
saveInfo.msg.buildingPrivilege.protectedMinutes = DisplayMinutesWhenNoDecay;
}
}