Java 类org.bukkit.help.HelpTopic 实例源码

项目:Uranium    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Uranium    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Skript    文件:ScriptCommand.java   
public void registerHelp() {
    helps.clear();
    final HelpMap help = Bukkit.getHelpMap();
    final HelpTopic t = new GenericCommandHelpTopic(bukkitCommand);
    help.addTopic(t);
    helps.add(t);
    final HelpTopic aliases = help.getHelpTopic("Aliases");
    if (aliases != null && aliases instanceof IndexHelpTopic) {
        aliases.getFullText(Bukkit.getConsoleSender()); // CraftBukkit has a lazy IndexHelpTopic class (org.bukkit.craftbukkit.help.CustomIndexHelpTopic) - maybe its used for aliases as well
        try {
            final Field topics = IndexHelpTopic.class.getDeclaredField("allTopics");
            topics.setAccessible(true);
            @SuppressWarnings("unchecked")
            final ArrayList<HelpTopic> as = new ArrayList<HelpTopic>((Collection<HelpTopic>) topics.get(aliases));
            for (final String alias : activeAliases) {
                final HelpTopic at = new CommandAliasHelpTopic("/" + alias, "/" + getLabel(), help);
                as.add(at);
                helps.add(at);
            }
            Collections.sort(as, HelpTopicComparator.helpTopicComparatorInstance());
            topics.set(aliases, as);
        } catch (final Exception e) {
            Skript.outdatedError(e);//, "error registering aliases for /" + getName());
        }
    }
}
项目:Skript    文件:ScriptCommand.java   
public void unregisterHelp() {
    Bukkit.getHelpMap().getHelpTopics().removeAll(helps);
    final HelpTopic aliases = Bukkit.getHelpMap().getHelpTopic("Aliases");
    if (aliases != null && aliases instanceof IndexHelpTopic) {
        try {
            final Field topics = IndexHelpTopic.class.getDeclaredField("allTopics");
            topics.setAccessible(true);
            @SuppressWarnings("unchecked")
            final ArrayList<HelpTopic> as = new ArrayList<HelpTopic>((Collection<HelpTopic>) topics.get(aliases));
            as.removeAll(helps);
            topics.set(aliases, as);
        } catch (final Exception e) {
            Skript.outdatedError(e);//, "error unregistering aliases for /" + getName());
        }
    }
    helps.clear();
}
项目:ThermosRebased    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:ThermosRebased    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Thermos-Bukkit    文件:HelpCommand.java   
@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();
}
项目:Thermos    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Thermos    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:KCauldron    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:KCauldron    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:CauldronGit    文件:HelpCommand.java   
@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();
}
项目:CauldronGit    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:CauldronGit    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Cauldron-Old    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Cauldron-Old    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Cauldron-Reloaded    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Cauldron-Reloaded    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:FFoKC    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:FFoKC    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:CraftBukkit    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:CraftBukkit    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Craftbukkit    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Craftbukkit    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Almura-Server    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Almura-Server    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Tweakkit-Server    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Tweakkit-Server    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Cauldron    文件:HelpCommand.java   
@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();
}
项目:Cauldron    文件:HelpCommand.java   
@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();
}
项目:Cauldron    文件:HelpCommand.java   
@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();
}
项目:Cauldron    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Cauldron    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Almura-API    文件:HelpCommand.java   
@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();
}
项目:SpigotSource    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:SpigotSource    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}
项目:Spigot-API    文件:HelpCommand.java   
@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();
}
项目:Bukkit-JavaDoc    文件:HelpCommand.java   
@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();
}
项目:Craft-city    文件:HelpYamlReader.java   
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
项目:Craft-city    文件:CustomIndexHelpTopic.java   
@Override
public String getFullText(CommandSender sender) {
    if (futureTopics != null) {
        List<HelpTopic> topics = new LinkedList<HelpTopic>();
        for (String futureTopic : futureTopics) {
            HelpTopic topic = helpMap.getHelpTopic(futureTopic);
            if (topic != null) {
                topics.add(topic);
            }
        }
        setTopicsCollection(topics);
        futureTopics = null;
    }

    return super.getFullText(sender);
}