Class BetterCommand

java.lang.Object
kr.toxicity.command.impl.BetterCommand

public final class BetterCommand extends Object
BetterCommand!
  • Constructor Details

    • BetterCommand

      public BetterCommand(@NotNull @NotNull File dataFolder, @NotNull @NotNull net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.Component,String> serializer)
      BetterCommand initializer
      Parameters:
      dataFolder - data folder
      serializer - serializer (typically this is a MiniMessage)
    • BetterCommand

      public BetterCommand(@NotNull @NotNull File dataFolder, @NotNull @NotNull net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.Component,String> serializer, @NotNull @NotNull CommandLogger logger)
      BetterCommand initializer
      Parameters:
      dataFolder - data folder
      serializer - serializer (typically this is a MiniMessage)
      logger - logger
  • Method Details

    • addSerializer

      @NotNull public <T> @NotNull BetterCommand addSerializer(@NotNull @NotNull Class<T> clazz, ClassSerializer<? extends T> serializer)
      Adds class serializer
      Type Parameters:
      T - type of target class
      Parameters:
      clazz - target class
      serializer - serializer of class
      Returns:
      self
    • silentLog

      @NotNull public @NotNull BetterCommand silentLog(Supplier<Boolean> silentLog)
      Sets whether to disable log
      Parameters:
      silentLog - checker
      Returns:
      self
    • prefix

      @NotNull public @NotNull BetterCommand prefix(@NotNull @NotNull CommandPrefix prefix)
      Sets command prefix
      Parameters:
      prefix - prefix
      Returns:
      self
    • exceptionHandler

      @NotNull public @NotNull BetterCommand exceptionHandler(@NotNull @NotNull Consumer<Throwable> handler)
      Sets exception handler
      Parameters:
      handler - handler
      Returns:
      self
    • prefix

      @NotNull public @NotNull CommandPrefix prefix()
      Gets command prefix
      Returns:
      prefix
    • logger

      @NotNull public @NotNull CommandLogger logger()
      Gets command logger
      Returns:
      logger
    • reload

      @NotNull public @NotNull ReloadState reload()
      Reload lang file
      Returns:
      state
      See Also:
    • generateDefaultLang

      public boolean generateDefaultLang(@NotNull @NotNull Locale locale)
      Generates lang file fit locale
      Parameters:
      locale - target locale
      Returns:
      whether to success
    • registerKey

      @NotNull public @NotNull MessageSender registerKey(@NotNull @NotNull CommandMessage message)
      Creates message sender depend on message
      Parameters:
      message - target message
      Returns:
      message sender
    • module

      @NotNull public <W extends BetterCommandSource> @NotNull CommandModule<W> module(@NotNull @NotNull String name)
      Creates a command module
      Type Parameters:
      W - wrapper class of platform-side command source (normally it is a wrapper class of CommandSourceStack)
      Parameters:
      name - command name
      Returns:
      command module
    • prefix

      @NotNull public @NotNull net.kyori.adventure.text.Component prefix(@NotNull @NotNull BetterCommandSource source, @NotNull @NotNull BetterCommand.PrefixType type)
      Gets prefix component.
      Parameters:
      type - prefix type
      source - component source
      Returns:
      prefix component