Skip to content

Commit

Permalink
Added more methods to the SuperiorSkyblockAPI class
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Apr 16, 2022
1 parent 45a815d commit a66cc29
Showing 1 changed file with 108 additions and 19 deletions.
@@ -1,10 +1,20 @@
package com.bgsoftware.superiorskyblock.api;

import com.bgsoftware.superiorskyblock.api.commands.SuperiorCommand;
import com.bgsoftware.superiorskyblock.api.config.SettingsManager;
import com.bgsoftware.superiorskyblock.api.handlers.BlockValuesManager;
import com.bgsoftware.superiorskyblock.api.handlers.CommandsManager;
import com.bgsoftware.superiorskyblock.api.handlers.FactoriesManager;
import com.bgsoftware.superiorskyblock.api.handlers.GridManager;
import com.bgsoftware.superiorskyblock.api.handlers.KeysManager;
import com.bgsoftware.superiorskyblock.api.handlers.MenusManager;
import com.bgsoftware.superiorskyblock.api.handlers.MissionsManager;
import com.bgsoftware.superiorskyblock.api.handlers.ModulesManager;
import com.bgsoftware.superiorskyblock.api.handlers.PlayersManager;
import com.bgsoftware.superiorskyblock.api.handlers.ProvidersManager;
import com.bgsoftware.superiorskyblock.api.handlers.RolesManager;
import com.bgsoftware.superiorskyblock.api.handlers.SchematicManager;
import com.bgsoftware.superiorskyblock.api.handlers.StackedBlocksManager;
import com.bgsoftware.superiorskyblock.api.handlers.UpgradesManager;
import com.bgsoftware.superiorskyblock.api.hooks.SpawnersProvider;
import com.bgsoftware.superiorskyblock.api.island.Island;
Expand All @@ -27,20 +37,6 @@ public final class SuperiorSkyblockAPI {
* Player Methods
*/

/**
* Set the plugin's instance for the API.
* Do not use this method on your own, as it may cause an undefined behavior when using the API.
*
* @param plugin The instance of the plugin to set to the API.
*/
public static void setPluginInstance(SuperiorSkyblock plugin) {
if (SuperiorSkyblockAPI.plugin != null) {
throw new UnsupportedOperationException("You cannot initialize the plugin instance after it was initialized.");
}

SuperiorSkyblockAPI.plugin = plugin;
}

/**
* Get the superior player object from a player instance.
*/
Expand Down Expand Up @@ -181,10 +177,28 @@ public static Schematic getSchematic(String name) {
* Providers Methods
*/

/**
* Set custom spawners provider for the plugin.
*
* @param spawnersProvider The spawner provider to set.
*/
public static void setSpawnersProvider(SpawnersProvider spawnersProvider) {
plugin.getProviders().setSpawnersProvider(spawnersProvider);
}

/*
* Commands Methods
*/

/**
* Register a sub-command.
*
* @param superiorCommand The sub command to register.
*/
public static void registerCommand(SuperiorCommand superiorCommand) {
plugin.getCommands().registerCommand(superiorCommand);
}

/*
* Main Method
*/
Expand All @@ -196,27 +210,69 @@ public static GridManager getGrid() {
return plugin.getGrid();
}

/**
* Get the stacked-blocks manager of the core.
*/
public static StackedBlocksManager getStackedBlocks() {
return plugin.getStackedBlocks();
}

/**
* Get the blocks manager of the core.
*/
public static BlockValuesManager getBlockValues() {
return plugin.getBlockValues();
}

/**
* Get the schematics manager of the core.
*/
public static SchematicManager getSchematics() {
return plugin.getSchematics();
}

/**
* Get the players manager of the core.
*/
public static PlayersManager getPlayers() {
return plugin.getPlayers();
}

/**
* Get the roles manager of the core.
*/
public static RolesManager getRoles() {
return plugin.getRoles();
}

/**
* Get the missions manager of the core.
*/
public static MissionsManager getMissions() {
return plugin.getMissions();
}

/**
* Get the menus manager of the core.
*/
public static MenusManager getMenus() {
return plugin.getMenus();
}

/**
* Get the keys manager of the core.
*/
public static KeysManager getKeys() {
return plugin.getKeys();
}

/**
* Get the providers manager of the core.
*/
public static ProvidersManager getProviders() {
return plugin.getProviders();
}

/**
* Get the upgrades manager of the core.
*/
Expand All @@ -225,12 +281,31 @@ public static UpgradesManager getUpgrades() {
}

/**
* Register a sub-command.
*
* @param superiorCommand The sub command to register.
* Get the commands manager of the core.
*/
public static void registerCommand(SuperiorCommand superiorCommand) {
plugin.getCommands().registerCommand(superiorCommand);
public static CommandsManager getCommands() {
return plugin.getCommands();
}

/**
* Get the settings of the plugin.
*/
public static SettingsManager getSettings() {
return plugin.getSettings();
}

/**
* Get the objects factory of the plugin.
*/
public static FactoriesManager getFactory() {
return plugin.getFactory();
}

/**
* Get the modules manager of the plugin.
*/
public static ModulesManager getModules() {
return plugin.getModules();
}

/**
Expand All @@ -240,4 +315,18 @@ public static SuperiorSkyblock getSuperiorSkyblock() {
return plugin;
}

/**
* Set the plugin's instance for the API.
* Do not use this method on your own, as it may cause an undefined behavior when using the API.
*
* @param plugin The instance of the plugin to set to the API.
*/
public static void setPluginInstance(SuperiorSkyblock plugin) {
if (SuperiorSkyblockAPI.plugin != null) {
throw new UnsupportedOperationException("You cannot initialize the plugin instance after it was initialized.");
}

SuperiorSkyblockAPI.plugin = plugin;
}

}

0 comments on commit a66cc29

Please sign in to comment.