本文整理汇总了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());
}
}
}
示例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"));
}
示例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"));
}
示例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));
}
}
示例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));
}
}
}
示例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));
}
}
}
示例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;
}