Class CustomMode

java.lang.Object
de.marcely.bedwars.api.arena.CustomMode

public abstract class CustomMode extends Object
Represents a custom (non-Bedwars) game mode that can be applied to arenas.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final boolean
    Attempts to set this custom mode to the specified arena.
    Gets all arenas that have this custom mode applied.
    abstract String
    Gets the name of this custom mode.
    abstract Plugin
    Gets the plugin that provides this custom mode.
    Gets the officially-recognized type of this custom mode.
    final boolean
    is(Arena arena)
    Checks whether this custom mode is applied to the specified arena.
    final boolean
    Checks whether this custom mode is registered.
    abstract void
    Gets called by MBedwars when this custom mode is registered.
    abstract void
    Gets called by MBedwars when this custom mode is unregistered.
    protected final boolean
    unset(Arena arena)
    Attempts to unset this custom mode from the specified arena.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomMode

      public CustomMode()
  • Method Details

    • getName

      public abstract String getName()
      Gets the name of this custom mode.

      Must be in snake case without spaces or special characters. Example: ultimate_games

      Returns:
      the name of the custom mode
    • getPlugin

      public abstract Plugin getPlugin()
      Gets the plugin that provides this custom mode.
      Returns:
      the plugin
    • onRegister

      public abstract void onRegister()
      Gets called by MBedwars when this custom mode is registered.

      More specifically, after GameAPI.registerCustomMode(CustomMode) is called and the mode is successfully registered.

      Purpose of this is to attempt to set any arena that should have this mode applied on server start. Use attemptSet(Arena) for this.

    • onUnregister

      public abstract void onUnregister()
      Gets called by MBedwars when this custom mode is unregistered.

      Purpose of this is to clean up any resources, such as schedulers or event handlers.

      There is no need to unset arenas from this mode, as MBedwars will do that automatically after this method is called.

    • getType

      public CustomModeType getType()
      Gets the officially-recognized type of this custom mode.
      Returns:
      The type
    • attemptSet

      protected final boolean attemptSet(Arena arena)
      Attempts to set this custom mode to the specified arena.

      May fail if the arena already has a custom mode set or this mode isn't registered.

      Parameters:
      arena - the arena to set the custom mode to
      Returns:
      true if successful, otherwise false
    • unset

      protected final boolean unset(Arena arena)
      Attempts to unset this custom mode from the specified arena.
      Parameters:
      arena - the arena to unset the custom mode from
      Returns:
      true if successful, otherwise false
    • is

      public final boolean is(Arena arena)
      Checks whether this custom mode is applied to the specified arena.
      Parameters:
      arena - the arena to check
      Returns:
      true if this custom mode is applied to the arena, otherwise false
    • getArenas

      public final Collection<Arena> getArenas()
      Gets all arenas that have this custom mode applied.
      Returns:
      all local arenas with this custom mode
    • isRegistered

      public final boolean isRegistered()
      Checks whether this custom mode is registered.
      Returns:
      true if registered, otherwise false