类 FixedSetPrompt

java.lang.Object
org.bukkit.conversations.ValidatingPrompt
org.bukkit.conversations.FixedSetPrompt
所有已实现的接口:
Cloneable, Prompt

public abstract class FixedSetPrompt extends ValidatingPrompt
FixedSetPrompt 是任何需要用户从固定集合中响应的提示的基类。
  • 字段详细资料

  • 构造器详细资料

    • FixedSetPrompt

      public FixedSetPrompt(@NotNull @NotNull String... fixedSet)
      从一组字符串创建一个 FixedSetPrompt。

      foo = new FixedSetPrompt("bar", "cheese", "panda");

      原文: Creates a FixedSetPrompt from a set of strings.

      foo = new FixedSetPrompt("bar", "cheese", "panda");

      参数:
      fixedSet - 一组固定的字符串,用户必须输入其中之一。
  • 方法详细资料

    • isInputValid

      protected boolean isInputValid(@NotNull @NotNull ConversationContext context, @NotNull @NotNull String input)
      从类复制的说明: ValidatingPrompt
      覆盖此方法以检查玩家输入的有效性。

      原文: Override this method to check the validity of the player's input.

      指定者:
      isInputValid 在类中 ValidatingPrompt
      参数:
      context - 关于对话的上下文信息。
      input - 玩家的原始控制台输入。
      返回:
      根据输入的有效性返回 true 或 false。
    • formatFixedSet

      @NotNull protected @NotNull String formatFixedSet()
      创建一个包含构造函数中声明的所有选项的格式化字符串的实用函数。

      原文: Utility function to create a formatted string containing all the options declared in the constructor.

      返回:
      格式化的选项,如 "[bar, cheese, panda]"(如果 bar、cheese 和 panda 是使用的选项)。