org.bukkit.command.Command.getDescription()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.bukkit.command.Command.getDescription()方法的一些代码示例,展示了Command.getDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command.getDescription()方法的具体详情如下:
包路径:org.bukkit.command.Command
类名称:Command
方法名:getDescription

Command.getDescription介绍

[英]Gets a brief description of this command
[中]获取此命令的简要说明

代码示例

代码示例来源:origin: Bukkit/Bukkit

int i = command.getDescription().indexOf("\n");
if (i > 1) {
  shortText = command.getDescription().substring(0, i - 1);
} else {
  shortText = command.getDescription();
sb.append("Description: ");
sb.append(ChatColor.WHITE);
sb.append(command.getDescription());

代码示例来源:origin: EngineHub/CommandHelper

@Override
public String getDescription() {
  return cmd.getDescription();
}

代码示例来源:origin: EngineHub/CommandBook

@Override
  public String format(org.bukkit.command.Command entry) {
    return entry.getUsage() + " - "
        + entry.getDescription();
  }
}.display(sender, serverCommands, args.getFlagInteger('p', 1));

代码示例来源:origin: TotalFreedom/TotalFreedomMod

private static String buildDescription(Command command)
{
  StringBuilder sb = new StringBuilder();
  sb.append(
      "<li><span class=\"commandName\">{$CMD_NAME}</span> - Usage: <span class=\"commandUsage\">{$CMD_USAGE}</span>"
      .replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
      .replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
  if (!command.getAliases().isEmpty())
  {
    sb.append(
        " - Aliases: <span class=\"commandAliases\">{$CMD_ALIASES}</span>"
        .replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
  }
  sb.append(
      "<br><span class=\"commandDescription\">{$CMD_DESC}</span></li>\r\n"
      .replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
  return sb.toString();
}

代码示例来源:origin: SpigotMC/Spigot-API

int i = command.getDescription().indexOf("\n");
if (i > 1) {
  shortText = command.getDescription().substring(0, i - 1);
} else {
  shortText = command.getDescription();
sb.append("Description: ");
sb.append(ChatColor.WHITE);
sb.append(command.getDescription());

代码示例来源:origin: EngineHub/CommandBook

public void printCommandHelp(CommandSender sender, org.bukkit.command.Command cmd) {
  sender.sendMessage(ChatColor.YELLOW + "Command: " + cmd.getName());
  final String aliases = cmd.getAliases().toString().replaceAll("\\[(.*)\\]", "$1");
  if (aliases.length() > 0) {
    sender.sendMessage(ChatColor.YELLOW + "Aliases: " + aliases);
  }
  sender.sendMessage(ChatColor.YELLOW + "Description: " + cmd.getDescription());
  sender.sendMessage(ChatColor.YELLOW + "Usage: " + cmd.getUsage());
  if (cmd instanceof PluginCommand) {
    sender.sendMessage(ChatColor.YELLOW + "Plugin: " +
        ((PluginCommand)cmd).getPlugin().getDescription().getName());
  } else if (cmd instanceof DynamicPluginCommand) {
    sender.sendMessage(ChatColor.YELLOW + "Owner: " +
        ((DynamicPluginCommand) cmd).getOwner().getClass().getSimpleName());
  } else if (cmd instanceof VanillaCommand) {
    sender.sendMessage(ChatColor.YELLOW + "Vanilla command");
  }
}

相关文章