本文整理汇总了Java中cn.nukkit.utils.ConfigSection.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigSection.getBoolean方法的具体用法?Java ConfigSection.getBoolean怎么用?Java ConfigSection.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.utils.ConfigSection
的用法示例。
在下文中一共展示了ConfigSection.getBoolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadEntries
import cn.nukkit.utils.ConfigSection; //导入方法依赖的package包/类
private void loadEntries() {
this.saveDefaultConfig();
enable = this.getConfig().getBoolean("enable", true);
this.autoCompress = this.getConfig().getBoolean("autoCompress", true);
if (!enable) {
this.getLogger().warning("The SynapseAPI is not be enabled!");
} else {
if (this.getConfig().getBoolean("disable-rak")) {
for (SourceInterface sourceInterface : this.getServer().getNetwork().getInterfaces()) {
if (sourceInterface instanceof RakNetInterface) {
sourceInterface.shutdown();
}
}
}
List entries = this.getConfig().getList("entries");
for (Object entry : entries) {
@SuppressWarnings("unchecked")
ConfigSection section = new ConfigSection((LinkedHashMap) entry);
String serverIp = section.getString("server-ip", "127.0.0.1");
int port = section.getInt("server-port", 10305);
boolean isMainServer = section.getBoolean("isMainServer");
String password = section.getString("password");
String serverDescription = section.getString("description");
this.autoConnect = section.getBoolean("autoConnect", true);
if (this.autoConnect) {
this.addSynapseAPI(new SynapseEntry(this, serverIp, port, isMainServer, password, serverDescription));
}
}
}
}
示例2: prepareIslandValue
import cn.nukkit.utils.ConfigSection; //导入方法依赖的package包/类
/**
* @param id
*/
private void prepareIslandValue(int id) {
String key = configKey.get(id);
ConfigSection section = configFolder.getSection("schematicList.schematic." + key);
// configuration keys
String[] blockSpawn = section.getString("BLOCK_SPAWN", "").split(":");
String description = section.getString("DESCRIPTION", "The island");
String islandName = section.getString("NAME", "Island");
String permission = section.getString("PERMISSION", "");
String biome = section.getString("BIOME", "Plains");
double rating = section.getDouble("RATING", 0);
boolean defaultPriority = section.getBoolean("DEFAULT_PRIORITY");
boolean useConfigChest = section.getBoolean("USE_CONFIG_CHEST", false);
boolean usePasteEntity = section.getBoolean("PASTE_ENTITIES", false);
Block block = null;
schematicList.add(islandName.replace("&", "§"));
if (defaultPriority && defaultIsland == -1) {
defaultIsland = id;
}
// Check for configuration type
for (String sting : blockSpawn) {
if (sting.isEmpty()) {
break;
}
if (!Utils.isNumeric(sting)) {
break;
}
if (block == null) {
block = Block.get(Integer.parseInt(sting));
} else if (block.getDamage() == 0) {
block.setDamage(Integer.parseInt(sting));
}
}
configKey.remove(id); // Remove from system so THEY WONT MAKE OOM's
// Set the configuration into system (can be null)
this.setIslandValue(id, Configuration.DEFAULT, defaultPriority);
this.setIslandValue(id, Configuration.BLOCK_SPAWN, block);
this.setIslandValue(id, Configuration.DESCRIPTION, description);
this.setIslandValue(id, Configuration.PERMISSION, permission);
this.setIslandValue(id, Configuration.USE_CONFIG_CHEST, useConfigChest);
this.setIslandValue(id, Configuration.RATING, rating);
this.setIslandValue(id, Configuration.BIOME, Biome.getBiome(biome));
this.setIslandValue(id, Configuration.PASTE_ENTITIES, usePasteEntity);
}