热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中org.bukkit.command.Command.getUsage()方法的一些代码示例,展示了Command.getUsage()

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

Command.getUsage介绍

[英]Gets an example usage of this command
[中]获取此命令的示例用法

代码示例

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

sb.append("Usage: ");
sb.append(ChatColor.WHITE);
sb.append(command.getUsage().replace("", name.substring(1)));

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

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

代码示例来源: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: NoCheatPlus/NoCheatPlus

public CommandsCommand(JavaPlugin plugin) {
super(plugin, "commands", Permissions.COMMAND_COMMANDS, new String[]{"cmds"});
for (int i = 0; i moreCommands[i] = moreCommands[i].replace("", "ncp");
}
String all = TAG + "All commands info:\n";
Command cmd = plugin.getCommand("nocheatplus");
if (cmd != null){
all += cmd.getUsage().replace("", "ncp");
}
all += StringUtil.join(Arrays.asList(moreCommands), "\n");
allCommands = all;
}

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

private static String buildDescription(Command command)
{
StringBuilder sb = new StringBuilder();
sb.append(
"

  • {$CMD_NAME} - Usage: {$CMD_USAGE}"
    .replace("{$CMD_NAME}", escapeHtml4(command.getName().trim()))
    .replace("{$CMD_USAGE}", escapeHtml4(command.getUsage().trim())));
    if (!command.getAliases().isEmpty())
    {
    sb.append(
    " - Aliases: {$CMD_ALIASES}"
    .replace("{$CMD_ALIASES}", escapeHtml4(StringUtils.join(command.getAliases(), ", "))));
    }
    sb.append(
    "
    {$CMD_DESC}
  • \r\n"
    .replace("{$CMD_DESC}", escapeHtml4(command.getDescription().trim())));
    return sb.toString();
    }

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

    sb.append("Usage: ");
    sb.append(ChatColor.WHITE);
    sb.append(command.getUsage().replace("", name.substring(1)));

    代码示例来源: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");
    }
    }

    推荐阅读
    author-avatar
    益林代表_610
    这个家伙很懒,什么也没留下!
    PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有