Package de.marcely.bedwars.api.arena
Class CustomMode
java.lang.Object
de.marcely.bedwars.api.arena.CustomMode
Represents a custom (non-Bedwars) game mode that can be applied to arenas.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanattemptSet(Arena arena) Attempts to set this custom mode to the specified arena.final Collection<Arena> Gets all arenas that have this custom mode applied.abstract StringgetName()Gets the name of this custom mode.abstract PluginGets the plugin that provides this custom mode.getType()Gets the officially-recognized type of this custom mode.final booleanChecks whether this custom mode is applied to the specified arena.final booleanChecks whether this custom mode is registered.abstract voidGets called by MBedwars when this custom mode is registered.abstract voidGets called by MBedwars when this custom mode is unregistered.protected final booleanAttempts to unset this custom mode from the specified arena.
-
Constructor Details
-
CustomMode
public CustomMode()
-
-
Method Details
-
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
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
Gets the officially-recognized type of this custom mode.- Returns:
- The type
-
attemptSet
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:
trueif successful, otherwisefalse
-
unset
Attempts to unset this custom mode from the specified arena.- Parameters:
arena- the arena to unset the custom mode from- Returns:
trueif successful, otherwisefalse
-
is
Checks whether this custom mode is applied to the specified arena.- Parameters:
arena- the arena to check- Returns:
trueif this custom mode is applied to the arena, otherwisefalse
-
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:
trueif registered, otherwisefalse
-