Jump to content

OnNewSave Issue

Pending 1.1.3

SeesAll
SeesAll

Posted

Your code currently does this;

void OnNewSave(string filename)
{
    Data.ClearAll();
}

Inside RaidData.ClearAll() if then dereferences;

if (INSTANCE.config.ClearBonusesOnReset)

 

But INSTANCE is not assigned until;

private void OnServerInitialized()
{
    INSTANCE = this;
    LoadData();
    ...
}

Meaning, OnNewSave it can run before InServerInitialized, so INSTANCE is basically NULL and then there is an exception.

You should consider the following:

  • Remove the RaidData class’s dependency on the static plugin instance.
  • Load the existing persisted data during OnNewSave.
  • Pass the clear-bonuses setting into ClearAll.
  • Save the cleared data immediately.
  • Establish the new reset timestamp.

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.9m
Total downloads
Customers
11.9k
Customers served
Files Sold
169.2k
Total sales
Payments
3.7m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.