程序包 org.bukkit.help

类 HelpTopic

java.lang.Object
org.bukkit.help.HelpTopic
直接已知子类:
GenericCommandHelpTopic, IndexHelpTopic

public abstract class HelpTopic extends Object
HelpTopic实现在用户使用/help命令时显示给用户.

此类的自定义实现可以在两个层面上工作. 简单实现只需要在构造函数中设置name、shortText和fullText的值. 此基类将处理其余部分.

复杂实现可以通过覆盖此类中所有方法的行为来创建.

  • 字段详细资料

    • name

      protected String name
    • shortText

      protected String shortText
    • fullText

      protected String fullText
    • amendedPermission

      protected String amendedPermission
  • 构造器详细资料

    • HelpTopic

      public HelpTopic()
  • 方法详细资料

    • canSee

      public abstract boolean canSee(@NotNull @NotNull CommandSender player)
      确定Player是否被允许查看此帮助主题.

      HelpTopic实现在确定主题可见性时应考虑服务器管理员通过amendCanSee(String)函数设置的意愿.

      原文: Determines if a Player is allowed to see this help topic.

      HelpTopic implementations should take server administrator wishes into account as set by the amendCanSee(String) function.

      参数:
      player - 相关的Player.
      返回:
      如果Player可以看到此帮助主题则为True, 否则为false.
    • amendCanSee

      public void amendCanSee(@Nullable @Nullable String amendedPermission)
      允许服务器管理员覆盖查看帮助主题所需的权限.

      HelpTopic实现在canSee(org.bukkit.command.CommandSender)函数中确定主题可见性时应考虑这一点.

      原文: Allows the server administrator to override the permission required to see a help topic.

      HelpTopic implementations should take this into account when determining topic visibility on the canSee(org.bukkit.command.CommandSender) function.

      参数:
      amendedPermission - 服务器管理员希望应用于此主题的权限节点.
    • getName

      @NotNull public @NotNull String getName()
      返回此帮助主题的名称.

      原文: Returns the name of this help topic.

      返回:
      主题名称.
    • getShortText

      @NotNull public @NotNull String getShortText()
      返回将在主题索引中显示的简要描述.

      原文: Returns a brief description that will be displayed in the topic index.

      返回:
      简要的主题描述.
    • getFullText

      @NotNull public @NotNull String getFullText(@NotNull @NotNull CommandSender forWho)
      返回当用户请求此主题详情时显示的完整帮助主题描述.

      结果将被分页以适当适应用户的客户端.

      原文: Returns the full description of this help topic that is displayed when the user requests this topic's details.

      The result will be paginated to properly fit the user's client.

      参数:
      forWho - 请求完整文本的玩家或控制台. 对于在自定义实现中基于子权限进一步安全裁剪命令完整文本很有用.
      返回:
      完整的主题描述.
    • amendTopic

      public void amendTopic(@Nullable @Nullable String amendedShortText, @Nullable @Nullable String amendedFullText)
      允许服务器管理员(或另一个插件)添加或替换帮助主题的内容.

      任一参数为null将保留该部分主题不变. 在任一修改参数中, 字符串<text>将被替换为帮助主题中的现有内容. 使用此方法可以将额外内容追加或预置到自动生成的帮助主题中.

      原文: Allows the server admin (or another plugin) to add or replace the contents of a help topic.

      A null in either parameter will leave that part of the topic unchanged. In either amending parameter, the string <text> is replaced with the existing contents in the help topic. Use this to append or prepend additional content into an automatically generated help topic.

      参数:
      amendedShortText - 要使用的新主题短文本, 或null保持不变.
      amendedFullText - 要使用的新主题完整文本, 或null保持不变.
    • applyAmendment

      @NotNull protected @NotNull String applyAmendment(@NotNull @NotNull String baseText, @Nullable @Nullable String amendment)
      实现自定义HelpTopic的开发者可以使用此工具方法来确保其实现符合amendTopic(String, String)方法的预期行为.

      原文: Developers implementing their own custom HelpTopic implementations can use this utility method to ensure their implementations comply with the expected behavior of the amendTopic(String, String) method.

      参数:
      baseText - 帮助主题的现有文本.
      amendment - 来自amendTopic()方法的修改文本.
      返回:
      根据amendTopic()的预期规则将修改文本应用于现有文本的结果.