Command.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:StartupCommands 作者:
/**
 * Loads all of the startup commands from the plugin's configuration file.
 * @param plugin the StartupCommands plugin instance
 */
public static void loadCommands(StartupCommands plugin) {
    FileConfiguration config = plugin.getConfig();

        if (config.getConfigurationSection("commands") == null) {
            plugin.getLogger().info("There are no startup commands present.");
        } else {
            int delay = 0;

            for (String command : config.getConfigurationSection("commands").getKeys(false)) {
                delay = config.getInt("commands." + command + ".delay", 0);

                // Try to create the command
                try {
                    plugin.getCommands().add(new Command(command, delay));
                } catch (IllegalArgumentException e) {
                    plugin.getLogger().severe(e.getMessage());
                }
            }
        }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号