NullReferenceException at UpdatePlayerCountUI / CheckLimitCountSolved
After the update to V2 im getting this when loading the plugin:

Added '// Reference: Facepunch.Sqlite' in plugin 'ImageLibrary'
Added '// Reference: UnityEngine.UnityWebRequestModule' in plugin 'ImageLibrary'
RaidLimit and ImageLibrary were compiled successfully in 4367ms
Unloaded plugin Image Library v2.0.52 by Absolut & K1lly0u
[DEBUG] RaidLimit plugin is waiting for requirements to be loaded: ImageLibrary
Loaded plugin Image Library v2.0.52 by Absolut & K1lly0u
[Raid Limit] Creating a new configuration file
Failed to call hook 'OnServerInitialized' on plugin 'RaidLimit v2.0.0' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidLimit.UpdatePlayerCountUI (BasePlayer player, System.Boolean imageupdate) [0x0003a] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.RaidLimit.PlayersUpdateRaidLimitUI (System.Boolean imageupdate) [0x00051] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.RaidLimit.OnServerInitialized () [0x00028] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.RaidLimit.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00281] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <41771c7bc8d246d0b0a34c2f0d27f2cb>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <b0a93b504f034a0db8b1c3d2503c0987>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <b0a93b504f034a0db8b1c3d2503c0987>:0 
Loaded plugin Raid Limit v2.0.0 by noname​

And this when trying to /rlcheck I get this:
Failed to call hook 'CheckLimitCount' on plugin 'RaidLimit v2.0.0' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidLimit.CheckLimitCount (Oxide.Core.Libraries.Covalence.IPlayer player, System.String command, System.String[] args) [0x0004c] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.RaidLimit.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0132e] in <ffd3823c388a4233b8dd029a62cd1ae2>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <41771c7bc8d246d0b0a34c2f0d27f2cb>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <b0a93b504f034a0db8b1c3d2503c0987>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <b0a93b504f034a0db8b1c3d2503c0987>:0 
 
Please help! My server depends on this great mod a lot, thank you.
Solved it by stopping the server and deleting all related files. This does not work when the server is running.

Now the errors are gone but the limit is always 2/2 no matter how many times I raid. Any clues?
Do you use the new operation type?
I've tried with both because I noticed you suggested it in another thread. But no luck I'm afraid.
I have not tested type 1 but type 0 is still in use on my server and works properly.

Merged post

You didn't test it with your own structure?
This is my current config:

{
  "1.RaidLimitOperationType": {
    "1.1.OperationType": 1,
    "1.2.ObjectOwnerIdentification": {
      "1.2.1.ObjectSearchDepth": -1,
      "1.2.2.ObjectSearchRange": 5
    },
    "1.3.ToolCupboardIdentification": {
      "1.3.1.ObjectSearchDepth": -1,
      "1.3.2.ObjectSearchRange": 5,
      "1.3.3.CheckToolCupboardInstanceID": true,
      "1.3.4.CheckAuthorizedPeoples": true
    }
  },
  "2.RaidLimitSettings": {
    "2.1.DailyRaidableHomeCount": 2,
    "2.2.CantRaidSecond": 10800
  },
  "3.UISettings": {
    "3.1.UIEnable": true,
    "3.2.UIUpdateInterval": 3,
    "3.3.UIPosition": {
      "3.3.1.AnchorMin": "0.28 0.025",
      "3.3.2.AnchorMax": "0.3392 0.06"
    }
  },
  "4.TeamSyncSettings": {
    "4.1.TeamCounterSync": true,
    "4.2.PreventTempDisband": true,
    "4.3.OldTeamSaveInterval": 600
  }
}​

The previous version was working fine but had some issues with some players going into negative.
I noticed you posted version 2.0 to fix that among other enhancements.
So, with my server running, I deleted the .cs file and the config .json file.
I uploaded v2 but errors started happening.
Came on the boards and read I had to actually fully stop the server for the update.

- I stopped the server.
- Deleted the plugin (cs), the config (json) and all the related data files also.
- Uploaded v2 again, started the server.


Errors are gone, UI is displaying with 2/2 raids possible.
/rlcheck says I can do 2 raids

Everythin "looks" OK but is not:


I "test" raid 3 of my players, no messages showing up, no changes in the Ui still 2/2.
No errors in console.


I check data file and seems no record is being added under my data file:

{
"excutteddate": "2020-02-04T03:38:40.7652831+00:00",
"Players": {
"76561198023407907": {
"Id": "76561198023407907",
"Name": "Deicide",
"RaidCountItems": [],
"Playtime": "00:00:00",
"CanRaidPlaytimeTracker": true,
"CanRaid": false
}
}

}

I change in config "1.1.OperationType": 0, to 1 but no difference.

I ask a regular player to reproduce my steps and problem is the same.

After destroying several entities of different owners he can still raid, no change in his UI and no data in file.

Hope this helps!



Merged post

Thank you for uploading a fix so quickly, you are awesome sir!
After the last update, I have not been able to get this to work on my server.

Failed to call hook 'OnServerInitialized' on plugin 'RaidLimit v2.0.3' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidLimit.UpdatePlayerCountUI (BasePlayer player, System.Boolean imageupdate) [0x0003a] in <736228381a30493e840497e1524a1bb3>:0 
  at Oxide.Plugins.RaidLimit.PlayersUpdateRaidLimitUI (System.Boolean imageupdate) [0x00050] in <736228381a30493e840497e1524a1bb3>:0 
  at Oxide.Plugins.RaidLimit.OnServerInitialized () [0x00028] in <736228381a30493e840497e1524a1bb3>:0 
  at Oxide.Plugins.RaidLimit.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00281] in <736228381a30493e840497e1524a1bb3>: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 ​


I not sure if this has anything to do with it.  
Initialize the config and the data files.
What is initialize the config?
I deleted all files before I installed the new version of the plugin is that what you are talking about?
That's rignt. But if you can't, you might have erased the file when the server was on.
That was the problem.  Thanks and sorry for the dumb questions.
Locked automatically