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 ArenaPickerAPIget()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 ArenaSelectorgetSelectorByName(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.booleanisConditionVariableRegistered(ArenaConditionVariable<?> variable) Gets whether a given condition variable instance is currently registeredbooleanisSelectorRegistered(ArenaSelector selector) Find out whether a selector is currently registeredparseCondition(String string) Parses the condition.parsePicker(String string) Parses the picker.booleanregisterConditionVariable(ArenaConditionVariable<?> variable) Tries to register the condition variablebooleanregisterSelector(ArenaSelector selector) Tries to register a new selector instance.booleanunregisterConditionVariable(ArenaConditionVariable<?> variable) Tries to unregister the condition variablebooleanunregisterSelector(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)- See Also:
-
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)- See Also:
-
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.
nullif none has been found
-
registerConditionVariable
Tries to register the condition variable- Parameters:
variable- The condition variable instance- Returns:
truewhen 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:
truewhen it has been found and removed
-
isConditionVariableRegistered
Gets whether a given condition variable instance is currently registered- Parameters:
variable- The condition variable instance- Returns:
truewhen 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.
nullin case none has been found
-
registerSelector
Tries to register a new selector instance.- Parameters:
selector- The instance that shall be registered- Returns:
truewhen 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:
truewhen it has been found and unregistered
-
isSelectorRegistered
Find out whether a selector is currently registered- Parameters:
selector- The given instance- Returns:
truein case it's currently registered
-
get
Returns the global ArenaPickerAPI instance.- Returns:
- The global ArenaPickerAPI instance
-