当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getKeys方法代码示例

本文整理汇总了Java中org.bukkit.configuration.Configuration.getKeys方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getKeys方法的具体用法?Java Configuration.getKeys怎么用?Java Configuration.getKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getKeys方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: I18n

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public I18n(Locale locale, Configuration configuration) {
	this(locale, new HashMap<String, String>(), null);
	for (String key : configuration.getKeys(true)) {
		Object obj = configuration.get(key);
		if (obj instanceof CharSequence) {
			this.map.put(key, obj.toString());
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:10,代码来源:I18n.java

示例2: MapManager

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public MapManager(Annihilation plugin, MapLoader loader, Configuration config) {
    mapLoader = loader;
    for (String s : config.getKeys(false)) {
        if (!s.equalsIgnoreCase("lobby"))
            maps.add(s);
    }

    WorldCreator wc = new WorldCreator("lobby");
    wc.generator(new VoidGenerator());
    Bukkit.createWorld(wc);

    lobbySpawn = parseLocation(config.getString("lobby.spawn"));
}
 
开发者ID:cancabron,项目名称:Annihilation,代码行数:14,代码来源:MapManager.java

示例3: MapManager

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public MapManager(CrafterNexus plugin, MapRollback loader, Configuration config) {
    mapLoader = loader;
    for (String s : config.getKeys(false)) {
        if (!s.equalsIgnoreCase("lobby"))
            maps.add(s);
    }

    WorldCreator wc = new WorldCreator("lobby");
    wc.generator(new VoidGenerator());
    Bukkit.createWorld(wc);

    lobbySpawn = parseLocation(config.getString("lobby.spawn"));
}
 
开发者ID:MCTyler,项目名称:CrafterNexus,代码行数:14,代码来源:MapManager.java

示例4: VersionInfo

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public VersionInfo(final Configuration updateConfig, final String path)
{
	changelog = updateConfig.getStringList(path + ".changelog");
	minBukkit = updateConfig.getInt(path + ".min-bukkit", 0);
	maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0);
	modules = new HashMap<String, ModuleInfo>();
	final String modulesPath = path + ".modules";
	for (String module : updateConfig.getKeys(false))
	{
		modules.put(module, new ModuleInfo(updateConfig, modulesPath + module));
	}
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:13,代码来源:VersionInfo.java

示例5: load

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void load() {
    Configuration config = YamlLoader.loadResource(plugin, "config.yml");
    
    for (String k : config.getKeys(true)) {
        if (!config.isConfigurationSection(k)) {
            this.put(k, config.getString(k));
        }
    }
}
 
开发者ID:ericpauley,项目名称:CommandIt,代码行数:11,代码来源:Config.java

示例6: load

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void load() {
    Configuration config = YamlLoader.loadResource(plugin, "messages.yml");
    
    for (String k : config.getKeys(true)) {
        if (!config.isConfigurationSection(k)) {
            this.put(k, config.getString(k));
        }
    }
}
 
开发者ID:ericpauley,项目名称:CommandIt,代码行数:14,代码来源:Messages.java

示例7: loadResource

import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Loads or updates a YAML configuration file
 * 
 * @param plugin
 * @param filename
 * @return
 */
public static Configuration loadResource(JavaPlugin plugin, String filename) {
    File f = new File(plugin.getDataFolder(), filename);
    
    // Load the included file
    FileConfiguration internal = YamlConfiguration.loadConfiguration(plugin.getResource(filename));
    
    // Write the included file if an external one doesn't exist
    if (!f.exists()) {
        plugin.getLogger().info("Creating default " + filename + ".");
        plugin.saveResource(filename, true);
    }
    
    // Load the external file
    Configuration external = YamlConfiguration.loadConfiguration(f);
    
    // Check file for changes
    Set<String> internalKeys = internal.getKeys(true);
    Set<String> externalKeys = external.getKeys(true);
    
    if (!internalKeys.equals(externalKeys)) {
        plugin.getLogger().info("Updating " + filename + ".");
        
        // Copy all the loaded configuration into the new internal format
        for (String k : externalKeys) {
            if (external.isString(k) && internal.contains(k)) {
                internal.set(k, external.getString(k));
            }
        }
        
        // Write the file to disk
        try {
            internal.save(f);
        } catch (IOException e) {
            plugin.getLogger().info("Could not update " + filename + ".");
        }
        
        // Copy the new configuration back into external
        external = internal;
    }
    
    return external;
}
 
开发者ID:ericpauley,项目名称:CommandIt,代码行数:50,代码来源:YamlLoader.java


注:本文中的org.bukkit.configuration.Configuration.getKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。