Skip to content

Commit

Permalink
Added loadData callback method for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Feb 17, 2022
1 parent 63ab534 commit b744011
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Expand Up @@ -61,6 +61,17 @@ protected PluginModule(String moduleName, String authorName) {
*/
public abstract void onDisable(SuperiorSkyblock plugin);

/**
* Called when the module can load data about players.
* It's called after the plugin's data is loaded.
* <p>
* This is similar to load data when {@link com.bgsoftware.superiorskyblock.api.events.PluginInitializedEvent}
* is fired.
*/
public void loadData() {

}

/**
* Called when the module initialized for the first time.
*
Expand Down
Expand Up @@ -7,6 +7,7 @@
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.island.SortingType;
import com.bgsoftware.superiorskyblock.api.modules.ModuleLoadTime;
import com.bgsoftware.superiorskyblock.api.modules.PluginModule;
import com.bgsoftware.superiorskyblock.api.scripts.IScriptEngine;
import com.bgsoftware.superiorskyblock.api.world.event.WorldEventsManager;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
Expand Down Expand Up @@ -510,6 +511,7 @@ public void reloadPlugin(boolean loadGrid) throws HandlerLoadException {
dataHandler.loadData();
stackedBlocksHandler.loadData();
SortingType.values().forEach(gridHandler::sortIslands);
modulesHandler.getModules().forEach(PluginModule::loadData);
} else {
modulesHandler.getModules().forEach(pluginModule -> pluginModule.onReload(this));
}
Expand Down

0 comments on commit b744011

Please sign in to comment.