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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The default keyword used by this parser if none is specified.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorldParser(int priority)
    Constructs a new WorldParser with the default keyword and the specified priority.
    WorldParser(String keyword, int priority)
    Constructs a new WorldParser with the specified keyword and priority.
    WorldParser(String keyword, int priority, boolean ignoreCase)
    Constructs a new WorldParser with the specified parameters.
    WorldParser(String keyword, int priority, boolean ignoreCase, boolean lax)
    Constructs a new WorldParser with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected net.apartium.cocoabeans.commands.parsers.exception.InvalidParserResponse
    createNoSuchElementResponse(net.apartium.cocoabeans.commands.CommandProcessingContext context, String message, String attempted)
     
    Map<String,org.bukkit.World>
    Provides a map of world names to their corresponding World instances.

    Methods inherited from class net.apartium.cocoabeans.commands.parsers.MapBasedParser

    getMap

    Methods inherited from class net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser

    parse, tabCompletion, tryParse

    Methods inherited from class net.apartium.cocoabeans.commands.parsers.ArgumentParser

    compareTo, getArgumentType, getKeyword, getPriority, isSupportMultipleArguments

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_KEYWORD

      public static final String DEFAULT_KEYWORD
      The default keyword used by this parser if none is specified.
      See Also:
  • Constructor Details

    • WorldParser

      public WorldParser(String keyword, int priority, boolean ignoreCase, boolean lax)
      Constructs a new WorldParser with 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

      public WorldParser(String keyword, int priority, boolean ignoreCase)
      Constructs a new WorldParser with 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

      public WorldParser(String keyword, int priority)
      Constructs a new WorldParser with 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 new WorldParser with 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

      public Map<String,org.bukkit.World> getMap()
      Provides a map of world names to their corresponding World instances.
      Specified by:
      getMap in class net.apartium.cocoabeans.commands.parsers.MapBasedParser<org.bukkit.World>
      Returns:
      a Map where the keys are the names of all loaded worlds, and the values are the corresponding World instances.
    • createNoSuchElementResponse

      protected net.apartium.cocoabeans.commands.parsers.exception.InvalidParserResponse createNoSuchElementResponse(net.apartium.cocoabeans.commands.CommandProcessingContext context, String message, String attempted)
      Overrides:
      createNoSuchElementResponse in class net.apartium.cocoabeans.commands.parsers.ContextualMapBasedParser<org.bukkit.World>