Class BedwarsAPI
This API is build in a tree-like-structure. Everything is ordered and you can access most of it by starting here. Some classes, mainly enums, are still directly accessible.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AddonAPI
Contains API for handing addons.static int
Returns the current version of the API.static ArenaPickerAPI
Contains API that is relevant to arena pickers.static ConfigurationAPI
Contains API for getting/setting configs, as well as saving config files.static GameAPI
Contains API for game related stuff, such as arenas, lobbies, spawners, special items etc.static Helper
Contains utility stuff.static HookAPI
Contains API for managing hooks.static MessageAPI
Contains API for managing the messaging system.static NMSHelper
Contains API/Helper to access NMS stuff.static PlayerDataAPI
Contains API for getting and managing player data, such as stats and achievements.static JavaPlugin
Returns the main class of the MBedwars plugin.static RemoteAPI
Contains API that is being used for communicating with other servers in a Proxy network.static CommandsCollection
Returns the commands collection that contains all sub commands under /bw.static MigrationProcess[]
Returns all running migration processes.static PluginState
getState()
Returns the current run state of the MBedwars plugin.static @Nullable WorldStorage
getWorldStorage
(World world) A world storage contains anything needed for creating custom entities or blocks.static void
Calls the callback when the API is ready to use.static MigrationProcess
Initiate a process of migration from another system, such as a Bedwars plugin or storage system.static boolean
reload
(@Nullable CommandSender sender) Attempts to reload the MBedwars plugin 1.static void
setRemoteAPI
(RemoteAPI remoteAPI) Implement your own remote API.
-
Method Details
-
getPlugin
Returns the main class of the MBedwars plugin.- Returns:
- The main class
-
reload
Attempts to reload the MBedwars plugin 1. Kick all players from all running arenas 2. Cancel any running migration processes 3. Unload data, (Achievements, Stats, Player Properties, etc) 4. Reload all MBedwars config files- Parameters:
sender
- Who is trying to reload the plugin. Where reload progress messages will be sent- Returns:
- if the plugin was successfully able to reload
-
getState
Returns the current run state of the MBedwars plugin.- Returns:
- The plugin state of MBedwars
-
getGameAPI
Contains API for game related stuff, such as arenas, lobbies, spawners, special items etc.- Returns:
- The global GameAPI instance
-
getArenaPickerAPI
Contains API that is relevant to arena pickers.- Returns:
- The global ArenaPickerAPI instance
-
getRemoteAPI
Contains API that is being used for communicating with other servers in a Proxy network.Generally, this API only gets replaced by the ProxySync addon. If it is not, because it for instance not installed, a general-use implementation will be used. In that case, it will for instance only return all arenas of the local server. This makes adding support for both solutions very easy, as you can just use this API if you plan to add support for remote servers, or just
getGameAPI()
if you don't.- Returns:
- The remote API. The API may change during the runtime
-
setRemoteAPI
Implement your own remote API.Generally, this API only gets replaced by the ProxySync addon. If it is not, because it for instance not installed, a general-use implementation will be used. In that case, it will for instance only return all arenas of the local server. This makes adding support for both solutions very easy, as you can just use this API if you plan to add support for remote servers, or just
getGameAPI()
if you don't.- Parameters:
remoteAPI
- The new remote API
-
getPlayerDataAPI
Contains API for getting and managing player data, such as stats and achievements.- Returns:
- The global PlayerDataAPI instance
-
getMessageAPI
Contains API for managing the messaging system.- Returns:
- The global MessageAPI instance
-
getAddonAPI
Contains API for handing addons.- Returns:
- The global AddonAPI instance
-
getHookAPI
Contains API for managing hooks.- Returns:
- The global HookAPI instance
-
getConfigurationAPI
Contains API for getting/setting configs, as well as saving config files.- Returns:
- The global ConfigurationAPI instance
-
getNMSHelper
Contains API/Helper to access NMS stuff.- Returns:
- The global NMSHelper instance
-
getHelper
Contains utility stuff.- Returns:
- The global Helper instance
-
getRootCommandsCollection
Returns the commands collection that contains all sub commands under /bw.- Returns:
- The very first commands collection
-
getWorldStorage
A world storage contains anything needed for creating custom entities or blocks. This may include a ranking statue or a holographic dealer.- Parameters:
world
- There's an unique storage for every world. This parameter specifies which one we want- Returns:
- The storage corresponding to the given world.
null
if the world doesn't exist anymore
-
prepareMigrationProcess
Initiate a process of migration from another system, such as a Bedwars plugin or storage system. This doesn't effectively start the process, you must do that usingMigrationProcess.run()
.- Returns:
- The process that has been initiated and is ready to be run
-
getRunningMigrationProcesses
Returns all running migration processes. Manually start one usingprepareMigrationProcess(MigrationProcess.Origin)
.- Returns:
- All running migration processes.
-
onReady
Calls the callback when the API is ready to use.This event can be called at any situation (given that MBedwars is even loaded) and it will always get an response.
We HIGHLY encourage you to use it as MBedwars can take some time until it's fully loaded. Using
ConfigsLoadEvent
is not an alternative as it does not get called when your plugin is getting reloaded afterwards.- Parameters:
runn
- The callback
-
getAPIVersion
public static int getAPIVersion()Returns the current version of the API.You can for instance use it during the enabling process of your plugin to identify if the latest supported version of MBedwars is installed.
Visit the following page to find a list with all api versions and their corresponding api version: https://s.marcely.de/mbww13try { Class apiClass = Class.forName("de.marcely.bedwars.api.BedwarsAPI"); int apiVersion = (int) apiClass.getMethod("getAPIVersion").invoke(null); if (apiVersion < 100) throw new IllegalStateException(); } catch(Exception e) { getLogger().warning("Sorry, your installed version of MBedwars is not supported. Please install at least v5.4"); Bukkit.getPluginManager().disable(this); return; }
- Returns:
- The API version of the currently running plugin
-