Class WorldParser
java.lang.Object
net.apartium.cocoabeans.commands.parsers.ArgumentParser<T>
net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser<T>
net.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.World>
net.apartium.cocoabeans.commands.spigot.parsers.WorldParser
- All Implemented Interfaces:
Comparable<net.apartium.cocoabeans.commands.parsers.ArgumentParser<?>>
@AvailableSince("0.0.38")
public class WorldParser
extends net.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.World>
A parser for mapping world names to
World objects.
This parser is based on a map where the keys are world names,
and the values are corresponding World instances.
It allows customization of keyword, priority, case sensitivity, and lax mode.-
Nested Class Summary
Nested classes/interfaces inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
net.apartium.cocoabeans.commands.parsers.ArgumentParser.ParseResult<T extends Object>, net.apartium.cocoabeans.commands.parsers.ArgumentParser.TabCompletionResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default keyword used by this parser if none is specified. -
Constructor Summary
ConstructorsConstructorDescriptionWorldParser(int priority) Constructs a newWorldParserwith the default keyword and the specified priority.WorldParser(String keyword, int priority) Constructs a newWorldParserwith the specified keyword and priority.WorldParser(String keyword, int priority, boolean ignoreCase) Constructs a newWorldParserwith the specified parameters.WorldParser(String keyword, int priority, boolean ignoreCase, boolean lax) Constructs a newWorldParserwith the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected net.apartium.cocoabeans.commands.parsers.exception.InvalidParserResponsecreateNoSuchElementResponse(net.apartium.cocoabeans.commands.CommandProcessingContext context, String message, String attempted) getMap()Provides a map of world names to their correspondingWorldinstances.Methods inherited from class net.apartium.cocoabeans.commands.parsers.MapBasedParser
getMapMethods inherited from class net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser
parse, tabCompletion, tryParseMethods inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser
compareTo, getArgumentType, getKeyword, getPriority, isSupportMultipleArguments
-
Field Details
-
DEFAULT_KEYWORD
The default keyword used by this parser if none is specified.- See Also:
-
-
Constructor Details
-
WorldParser
Constructs a newWorldParserwith the specified parameters.- Parameters:
keyword- the keyword associated with this parser.priority- the priority of the parser, used for ordering.ignoreCase- whether the parser should ignore case when matching keys.lax- whether the parser should operate in lax mode, allowing more flexible parsing behavior.
-
WorldParser
Constructs a newWorldParserwith the specified parameters. Assumes lax mode is disabled.- Parameters:
keyword- the keyword associated with this parser.priority- the priority of the parser, used for ordering.ignoreCase- whether the parser should ignore case when matching keys.
-
WorldParser
Constructs a newWorldParserwith the specified keyword and priority. Assumes case sensitivity and lax mode are disabled.- Parameters:
keyword- the keyword associated with this parser.priority- the priority of the parser, used for ordering.
-
WorldParser
public WorldParser(int priority) Constructs a newWorldParserwith the default keyword and the specified priority. Assumes case sensitivity and lax mode are disabled.- Parameters:
priority- the priority of the parser, used for ordering.
-
-
Method Details
-
getMap
Provides a map of world names to their correspondingWorldinstances.- Specified by:
getMapin classnet.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.World>- Returns:
- a
Mapwhere the keys are the names of all loaded worlds, and the values are the correspondingWorldinstances.
-
createNoSuchElementResponse
protected net.apartium.cocoabeans.commands.parsers.exception.InvalidParserResponse createNoSuchElementResponse(net.apartium.cocoabeans.commands.CommandProcessingContext context, String message, String attempted) - Overrides:
createNoSuchElementResponsein classnet.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser<org.bukkit.World>
-