Class BedwarsAddon

java.lang.Object
de.marcely.bedwars.api.BedwarsAddon

public abstract class BedwarsAddon extends Object
Represents as an addon for this plugin.

Plugins may not use the addons feature, but we suggest to use it to keep everything organized.

  • Constructor Details

    • BedwarsAddon

      public BedwarsAddon(Plugin plugin)
      Parameters:
      plugin - The plugin that constructs it
  • Method Details

    • getPlugin

      public final Plugin getPlugin()
      Returns the plugin that's the owner of this addon.
      Returns:
      The plugin behind this addon.
    • getName

      public String 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

      public String 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

      public String[] 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

      @Nullable public @Nullable CommandsCollection getCommandsRoot()
      Returns the CommandsCollection that's bound to this addon. Might return null 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

      public File 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 during AddonRegisterEvent.

      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