org.bukkit.Server.getHelpMap()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(88)

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

Server.getHelpMap介绍

[英]Gets the HelpMap providing help topics for this server.
[中]获取提供此服务器帮助主题的帮助地图。

代码示例

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

/**
 * @see Server#getHelpMap()
 */
public static HelpMap getHelpMap() {
  return server.getHelpMap();
}

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

@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
  Validate.notNull(sender, "Sender cannot be null");
  Validate.notNull(args, "Arguments cannot be null");
  Validate.notNull(alias, "Alias cannot be null");
  if (args.length == 1) {
    List<String> matchedTopics = new ArrayList<String>();
    String searchString = args[0];
    for (HelpTopic topic : Bukkit.getServer().getHelpMap().getHelpTopics()) {
      String trimmedTopic = topic.getName().startsWith("/") ? topic.getName().substring(1) : topic.getName();
      if (trimmedTopic.startsWith(searchString)) {
        matchedTopics.add(trimmedTopic);
      }
    }
    return matchedTopics;
  }
  return ImmutableList.of();
}

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

protected HelpTopic findPossibleMatches(String searchString) {
  int maxDistance = (searchString.length() / 5) + 3;
  Set<HelpTopic> possibleMatches = new TreeSet<HelpTopic>(HelpTopicComparator.helpTopicComparatorInstance());
  if (searchString.startsWith("/")) {
    searchString = searchString.substring(1);
  }
  for (HelpTopic topic : Bukkit.getServer().getHelpMap().getHelpTopics()) {
    String trimmedTopic = topic.getName().startsWith("/") ? topic.getName().substring(1) : topic.getName();
    if (trimmedTopic.length() < searchString.length()) {
      continue;
    }
    if (Character.toLowerCase(trimmedTopic.charAt(0)) != Character.toLowerCase(searchString.charAt(0))) {
      continue;
    }
    if (damerauLevenshteinDistance(searchString, trimmedTopic.substring(0, searchString.length())) < maxDistance) {
      possibleMatches.add(topic);
    }
  }
  if (possibleMatches.size() > 0) {
    return new IndexHelpTopic("Search", null, null, possibleMatches, "Search for: " + searchString);
  } else {
    return null;
  }
}

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

HelpMap helpMap = Bukkit.getServer().getHelpMap();
HelpTopic topic = helpMap.getHelpTopic(command);

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

/**
 * @see Server#getHelpMap()
 */
public static HelpMap getHelpMap() {
  return server.getHelpMap();
}

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

@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
  Validate.notNull(sender, "Sender cannot be null");
  Validate.notNull(args, "Arguments cannot be null");
  Validate.notNull(alias, "Alias cannot be null");
  if (args.length == 1) {
    List<String> matchedTopics = new ArrayList<String>();
    String searchString = args[0];
    for (HelpTopic topic : Bukkit.getServer().getHelpMap().getHelpTopics()) {
      String trimmedTopic = topic.getName().startsWith("/") ? topic.getName().substring(1) : topic.getName();
      if (trimmedTopic.startsWith(searchString)) {
        matchedTopics.add(trimmedTopic);
      }
    }
    return matchedTopics;
  }
  return ImmutableList.of();
}

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

protected HelpTopic findPossibleMatches(String searchString) {
  int maxDistance = (searchString.length() / 5) + 3;
  Set<HelpTopic> possibleMatches = new TreeSet<HelpTopic>(HelpTopicComparator.helpTopicComparatorInstance());
  if (searchString.startsWith("/")) {
    searchString = searchString.substring(1);
  }
  for (HelpTopic topic : Bukkit.getServer().getHelpMap().getHelpTopics()) {
    String trimmedTopic = topic.getName().startsWith("/") ? topic.getName().substring(1) : topic.getName();
    if (trimmedTopic.length() < searchString.length()) {
      continue;
    }
    if (Character.toLowerCase(trimmedTopic.charAt(0)) != Character.toLowerCase(searchString.charAt(0))) {
      continue;
    }
    if (damerauLevenshteinDistance(searchString, trimmedTopic.substring(0, searchString.length())) < maxDistance) {
      possibleMatches.add(topic);
    }
  }
  if (possibleMatches.size() > 0) {
    return new IndexHelpTopic("Search", null, null, possibleMatches, "Search for: " + searchString);
  } else {
    return null;
  }
}

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

HelpMap helpMap = Bukkit.getServer().getHelpMap();
HelpTopic topic = helpMap.getHelpTopic(command);

相关文章

微信公众号

最新文章

更多

Server类方法