Class WorldTypeParser
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.WorldType>
net.apartium.cocoabeans.commands.spigot.parsers.WorldTypeParser
- All Implemented Interfaces:
Comparable<net.apartium.cocoabeans.commands.parsers.ArgumentParser<?>>
@AvailableSince("0.0.49")
public class WorldTypeParser
extends net.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.WorldType>
A parser for mapping world type names to
WorldType objects.
This parser is based on a map where the keys are world type names,
and the values are corresponding WorldType 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 -
Constructor Summary
ConstructorsConstructorDescriptionWorldTypeParser(int priority) Constructs a newWorldTypeParserwith the default keyword and the specified priority.WorldTypeParser(String keyword, int priority) Constructs a newWorldTypeParserwith the specified keyword and priority.WorldTypeParser(String keyword, int priority, boolean ignoreCase) Constructs a newWorldTypeParserwith the specified parameters.WorldTypeParser(String keyword, int priority, boolean ignoreCase, boolean lax) Constructs a newWorldTypeParserwith 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 type names to their correspondingWorldTypeinstances.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
-
Constructor Details
-
WorldTypeParser
Constructs a newWorldTypeParserwith 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.
-
WorldTypeParser
Constructs a newWorldTypeParserwith 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.
-
WorldTypeParser
Constructs a newWorldTypeParserwith 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.
-
WorldTypeParser
public WorldTypeParser(int priority) Constructs a newWorldTypeParserwith 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 type names to their correspondingWorldTypeinstances.- Specified by:
getMapin classnet.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.WorldType>- Returns:
- a
Mapwhere the keys are the names of all world types, and the values are the correspondingWorldTypeinstances.
-
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.WorldType>
-