public Database parseDatabase() { ConfigurationSection dbStuff = config.getConfigurationSection("database"); if (dbStuff == null) { log.severe("No database credentials specified. This plugin requires a database to run!"); return null; } String host = dbStuff.getString("host"); if (host == null) { log.severe("No host for database specified. Could not load database credentials"); return null; } int port = dbStuff.getInt("port", -1); if (port == -1) { log.severe("No port for database specified. Could not load database credentials"); return null; } String db = dbStuff.getString("database"); if (db == null) { log.severe("No name for database specified. Could not load database credentials"); return null; } String user = dbStuff.getString("user"); if (user == null) { log.severe("No user for database specified. Could not load database credentials"); return null; } String password = dbStuff.getString("password"); if (password == null) { log.severe("No password for database specified. Could not load database credentials"); return null; } Integer poolSize = dbStuff.getInt("poolsize", 10); Long connectionTimeout = dbStuff.getLong("connectionTimeout", 10000l); Long idleTimeout = dbStuff.getLong("idleTimeout", 600000l); Long maxLifetime = dbStuff.getLong("maxLifetime", 7200000l); return new Database( log, user, password, host, port, db, poolSize, connectionTimeout, idleTimeout, maxLifetime); }
private void load() { ConfigurationSection lotsSection = data.getConfigurationSection("lots"); for (String uuidString : lotsSection.getKeys(false)) { ConfigurationSection singleLotSection = lotsSection.getConfigurationSection(uuidString); ItemStack item = singleLotSection.getItemStack("item"); boolean started = singleLotSection.getBoolean("started"); double price = singleLotSection.getDouble("price"); String lastBidPlayerName = singleLotSection.getString("lastBidPlayerName"); UUID lastBidPlayerUuid = singleLotSection.isSet("lastBidPlayerUuid") ? UUID.fromString(singleLotSection.getString("lastBidPlayerUuid")) : null; double lastBidPrice = singleLotSection.getDouble("lastBidPrice"); double minimumIncrement = singleLotSection.getDouble("minimumIncrement"); long preserveTimeExpire = singleLotSection.getLong("preserveTimeExpire"); long auctionDurationExpire = singleLotSection.getLong("auctionDurationExpire"); Lot lot = new Lot( UUID.fromString(uuidString), item, started, price, lastBidPlayerName, lastBidPlayerUuid, lastBidPrice, minimumIncrement, preserveTimeExpire, auctionDurationExpire); lots.add(lot); } }
/** * Storage for a tracked material from the config * * @param type the type of material * @param section the configuration section to load */ public DurabilityMaterial(Material type, ConfigurationSection section) { this.type = type; this.blastRadius = section.getInt("BlastRadius", 0); this.dura = section.getInt("Durability.Amount", 5); this.enabled = section.getBoolean("Durability.Enabled", true); this.chanceToDrop = section.getDouble("Durability.ChanceToDrop", 0.7); this.resetEnabled = section.getBoolean("Durability.ResetEnabled", false); this.resetTime = section.getLong("Durability.ResetAfter", 10000L); this.tntEnabled = section.getBoolean("EnabledFor.TNT", true); this.cannonsEnabled = section.getBoolean("EnabledFor.Cannons", false); this.creepersEnabled = section.getBoolean("EnabledFor.Creepers", false); this.ghastsEnabled = section.getBoolean("EnabledFor.Ghasts", false); this.withersEnabled = section.getBoolean("EnabledFor.Minecarts", false); this.tntMinecartsEnabled = section.getBoolean("EnabledFor.Withers", false); }
public void setCooldown(String command, OfflinePlayer p) { ConfigurationSection cmdCds = plugin.getConfig().getConfigurationSection("command_cooldowns"); if (cmdCds == null) return; boolean contains = cmdCds.getKeys(false).contains(command); if (plugin.cooldownAliases) if (plugin.getCommand(command) != null) for (String alias : plugin.getCommand(command).getAliases()) if (cmdCds.getKeys(false).contains(alias)) { contains = true; break; } if (contains) { long cooldown = cmdCds.getLong(command); PConfManager.setPValLong( p, new Date().getTime() + (cooldown * 1000), "command_cooldowns." + command); } }
private Map<String, Long> _getKitTimestamps() { if (config.isConfigurationSection("timestamps.kits")) { final ConfigurationSection section = config.getConfigurationSection("timestamps.kits"); final Map<String, Long> timestamps = new HashMap<String, Long>(); for (String command : section.getKeys(false)) { if (section.isLong(command)) { timestamps.put(command.toLowerCase(Locale.ENGLISH), section.getLong(command)); } else if (section.isInt(command)) { timestamps.put(command.toLowerCase(Locale.ENGLISH), (long)section.getInt(command)); } } return timestamps; } return new HashMap<String, Long>(); }
public static long getLong(String path) { return config.getLong(path); }
public boolean loadOld() { final YamlConfiguration confighandle = YamlConfiguration.loadConfiguration( new File(SimpleRegionMarket.getPluginDir() + "agents.yml")); TemplateHotel tokenHotel = null; TemplateSell tokenAgent = null; for (final TemplateMain token : TokenManager.tokenList) { if (token.id.equalsIgnoreCase("SELL")) { tokenAgent = (TemplateSell) token; } if (token.id.equalsIgnoreCase("HOTEL")) { tokenHotel = (TemplateHotel) token; } } if (tokenHotel == null || tokenAgent == null) { return false; } ConfigurationSection path; for (final String world : confighandle.getKeys(false)) { final World worldWorld = Bukkit.getWorld(world); if (worldWorld == null) { continue; } path = confighandle.getConfigurationSection(world); for (final String region : path.getKeys(false)) { final ProtectedRegion protectedRegion = SimpleRegionMarket.wgManager.getProtectedRegion(worldWorld, region); if (protectedRegion == null) { continue; } path = confighandle.getConfigurationSection(world).getConfigurationSection(region); for (final String signnr : path.getKeys(false)) { path = confighandle .getConfigurationSection(world) .getConfigurationSection(region) .getConfigurationSection(signnr); if (path == null) { continue; } if (path.getInt("Mode") == 1) { // HOTEL if (!tokenHotel.entries.containsKey(world)) { tokenHotel.entries.put(world, new HashMap<String, HashMap<String, Object>>()); } if (!tokenHotel.entries.get(world).containsKey(region)) { tokenHotel.entries.get(world).put(region, new HashMap<String, Object>()); Utils.setEntry(tokenHotel, world, region, "price", path.getInt("Price")); Utils.setEntry(tokenHotel, world, region, "account", path.getInt("Account")); Utils.setEntry(tokenHotel, world, region, "renttime", path.getLong("RentTime")); if (path.isSet("ExpireDate")) { Utils.setEntry(tokenHotel, world, region, "taken", true); Utils.setEntry(tokenHotel, world, region, "owner", path.getString("RentBy")); Utils.setEntry(tokenHotel, world, region, "expiredate", path.getLong("ExpireDate")); } else { Utils.setEntry(tokenHotel, world, region, "taken", false); } } final ArrayList<Location> signLocations = Utils.getSignLocations(tokenHotel, world, region); signLocations.add( new Location( worldWorld, path.getDouble("X"), path.getDouble("Y"), path.getDouble("Z"))); if (signLocations.size() == 1) { Utils.setEntry(tokenHotel, world, region, "signs", signLocations); } } else { // SELL if (!tokenAgent.entries.containsKey(world)) { tokenAgent.entries.put(world, new HashMap<String, HashMap<String, Object>>()); } if (!tokenAgent.entries.get(world).containsKey(region)) { tokenAgent.entries.get(world).put(region, new HashMap<String, Object>()); Utils.setEntry(tokenAgent, world, region, "price", path.getInt("Price")); Utils.setEntry(tokenAgent, world, region, "account", path.getInt("Account")); Utils.setEntry(tokenAgent, world, region, "renttime", path.getLong("RentTime")); Utils.setEntry(tokenAgent, world, region, "taken", false); } final ArrayList<Location> signLocations = Utils.getSignLocations(tokenAgent, world, region); signLocations.add( new Location( worldWorld, path.getDouble("X"), path.getDouble("Y"), path.getDouble("Z"))); if (signLocations.size() == 1) { Utils.setEntry(tokenAgent, world, region, "signs", signLocations); } } } } } return true; }
@Override public void init(ConfigurationSection s) { cooldownTime = s.getLong("cooldown", 20); power = s.getInt("power", 2); distance = s.getInt("distance", 15); }
@Override public void init(ConfigurationSection s) { cooldownTime = s.getLong("cooldown", 20); }
public ConditionPlayerTimeSinceLastLogout(final ConfigurationSection config) { super(config); time = config.getLong("time", -1); above = config.getBoolean("above", true); }
@Override public long getLong(String key) { return root.getLong(getKeyFor(key), 0L); }
/** * @see * fr.ribesg.bukkit.ncore.config.AbstractConfig#handleValues(org.bukkit.configuration.file.YamlConfiguration) */ @Override protected void handleValues(final YamlConfiguration config) throws InvalidConfigurationException { // ############# // ## General ## // ############# // spawnCommandBehaviour. Default: 1. // Possible values: 0,1 setSpawnCommandBehaviour(config.getInt("spawnCommandBehaviour", 1)); if (getSpawnCommandBehaviour() < 0 || getSpawnCommandBehaviour() > 1) { wrongValue("config.yml", "spawnCommandBehaviour", getSpawnCommandBehaviour(), 0); setSpawnCommandBehaviour(0); } // defaultRequiredPermission. Default: nworld.admin setDefaultRequiredPermission(config.getString("defaultRequiredPermission", "nworld.admin")); // defaultHidden. Default: true setDefaultHidden(config.getBoolean("defaultHidden", true)); // ############## // ## Messages ## // ############## // broadcastOnWorldCreate. Default: 0. // Possible values: 0,1 setBroadcastOnWorldCreate(config.getInt("broadcastOnWorldCreate", 0)); if (getBroadcastOnWorldCreate() < 0 || getBroadcastOnWorldCreate() > 1) { wrongValue("config.yml", "broadcastOnWorldCreate", getBroadcastOnWorldCreate(), 0); setBroadcastOnWorldCreate(0); } // broadcastOnWorldLoad. Default: 0. // Possible values: 0,1 setBroadcastOnWorldLoad(config.getInt("broadcastOnWorldLoad", 0)); if (getBroadcastOnWorldLoad() < 0 || getBroadcastOnWorldLoad() > 1) { wrongValue("config.yml", "broadcastOnWorldLoad", getBroadcastOnWorldLoad(), 0); setBroadcastOnWorldLoad(0); } // broadcastOnWorldUnload. Default: 0. // Possible values: 0,1 setBroadcastOnWorldUnload(config.getInt("broadcastOnWorldUnload", 0)); if (getBroadcastOnWorldUnload() < 0 || getBroadcastOnWorldUnload() > 1) { wrongValue("config.yml", "broadcastOnWorldUnload", getBroadcastOnWorldUnload(), 0); setBroadcastOnWorldUnload(0); } // ############ // ## Worlds ## // ############ final Map<String, GeneralWorld> worldsMap = new HashMap<>(); if (config.isConfigurationSection("stockWorlds")) { final ConfigurationSection stockWorldsSection = config.getConfigurationSection("stockWorlds"); for (final String worldName : stockWorldsSection.getKeys(false)) { final ConfigurationSection worldSection = stockWorldsSection.getConfigurationSection(worldName); final GeneralWorld.WorldType type = worldName.endsWith("_the_end") ? GeneralWorld.WorldType.STOCK_END : worldName.endsWith("_nether") ? GeneralWorld.WorldType.STOCK_NETHER : GeneralWorld.WorldType.STOCK; boolean malformedWorldSection = false; NLocation spawnLocation = null; String requiredPermission = null; final boolean enabled = Bukkit.getWorld(worldName) != null; Boolean hidden = null; if (!worldSection.isConfigurationSection("spawnLocation")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation"); } else { final ConfigurationSection spawnSection = worldSection.getConfigurationSection("spawnLocation"); if (!spawnSection.isDouble("x")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation.x"); } else if (!spawnSection.isDouble("y")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation.y"); } else if (!spawnSection.isDouble("z")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation.z"); } else if (!spawnSection.isDouble("yaw")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation.yaw"); } else if (!spawnSection.isDouble("pitch")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".spawnLocation.pitch"); } else { final double x = spawnSection.getDouble("x"); final double y = spawnSection.getDouble("y"); final double z = spawnSection.getDouble("z"); final float yaw = (float) spawnSection.getDouble("yaw"); final float pitch = (float) spawnSection.getDouble("pitch"); spawnLocation = new NLocation(worldName, x, y, z, yaw, pitch); } } if (!worldSection.isString("requiredPermission")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".requiredPermission"); } else { requiredPermission = worldSection.getString("requiredPermission"); } if (!worldSection.isBoolean("hidden")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: stockWorlds." + worldName + ".hidden"); } else { hidden = worldSection.getBoolean("hidden"); } if (!malformedWorldSection) { worldsMap.put( worldName, new StockWorld( plugin, worldName, type, spawnLocation, requiredPermission, enabled, hidden)); } else { throw new InvalidConfigurationException("Malformed Configuration - Stopping everything"); } } } if (config.isConfigurationSection("additionalWorlds")) { final ConfigurationSection additionalWorldsSection = config.getConfigurationSection("additionalWorlds"); for (final String worldName : additionalWorldsSection.getKeys(false)) { final ConfigurationSection worldSection = additionalWorldsSection.getConfigurationSection(worldName); // If an error is found in the config boolean malformedWorldSection = false; // All variables to build the GeneralWorld objects // Main NLocation spawnLocation = null; Long seed = null; String requiredPermission = null; Boolean enabled = null; Boolean hidden = null; Boolean hasNether = null; Boolean hasEnd = null; // Nether NLocation netherSpawnLocation = null; String netherRequiredPermission = null; Boolean netherEnabled = null; Boolean netherHidden = null; // End NLocation endSpawnLocation = null; String endRequiredPermission = null; Boolean endEnabled = null; Boolean endHidden = null; if (!worldSection.isConfigurationSection("spawnLocation")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation"); } else { final ConfigurationSection spawnSection = worldSection.getConfigurationSection("spawnLocation"); if (!spawnSection.isDouble("x")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation.x"); } else if (!spawnSection.isDouble("y")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation.y"); } else if (!spawnSection.isDouble("z")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation.z"); } else if (!spawnSection.isDouble("yaw")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation.yaw"); } else if (!spawnSection.isDouble("pitch")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".spawnLocation.pitch"); } else { final double x = spawnSection.getDouble("x"); final double y = spawnSection.getDouble("y"); final double z = spawnSection.getDouble("z"); final float yaw = (float) spawnSection.getDouble("yaw"); final float pitch = (float) spawnSection.getDouble("pitch"); spawnLocation = new NLocation(worldName, x, y, z, yaw, pitch); } } if (!worldSection.isLong("seed") && !worldSection.isInt("seed")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".seed"); } else { seed = worldSection.getLong("seed"); } if (!worldSection.isString("requiredPermission")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".requiredPermission"); } else { requiredPermission = worldSection.getString("requiredPermission"); } if (!worldSection.isBoolean("enabled")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".enabled"); } else { enabled = worldSection.getBoolean("enabled"); } if (!worldSection.isBoolean("hidden")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".hidden"); } else { hidden = worldSection.getBoolean("hidden"); } if (!worldSection.isBoolean("hasNether")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".hasNether"); } else { hasNether = worldSection.getBoolean("hasNether"); } if (!worldSection.isConfigurationSection("netherWorld")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration section: additionalWorlds." + worldName + ".netherWorld"); } else { final ConfigurationSection netherSection = worldSection.getConfigurationSection("netherWorld"); if (!netherSection.isConfigurationSection("spawnLocation")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation"); } else { final ConfigurationSection spawnSection = netherSection.getConfigurationSection("spawnLocation"); if (!spawnSection.isDouble("x")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation.x"); } else if (!spawnSection.isDouble("y")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation.y"); } else if (!spawnSection.isDouble("z")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation.z"); } else if (!spawnSection.isDouble("yaw")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation.yaw"); } else if (!spawnSection.isDouble("pitch")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.spawnLocation.pitch"); } else { final double x = spawnSection.getDouble("x"); final double y = spawnSection.getDouble("y"); final double z = spawnSection.getDouble("z"); final float yaw = (float) spawnSection.getDouble("yaw"); final float pitch = (float) spawnSection.getDouble("pitch"); netherSpawnLocation = new NLocation(worldName + "_nether", x, y, z, yaw, pitch); } } if (!netherSection.isString("requiredPermission")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.requiredPermission"); } else { netherRequiredPermission = netherSection.getString("requiredPermission"); } if (!netherSection.isBoolean("enabled")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.enabled"); } else { netherEnabled = netherSection.getBoolean("enabled"); } if (!netherSection.isBoolean("hidden")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".netherWorld.hidden"); } else { netherHidden = netherSection.getBoolean("hidden"); } } if (!worldSection.isBoolean("hasEnd")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".hasEnd"); } else { hasEnd = worldSection.getBoolean("hasEnd"); } if (!worldSection.isConfigurationSection("endWorld")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration section: additionalWorlds." + worldName + ".endWorld"); } else { final ConfigurationSection endSection = worldSection.getConfigurationSection("endWorld"); if (!endSection.isConfigurationSection("spawnLocation")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation"); } else { final ConfigurationSection spawnSection = endSection.getConfigurationSection("spawnLocation"); if (!spawnSection.isDouble("x")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation.x"); } else if (!spawnSection.isDouble("y")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation.y"); } else if (!spawnSection.isDouble("z")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation.z"); } else if (!spawnSection.isDouble("yaw")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation.yaw"); } else if (!spawnSection.isDouble("pitch")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.spawnLocation.pitch"); } else { final double x = spawnSection.getDouble("x"); final double y = spawnSection.getDouble("y"); final double z = spawnSection.getDouble("z"); final float yaw = (float) spawnSection.getDouble("yaw"); final float pitch = (float) spawnSection.getDouble("pitch"); endSpawnLocation = new NLocation(worldName + "_the_end", x, y, z, yaw, pitch); } } if (!endSection.isString("requiredPermission")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.requiredPermission"); } else { endRequiredPermission = endSection.getString("requiredPermission"); } if (!endSection.isBoolean("enabled")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.enabled"); } else { endEnabled = endSection.getBoolean("enabled"); } if (!endSection.isBoolean("hidden")) { malformedWorldSection = true; log.severe( "Missing or invalid configuration value: additionalWorlds." + worldName + ".endWorld.hidden"); } else { endHidden = endSection.getBoolean("hidden"); } } if (!malformedWorldSection) { final AdditionalWorld world = new AdditionalWorld( plugin, worldName, seed, spawnLocation, requiredPermission, enabled, hidden, hasNether, hasEnd); worldsMap.put(worldName, world); if (hasNether) { final AdditionalSubWorld nether = new AdditionalSubWorld( plugin, world, netherSpawnLocation, netherRequiredPermission, netherEnabled, netherHidden, World.Environment.NETHER); worldsMap.put(worldName + "_nether", nether); } if (hasEnd) { final AdditionalSubWorld end = new AdditionalSubWorld( plugin, world, endSpawnLocation, endRequiredPermission, endEnabled, endHidden, World.Environment.THE_END); worldsMap.put(worldName + "_the_end", end); } } else { throw new InvalidConfigurationException("Malformed Configuration - Stopping everything"); } } } worlds.putAll(worldsMap); // ########### // ## Warps ## // ########### final Map<String, Warp> warpsMap = new HashMap<>(); if (config.isConfigurationSection("warps")) { final ConfigurationSection warpsSection = config.getConfigurationSection("warps"); for (final String warpName : warpsSection.getKeys(false)) { final ConfigurationSection warpSection = warpsSection.getConfigurationSection(warpName); boolean malformedWarpSection = false; NLocation location = null; String requiredPermission = null; Boolean hidden = null; if (!warpSection.isConfigurationSection("location")) { malformedWarpSection = true; log.severe("Missing or invalid configuration value: warps." + warpName + ".location"); } else { final ConfigurationSection locationSection = warpSection.getConfigurationSection("location"); if (!locationSection.isString("worldName")) { malformedWarpSection = true; log.severe( "Missing or invalid configuration value: warps." + warpName + ".location.worldName"); } if (!locationSection.isDouble("x")) { malformedWarpSection = true; log.severe("Missing or invalid configuration value: warps." + warpName + ".location.x"); } if (!locationSection.isDouble("y")) { malformedWarpSection = true; log.severe("Missing or invalid configuration value: warps." + warpName + ".location.y"); } if (!locationSection.isDouble("z")) { malformedWarpSection = true; log.severe("Missing or invalid configuration value: warps." + warpName + ".location.z"); } if (!locationSection.isDouble("yaw")) { malformedWarpSection = true; log.severe( "Missing or invalid configuration value: warps." + warpName + ".location.yaw"); } if (!locationSection.isDouble("pitch")) { malformedWarpSection = true; log.severe( "Missing or invalid configuration value: warps." + warpName + ".location.pitch"); } if (!malformedWarpSection) { final String worldName = locationSection.getString("worldName"); final double x = locationSection.getDouble("x"); final double y = locationSection.getDouble("y"); final double z = locationSection.getDouble("z"); final float yaw = (float) locationSection.getDouble("yaw"); final float pitch = (float) locationSection.getDouble("pitch"); location = new NLocation(worldName, x, y, z, yaw, pitch); } } if (!warpSection.isString("requiredPermission")) { malformedWarpSection = true; log.severe( "Missing or invalid configuration value: warps." + warpName + ".requiredPermission"); } else { requiredPermission = warpSection.getString("requiredPermission"); } if (!warpSection.isBoolean("hidden")) { malformedWarpSection = true; log.severe("Missing or invalid configuration value: warps." + warpName + ".hidden"); } else { hidden = warpSection.getBoolean("hidden"); } if (!malformedWarpSection) { warpsMap.put(warpName, new Warp(warpName, location, false, requiredPermission, hidden)); } else { throw new InvalidConfigurationException("Malformed Configuration - Stopping everything"); } } } warps.putAll(warpsMap); }