NullReferenceException at ProtectedCupboard.UpdateHighestProtectionLevelError

hi.
when i reload plugin, this show up in console


14:03:52 oxide.reload RaidProtection
14:03:53 Unloaded plugin Raid Protection v2.1.1 by mr01sam
14:03:53 [Raid Protection] Registered permission raidprotection.level.0
14:03:53 Failed to call hook 'OnServerInitialized' on plugin 'RaidProtection v2.1.1' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000a9] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x0001a] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.RaidProtection.LoadAllTcs () [0x0002b] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.RaidProtection.OnServerInitialized () [0x00107] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x001c1] in <7c40056da0e5446b99481c9d744df18c>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0
14:03:53 Calling 'OnServerInitialized' on 'RaidProtection v2.1.1' took 255ms
14:03:53 Loaded plugin Raid Protection v2.1.1 by mr01sam
14:03:53  ​

Hi thanks for reporting this, I will try to look into this and get it resolved as soon as possible.

In order to help me reproduce the issue, would you be able to share your configuration settings?

In the meantime as a workaround, you could try revoking level permissions from players and regranting them. Theres a chance that may fix your issue.

[Raid Protection] Registered permission raidprotection.level.0
Failed to call hook 'OnServerInitialized' on plugin 'RaidProtection v2.1.2' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000b4] in :0
at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in :0
at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x0001a] in :0
at Oxide.Plugins.RaidProtection.LoadAllTcs () [0x0002b] in :0
at Oxide.Plugins.RaidProtection.OnServerInitialized () [0x00107] in :0
at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x001c1] in :0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in :0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0
Calling 'OnServerInitialized' on 'RaidProtection v2.1.2' took 189ms

Thanks for reporting this, I'll look into it.

Same Error. Tried every 2.X version. Had to revert to V1.2.4 - no errors on that version.

Yep.  Samesies.  Cant use at all atm.  Couldn't for the life of me work out how to 'activate' protection until I happened to look at console and saw red.

Same here. I did get it to work after server restart, BUT changing online protection from 100.0 to 0.0 made the error show up. Changing it back to 100.0 didn't help, same error. Hope this extra info helps...

 

Thank you for you're patience, this problem should be fixed in 2.1.3, let me know if you're still seeing this issue!

6XzCY6gcoQYUpG7.PNG mr01sam

Thank you for you're patience, this problem should be fixed in 2.1.3, let me know if you're still seeing this issue!

Thank you! Seems to be working perfectly from my short tests, waiting for regular players on my server to give me their "2 cents".

Once again, thank you!!

Hi having these pop up in console (im using raidbases plugin the paid version so not sure if this is causing issue) 

(21:13:18) | Failed to run a 1.00 timer in 'RaidProtection v2.1.4' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection.<LoadAllTcs>m__0 () [0x0002b] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <0fbce81d88d64454b3e7abb24df7026b>:0​
and also 
(21:45:32) | Failed to run a 0.10 timer in 'RaidProtection v2.1.4' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Plugins.RaidProtection+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x00010] in <2659c088c4bb4e0aba2364dad49302cf>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <0fbce81d88d64454b3e7abb24df7026b>:0​
config for ref 
{
  "General settings": {
    "Currency item ID (if not using economics)": -932201673,
    "Use economics balance (requires economics plugin)": false,
    "Use reward points (requires server rewards plugin)": false
  },
  "Protection settings": {
    "Protection levels": {
      "0": {
        "Online protection percentage (0-100)": 0.0,
        "Offline protection percentage (0-100)": 100.0
      }
    },
    "Delay after taking damage (seconds)": 10,
    "Delay for offline protection (seconds)": 300,
    "Protect buildings and deployables (true/false)": true,
    "Protect players (true/false)": true,
    "Protect vehicles and horses (true/false)": true,
    "Protect traps and electronics (true/false)": true
  },
  "Cost settings": {
    "Material cost multipliers": {
      "twig": 1.0,
      "wood": 1.0,
      "stone": 1.0,
      "metal": 1.0,
      "armored": 1.0
    },
    "Default hourly building cost": 1.0,
    "Default hourly base cost": 25.0,
    "Default structure damage cost": 0.0
  },
  "Indicator settings": {
    "Enabled": true,
    "Persistent": false,
    "Image url": "https://i.imgur.com/ue05FGg.png"
  }
}​

Seems like as soon as anyone edits the plugin we all get the same error only way is to just run the plugin with out edit the config file.

But it could be raidable bases im also running that plugin wil wait to see what owner says.

I have the same problems and there are several 1000 console messages so that the console shows spam ...

please fix urgently ...

Failed to call hook 'OnServerInitialized' on plugin 'RaidProtection v2.1.3' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.RaidProtection.StartCollecting () [0x0001c] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.RaidProtection.OnServerInitialized () [0x0010d] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x001c1] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
Loaded plugin Raid Protection v2.1.3 by mr01sam
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
Failed to run a 1.00 timer in 'RaidProtection v2.1.3' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Plugins.RaidProtection.<LoadAllTcs>m__0 () [0x0002b] in <5863d59fad844e52a1ed4a8b9d9c1e50>:0
at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <0fbce81d88d64454b3e7abb24df7026b>:0
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)

This is what i'm receiving and it totally breaks the plugin for me.



Merged post

It indeed has to do with touching the config, because as soon as that happens it breaks no matter what you change.

Merged post

(01:59:32) | Failed to call hook 'OnEntityTakeDamage' on plugin 'RaidProtection v2.1.4' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in :0 at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in :0 at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in :0 at Oxide.Plugins.RaidProtection.ProtectFromDamage (BaseCombatEntity entity, HitInfo info) [0x00049] in :0 at Oxide.Plugins.RaidProtection.OnEntityTakeDamage (BasePlayer entity, HitInfo info) [0x00015] in :0 at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00b82] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0 (01:59:32) | Failed to call hook 'OnEntityTakeDamage' on plugin 'RaidProtection v2.1.4' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in :0 at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in :0 at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in :0 at Oxide.Plugins.RaidProtection.ProtectFromDamage (BaseCombatEntity entity, HitInfo info) [0x00049] in :0 at Oxide.Plugins.RaidProtection.OnEntityTakeDamage (BasePlayer entity, HitInfo info) [0x00015] in :0 at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00b82] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0

I have the same problem, first time the Plugin runs fine making default config. But after adjusting the config and reload Plugin, my Rcon shows the same errors as shown above.

Failed to call hook 'OnEntityTakeDamage' on plugin 'RaidProtection v2.1.4' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateHighestProtectionLevel () [0x000c5] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000c4] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.RaidProtection.ProtectFromDamage (BaseCombatEntity entity, HitInfo info) [0x00049] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.RaidProtection.OnEntityTakeDamage (BaseMountable entity, HitInfo info) [0x00015] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.RaidProtection.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00b4a] in <78e18b7c605b45a0a77f96fb35dc886a>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <0fbce81d88d64454b3e7abb24df7026b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <0fbce81d88d64454b3e7abb24df7026b>:0