Class BedwarsAddon
Plugins may not use the addons feature, but we suggest to use it to keep everything organized.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionString[]
Returns the authors that created the addon.@Nullable CommandsCollection
Returns the CommandsCollection that's bound to this addon.Returns the data folder of this addon.getName()
Returns the name of this addon.final Plugin
Returns the plugin that's the owner of this addon.Returns the version of this addon.final boolean
Returns whether or not this addon is registered and ready to be used.final boolean
register()
Tries to register this addon.final boolean
Tries to unregister this addon.
-
Constructor Details
-
BedwarsAddon
- Parameters:
plugin
- The plugin that constructs it
-
-
Method Details
-
getPlugin
Returns the plugin that's the owner of this addon.- Returns:
- The plugin behind this addon.
-
getName
Returns the name of this addon.By default it uses the
getPlugin()
's name and cuts of "MBedwars_" (if it's in the name). Plugins are able to provide a custom name by simply overriding this method.Try to keep it unique as addons with equal names won't get registered.
- Returns:
- The name of this addon
-
getVersion
Returns the version of this addon.By default it's using the version of
getPlugin()
, but it's safe for plugins to override this method.- Returns:
- The version of this addon
-
getAuthors
Returns the authors that created the addon.By default it's using the authors provided by
getPlugin()
, but it's safe for plugins to override this method.- Returns:
- The authors that created this addon
-
getCommandsRoot
Returns the CommandsCollection that's bound to this addon. Might returnnull
if the addon isn't registered.Addons may add their own commands to this CommandsCollection. You may also add it somewhere else, but we suggest you to add it here to keep everything in order.
It's safe for addons to replace this method and to just use an other collection.
- Returns:
null
if it's not registered, otherwise the CommandsCollection which contains all the admin commands of this addon
-
getDataFolder
Returns the data folder of this addon.We suggest you to not override it to keep everything in order, but otherwise it's safe for addons to override it.
- Returns:
- The folder which contains all the data (e.g. configs) of this plugin
-
register
public final boolean register()Tries to register this addon.Returns
false
if there's already an addon registered under this name or when it got cancelled duringAddonRegisterEvent
.- Returns:
true
if it was successful- Throws:
IllegalStateException
- If there are issues with some of the properties of this addon
-
unregister
public final boolean unregister()Tries to unregister this addon.- Returns:
false
if it's already not registered
-
isRegistered
public final boolean isRegistered()Returns whether or not this addon is registered and ready to be used.- Returns:
true
if it's registered
-