Interface ArenaPickerAPI
public interface ArenaPickerAPI
This class contains all the API that is relevant to arena pickers.
In case you are looking to obtain an arena given by a condition, you may simply use GameAPI.getArenaByName(String)
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArenaPickerAPI
get()
Returns the global ArenaPickerAPI instance.getArenasByCondition
(String string) Parses the given condition and returns all arenas for which the condition applies to.@Nullable ArenaConditionVariable
<?> Tries to get a condition variable given by its name.Gets the names of all registered condition variables.Gets all condition registered condition variables.@Nullable ArenaSelector
getSelectorByName
(String name) Tries to find a selector given by its name.Gets the names of all registered selectors.Gets the instances of all registered selectors.boolean
isConditionVariableRegistered
(ArenaConditionVariable<?> variable) Gets whether a given condition variable instance is currently registeredboolean
isSelectorRegistered
(ArenaSelector selector) Find out whether a selector is currently registeredparseCondition
(String string) Parses the condition.parsePicker
(String string) Parses the picker.boolean
registerConditionVariable
(ArenaConditionVariable<?> variable) Tries to register the condition variableboolean
registerSelector
(ArenaSelector selector) Tries to register a new selector instance.boolean
unregisterConditionVariable
(ArenaConditionVariable<?> variable) Tries to unregister the condition variableboolean
unregisterSelector
(ArenaSelector selector) Tries to unregister the given selector instance.
-
Method Details
-
getArenasByCondition
Parses the given condition and returns all arenas for which the condition applies to.An example of an arena condition is [status=2 & teams=4]
- Parameters:
string
- The arena condition string that will be parsed.- Returns:
- All arenas that meet the pickers conditions
- Throws:
ArenaConditionParseException
- When it failed to parse the String
-
parsePicker
ArenaPicker parsePicker(String string) throws ArenaConditionParseException, ArenaPickerParseException Parses the picker.- Parameters:
string
- The String that will be parsed- Returns:
- The parsed picker
- Throws:
ArenaConditionParseException
- When it failed to parse the condition (because of e.g. malformed syntax)ArenaPickerParseException
- When it failed to parse the picker (because of e.g. malformed syntax)
-
parseCondition
Parses the condition.- Parameters:
string
- The String that will be parsed- Returns:
- The parsed condition
- Throws:
ArenaConditionParseException
- When it failed (because of e.g. malformed syntax)
-
getConditionVariableNames
Gets the names of all registered condition variables.- Returns:
- All registered condition variable names
-
getConditionVariables
Collection<ArenaConditionVariable<?>> getConditionVariables()Gets all condition registered condition variables.- Returns:
- All registered condition variables
-
getConditionVariableByName
Tries to get a condition variable given by its name.- Parameters:
name
- The name of the condition variable- Returns:
- The matching condition variable.
null
if none has been found
-
registerConditionVariable
Tries to register the condition variable- Parameters:
variable
- The condition variable instance- Returns:
true
when it succeded. May fail when e.g. the name is already taken
-
unregisterConditionVariable
Tries to unregister the condition variable- Parameters:
variable
- The condition variable instance- Returns:
true
when it has been found and removed
-
isConditionVariableRegistered
Gets whether a given condition variable instance is currently registered- Parameters:
variable
- The condition variable instance- Returns:
true
when it's currently registered
-
getSelectorNames
Gets the names of all registered selectors.- Returns:
- The names of all selectors
-
getSelectors
Collection<ArenaSelector> getSelectors()Gets the instances of all registered selectors.- Returns:
- All registered selectors
-
getSelectorByName
Tries to find a selector given by its name.- Parameters:
name
- Its name- Returns:
- The matching instance.
null
in case none has been found
-
registerSelector
Tries to register a new selector instance.- Parameters:
selector
- The instance that shall be registered- Returns:
true
when it succeded. May fail when e.g. the name is already taken
-
unregisterSelector
Tries to unregister the given selector instance.- Parameters:
selector
- The instance that shall be removed- Returns:
true
when it has been found and unregistered
-
isSelectorRegistered
Find out whether a selector is currently registered- Parameters:
selector
- The given instance- Returns:
true
in case it's currently registered
-
get
Returns the global ArenaPickerAPI instance.- Returns:
- The global ArenaPickerAPI instance
-