List of usage examples for java.lang Byte valueOf
public static Byte valueOf(String s) throws NumberFormatException
From source file:org.op4j.functions.FnInteger.java
/** * <p>// w w w . ja v a 2s. co m * It multiplies target by multiplicand and returns its value. The result is * rounded based on the given {@link RoundingMode} * </p> * * @param multiplicand the multiplicand * @param roundingMode the {@link RoundingMode} * @return the result of target * multiplicand */ public final static Function<Integer, Integer> multiplyBy(byte multiplicand, RoundingMode roundingMode) { return multiplyBy(Byte.valueOf(multiplicand), roundingMode); }
From source file:org.op4j.functions.FnBigDecimal.java
/** * <p>//from w w w. j av a2 s . com * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<BigDecimal, BigDecimal> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }
From source file:org.op4j.functions.FnDouble.java
/** * <p>//from w w w .j a v a2 s . c om * It adds the given number to the target and returns the result * </p> * * @param add value to be added to the target * @return the result of the addition of add to the target number */ public final static Function<Double, Double> add(byte add) { return add(Byte.valueOf(add)); }
From source file:org.oscarehr.web.OcanReportUIBean.java
public static NeedRating convertNeedRating(int domainNumber, OcanStaffForm ocanStaffForm, List<OcanStaffFormData> ocanStaffFormData, OcanClientForm ocanClientForm, List<OcanClientFormData> ocanClientFormData, String ocanType) { NeedRating needRating = NeedRating.Factory.newInstance(); if ("FULL".equals(ocanType)) { String staffAnswer = getStaffAnswer(domainNumber + "_1", ocanStaffFormData); needRating.setStaff(Byte.valueOf(staffAnswer)); if (getStaffAnswer("consumerSelfAxCompleted", ocanStaffFormData).equals("TRUE")) { String clientAnswer = getStaffAnswer("client_" + domainNumber + "_1", ocanStaffFormData); if (clientAnswer.length() > 0) { needRating.setClient(Byte.valueOf(clientAnswer)); } else { needRating.setClient((byte) -1); }//w ww. j a v a2s. c om } else { needRating.setClient((byte) -1); } } else if ("SELF".equals(ocanType)) { String clientAnswer = getStaffAnswer("client_" + domainNumber + "_1", ocanStaffFormData); if (clientAnswer.length() > 0) { needRating.setClient(Byte.valueOf(clientAnswer)); } else { needRating.setClient((byte) -1); } } return needRating; }
From source file:org.op4j.functions.FnBigDecimal.java
/** * <p>/*from w w w .ja v a 2s. c om*/ * It divides the target element by the given divisor and returns its result * </p> * * @param divisor the divisor * @return the result of target/divisor */ public final static Function<BigDecimal, BigDecimal> divideBy(byte divisor) { return divideBy(Byte.valueOf(divisor)); }
From source file:org.oscarehr.web.OcanReportUIBean.java
public static InformalHelpRecvd convertInformalHelpRecvd(int domainNumber, OcanStaffForm ocanStaffForm, List<OcanStaffFormData> ocanStaffFormData) { InformalHelpRecvd informalHelpRecvd = InformalHelpRecvd.Factory.newInstance(); String staffAnswer = getStaffAnswer(domainNumber + "_2", ocanStaffFormData); if (staffAnswer != null && !staffAnswer.equals("")) informalHelpRecvd.setStaff(Byte.valueOf(staffAnswer)); else// www .ja v a 2 s . com informalHelpRecvd.setStaff(Byte.valueOf("0")); return informalHelpRecvd; }
From source file:org.oscarehr.web.OcanReportUIBean.java
public static FormalHelpRecvd convertFormalHelpRecvd(int domainNumber, OcanStaffForm ocanStaffForm, List<OcanStaffFormData> ocanStaffFormData) { FormalHelpRecvd formalHelpRecvd = FormalHelpRecvd.Factory.newInstance(); String staffAnswer = getStaffAnswer(domainNumber + "_3a", ocanStaffFormData); if (staffAnswer != null && !staffAnswer.equals("")) formalHelpRecvd.setStaff(Byte.valueOf(staffAnswer)); else// w w w. j a va 2 s . co m formalHelpRecvd.setStaff(Byte.valueOf("0")); return formalHelpRecvd; }
From source file:org.op4j.functions.FnDouble.java
/** * <p>//w w w . java 2s . c o m * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<Double, Double> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }
From source file:org.oscarehr.web.OcanReportUIBean.java
public static FormalHelpNeed convertFormalHelpNeed(int domainNumber, OcanStaffForm ocanStaffForm, List<OcanStaffFormData> ocanStaffFormData) { FormalHelpNeed formalHelpNeed = FormalHelpNeed.Factory.newInstance(); String staffAnswer = getStaffAnswer(domainNumber + "_3b", ocanStaffFormData); if (staffAnswer != null && !staffAnswer.equals("")) formalHelpNeed.setStaff(Byte.valueOf(staffAnswer)); else//from w w w . j a v a 2 s. com formalHelpNeed.setStaff(Byte.valueOf("0")); return formalHelpNeed; }
From source file:com.wasteofplastic.acidisland.ASkyBlock.java
/** * Loads the various settings from the config.yml file into the plugin *//*www . ja va2s .c o m*/ @SuppressWarnings("deprecation") public boolean loadPluginConfig() { // getLogger().info("*********************************************"); try { getConfig(); } catch (final Exception e) { e.printStackTrace(); } //CompareConfigs.compareConfigs(); // Get the localization strings //getLocale(); // Add this to the config // Default is locale.yml availableLocales.put("locale", new Locale(this, "locale")); availableLocales.put("de-DE", new Locale(this, "de-DE")); availableLocales.put("en-US", new Locale(this, "en-US")); availableLocales.put("es-ES", new Locale(this, "es-ES")); availableLocales.put("fr-FR", new Locale(this, "fr-FR")); availableLocales.put("it-IT", new Locale(this, "it-IT")); availableLocales.put("ko-KR", new Locale(this, "ko-KR")); availableLocales.put("pl-PL", new Locale(this, "pl-PL")); availableLocales.put("pt-BR", new Locale(this, "pt-BR")); availableLocales.put("zh-CN", new Locale(this, "zh-CN")); availableLocales.put("cs-CS", new Locale(this, "cs-CS")); availableLocales.put("sk-SK", new Locale(this, "sk-SK")); availableLocales.put("zh-TW", new Locale(this, "zh-TW")); availableLocales.put("nl-NL", new Locale(this, "nl-NL")); // Assign settings String configVersion = getConfig().getString("general.version", ""); //getLogger().info("DEBUG: config ver length " + configVersion.split("\\.").length); // Ignore last digit if it is 4 digits long if (configVersion.split("\\.").length == 4) { configVersion = configVersion.substring(0, configVersion.lastIndexOf('.')); } // Save for plugin version String version = plugin.getDescription().getVersion(); //getLogger().info("DEBUG: version length " + version.split("\\.").length); if (version.split("\\.").length == 4) { version = version.substring(0, version.lastIndexOf('.')); } if (configVersion.isEmpty() || !configVersion.equalsIgnoreCase(version)) { // Check to see if this has already been shared File newConfig = new File(plugin.getDataFolder(), "config.new.yml"); getLogger().warning("***********************************************************"); getLogger().warning("Config file is out of date. See config.new.yml for updates!"); getLogger().warning("config.yml version is '" + configVersion + "'"); getLogger().warning("Latest config version is '" + version + "'"); getLogger().warning("***********************************************************"); if (!newConfig.exists()) { File oldConfig = new File(plugin.getDataFolder(), "config.yml"); File bakConfig = new File(plugin.getDataFolder(), "config.bak"); if (oldConfig.renameTo(bakConfig)) { plugin.saveResource("config.yml", false); oldConfig.renameTo(newConfig); bakConfig.renameTo(oldConfig); } } } // Debug Settings.debug = getConfig().getInt("debug", 0); // How often the grid will be saved to file. Default is 5 minutes Settings.backupDuration = (getConfig().getLong("general.backupduration", 5) * 20 * 60); // How long a player has to wait after deactivating PVP until they can activate PVP again Settings.pvpRestartCooldown = getConfig().getLong("general.pvpcooldown", 60); // Max Islands Settings.maxIslands = getConfig().getInt("general.maxIslands", 0); // Mute death messages Settings.muteDeathMessages = getConfig().getBoolean("general.mutedeathmessages", false); // Warp panel Settings.useWarpPanel = getConfig().getBoolean("general.usewarppanel", true); // Fast level calculation (this is really fast) Settings.fastLevelCalc = getConfig().getBoolean("general.fastlevelcalc", true); // Restrict wither Settings.restrictWither = getConfig().getBoolean("general.restrictwither", true); // Team chat Settings.teamChat = getConfig().getBoolean("general.teamchat", true); // TEAMSUFFIX as island level Settings.setTeamName = getConfig().getBoolean("general.setteamsuffix", false); Settings.teamSuffix = getConfig().getString("general.teamsuffix", "([level])"); // Immediate teleport Settings.immediateTeleport = getConfig().getBoolean("general.immediateteleport", false); // Make island automatically Settings.makeIslandIfNone = getConfig().getBoolean("general.makeislandifnone", false); // Use physics when pasting island block schematics Settings.usePhysics = getConfig().getBoolean("general.usephysics", false); // Run level calc at login Settings.loginLevel = getConfig().getBoolean("general.loginlevel", false); // Use economy or not // In future expand to include internal economy Settings.useEconomy = getConfig().getBoolean("general.useeconomy", true); // Check for updates Settings.updateCheck = getConfig().getBoolean("general.checkupdates", true); // Island reset commands Settings.resetCommands = getConfig().getStringList("general.resetcommands"); Settings.leaveCommands = getConfig().getStringList("general.leavecommands"); Settings.startCommands = getConfig().getStringList("general.startcommands"); Settings.useControlPanel = getConfig().getBoolean("general.usecontrolpanel", false); // Check if /island command is allowed when falling Settings.allowTeleportWhenFalling = getConfig().getBoolean("general.allowfallingteleport", true); Settings.fallingCommandBlockList = getConfig().getStringList("general.blockingcommands"); // Visitor command banned list Settings.visitorCommandBlockList = getConfig().getStringList("general.visitorbannedcommands"); // Max team size Settings.maxTeamSize = getConfig().getInt("island.maxteamsize", 4); // Deprecated settings - use permission askyblock.team.maxsize.<number> instead Settings.maxTeamSizeVIP = getConfig().getInt("island.vipteamsize", 0); Settings.maxTeamSizeVIP2 = getConfig().getInt("island.vip2teamsize", 0); if (Settings.maxTeamSizeVIP > 0 || Settings.maxTeamSizeVIP2 > 0) { getLogger().warning( Settings.PERMPREFIX + "team.vip and " + Settings.PERMPREFIX + "team.vip2 are deprecated!"); getLogger().warning("Use permission " + Settings.PERMPREFIX + "team.maxsize.<number> instead."); } // Max home number Settings.maxHomes = getConfig().getInt("general.maxhomes", 1); if (Settings.maxHomes < 1) { Settings.maxHomes = 1; } // Settings from config.yml Settings.worldName = getConfig().getString("general.worldName"); // Check if the world name matches island.yml info File islandFile = new File(plugin.getDataFolder(), "islands.yml"); if (islandFile.exists()) { YamlConfiguration islandYaml = new YamlConfiguration(); try { islandYaml.load(islandFile); if (!islandYaml.contains(Settings.worldName)) { // Bad news, stop everything and tell the admin getLogger().severe( "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); getLogger().severe("More set up is required. Go to config.yml and edit it."); getLogger().severe(""); getLogger().severe("Check island world name is same as world in islands.yml."); getLogger().severe("If you are resetting and changing world, delete island.yml and restart."); getLogger().severe(""); getLogger().severe( "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); return false; } } catch (Exception e) { } } Settings.createNether = getConfig().getBoolean("general.createnether", true); if (!Settings.createNether) { getLogger().info("The Nether is disabled"); } String companion = getConfig().getString("island.companion", "COW").toUpperCase(); if (companion.equalsIgnoreCase("NOTHING")) { Settings.islandCompanion = null; } else { try { Settings.islandCompanion = EntityType.valueOf(companion); // Limit types switch (Settings.islandCompanion) { case BAT: case CHICKEN: case COW: case HORSE: case IRON_GOLEM: case MUSHROOM_COW: case OCELOT: case PIG: case RABBIT: case SHEEP: case SNOWMAN: case VILLAGER: case WOLF: break; default: getLogger().warning( "Island companion is not recognized. Pick from COW, PIG, SHEEP, CHICKEN, VILLAGER, HORSE, IRON_GOLEM, OCELOT, RABBIT, WOLF, SNOWMAN, BAT, MUSHROOM_COW"); Settings.islandCompanion = EntityType.COW; break; } } catch (Exception e) { getLogger().warning( "Island companion is not recognized. Pick from COW, PIG, SHEEP, CHICKEN, VILLAGER, HORSE, IRON_GOLEM, OCELOT, RABBIT, WOLF, BAT, MUSHROOM_COW, SNOWMAN"); Settings.islandCompanion = EntityType.COW; } } // Companion names List<String> companionNames = getConfig().getStringList("island.companionnames"); Settings.companionNames = new ArrayList<String>(); for (String name : companionNames) { Settings.companionNames.add(ChatColor.translateAlternateColorCodes('&', name)); } Settings.islandDistance = getConfig().getInt("island.distance", 200); if (Settings.islandDistance < 50) { Settings.islandDistance = 50; getLogger().info("Setting minimum island distance to 50"); } Settings.islandXOffset = getConfig().getInt("island.xoffset", 0); if (Settings.islandXOffset < 0) { Settings.islandXOffset = 0; getLogger().info("Setting minimum island X Offset to 0"); } else if (Settings.islandXOffset > Settings.islandDistance) { Settings.islandXOffset = Settings.islandDistance; getLogger().info("Setting maximum island X Offset to " + Settings.islandDistance); } Settings.islandZOffset = getConfig().getInt("island.zoffset", 0); if (Settings.islandZOffset < 0) { Settings.islandZOffset = 0; getLogger().info("Setting minimum island Z Offset to 0"); } else if (Settings.islandZOffset > Settings.islandDistance) { Settings.islandZOffset = Settings.islandDistance; getLogger().info("Setting maximum island Z Offset to " + Settings.islandDistance); } long x = getConfig().getLong("island.startx", 0); // Check this is a multiple of island distance long z = getConfig().getLong("island.startz", 0); Settings.islandStartX = Math.round((double) x / Settings.islandDistance) * Settings.islandDistance + Settings.islandXOffset; Settings.islandStartZ = Math.round((double) z / Settings.islandDistance) * Settings.islandDistance + Settings.islandZOffset; // ASkyBlock and AcidIsland difference if (Settings.GAMETYPE.equals(Settings.GameType.ACIDISLAND)) { Settings.acidDamage = getConfig().getDouble("general.aciddamage", 5D); if (Settings.acidDamage > 100D) { Settings.acidDamage = 100D; } else if (Settings.acidDamage < 0D) { Settings.acidDamage = 0D; } Settings.mobAcidDamage = getConfig().getDouble("general.mobaciddamage", 10D); if (Settings.mobAcidDamage > 100D) { Settings.mobAcidDamage = 100D; } else if (Settings.mobAcidDamage < 0D) { Settings.mobAcidDamage = 0D; } Settings.rainDamage = getConfig().getDouble("general.raindamage", 0.5D); if (Settings.rainDamage > 100D) { Settings.rainDamage = 100D; } else if (Settings.rainDamage < 0D) { Settings.rainDamage = 0D; } // The island's center is actually 5 below sea level Settings.sea_level = getConfig().getInt("general.sealevel", 50); if (Settings.sea_level < 0) { Settings.sea_level = 0; } Settings.island_level = getConfig().getInt("general.islandlevel", 50) - 5; if (Settings.island_level < 0) { Settings.island_level = 0; } } else { Settings.acidDamage = getConfig().getDouble("general.aciddamage", 0D); if (Settings.acidDamage > 100D) { Settings.acidDamage = 100D; } else if (Settings.acidDamage < 0D) { Settings.acidDamage = 0D; } Settings.mobAcidDamage = getConfig().getDouble("general.mobaciddamage", 0D); if (Settings.mobAcidDamage > 100D) { Settings.mobAcidDamage = 100D; } else if (Settings.mobAcidDamage < 0D) { Settings.mobAcidDamage = 0D; } Settings.rainDamage = getConfig().getDouble("general.raindamage", 0D); if (Settings.rainDamage > 100D) { Settings.rainDamage = 100D; } else if (Settings.rainDamage < 0D) { Settings.rainDamage = 0D; } // The island's center is actually 5 below sea level Settings.sea_level = getConfig().getInt("general.sealevel", 0); if (Settings.sea_level < 0) { Settings.sea_level = 0; } Settings.island_level = getConfig().getInt("general.islandlevel", 120) - 5; if (Settings.island_level < 0) { Settings.island_level = 0; } } Settings.animalAcidDamage = getConfig().getDouble("general.animaldamage", 0D); if (Settings.animalAcidDamage > 100D) { Settings.animalAcidDamage = 100D; } else if (Settings.animalAcidDamage < 0D) { Settings.animalAcidDamage = 0D; } Settings.damageChickens = getConfig().getBoolean("general.damagechickens", false); // Damage Type List<String> acidDamageType = getConfig().getStringList("general.damagetype"); Settings.acidDamageType.clear(); if (acidDamageType != null) { for (String effect : acidDamageType) { PotionEffectType newPotionType = PotionEffectType.getByName(effect); if (newPotionType != null) { // Check if it is a valid addition if (newPotionType.equals(PotionEffectType.BLINDNESS) || newPotionType.equals(PotionEffectType.CONFUSION) || newPotionType.equals(PotionEffectType.HUNGER) || newPotionType.equals(PotionEffectType.POISON) || newPotionType.equals(PotionEffectType.SLOW) || newPotionType.equals(PotionEffectType.SLOW_DIGGING) || newPotionType.equals(PotionEffectType.WEAKNESS)) { Settings.acidDamageType.add(newPotionType); } } else { getLogger().warning("Could not interpret acid damage modifier: " + effect + " - skipping"); getLogger().warning("Types can be : SLOW, SLOW_DIGGING, CONFUSION,"); getLogger().warning("BLINDNESS, HUNGER, WEAKNESS and POISON"); } } } Settings.animalSpawnLimit = getConfig().getInt("general.animalspawnlimit", 15); if (Settings.animalSpawnLimit < -1) { Settings.animalSpawnLimit = -1; } Settings.monsterSpawnLimit = getConfig().getInt("general.monsterspawnlimit", 100); if (Settings.monsterSpawnLimit < -1) { Settings.monsterSpawnLimit = -1; } Settings.waterAnimalSpawnLimit = getConfig().getInt("general.wateranimalspawnlimit", 15); if (Settings.waterAnimalSpawnLimit < -1) { Settings.waterAnimalSpawnLimit = -1; } Settings.abandonedIslandLevel = getConfig().getInt("general.abandonedislandlevel", 10); if (Settings.abandonedIslandLevel < 0) { Settings.abandonedIslandLevel = 0; } Settings.island_protectionRange = getConfig().getInt("island.protectionRange", 100); if (Settings.island_protectionRange % 2 != 0) { Settings.island_protectionRange--; getLogger().warning("Protection range must be even, using " + Settings.island_protectionRange); } if (Settings.island_protectionRange > Settings.islandDistance) { if (!getConfig().getBoolean("island.overridelimit", false)) { if (Settings.island_protectionRange > (Settings.islandDistance - 16)) { Settings.island_protectionRange = Settings.islandDistance - 16; getLogger().warning("*** Island protection range must be " + (Settings.islandDistance - 16) + " or less, (island range -16). Setting to: " + Settings.island_protectionRange); } } else { Settings.island_protectionRange = Settings.islandDistance; } } if (Settings.island_protectionRange < 0) { Settings.island_protectionRange = 0; } Settings.resetChallenges = getConfig().getBoolean("general.resetchallenges", true); Settings.resetMoney = getConfig().getBoolean("general.resetmoney", true); Settings.clearInventory = getConfig().getBoolean("general.resetinventory", true); Settings.resetEnderChest = getConfig().getBoolean("general.resetenderchest", false); Settings.startingMoney = getConfig().getDouble("general.startingmoney", 0D); Settings.respawnOnIsland = getConfig().getBoolean("general.respawnonisland", false); Settings.newNether = getConfig().getBoolean("general.newnether", true); Settings.netherTrees = getConfig().getBoolean("general.nethertrees", true); // Nether spawn protection radius Settings.netherSpawnRadius = getConfig().getInt("general.netherspawnradius", 25); if (Settings.netherSpawnRadius < 0) { Settings.netherSpawnRadius = 0; } else if (Settings.netherSpawnRadius > 100) { Settings.netherSpawnRadius = 100; } Settings.resetWait = getConfig().getInt("general.resetwait", 300); if (Settings.resetWait < 0) { Settings.resetWait = 0; } Settings.resetLimit = getConfig().getInt("general.resetlimit", 0); if (Settings.resetWait < 0) { Settings.resetWait = -1; } Settings.inviteWait = getConfig().getInt("general.invitewait", 60); if (Settings.inviteWait < 0) { Settings.inviteWait = 0; } Settings.levelWait = getConfig().getInt("general.levelwait", 60); if (Settings.levelWait < 0) { Settings.levelWait = 0; } // Seconds to wait for a confirmation of reset Settings.resetConfirmWait = getConfig().getInt("general.resetconfirmwait", 10); if (Settings.resetConfirmWait < 0) { Settings.resetConfirmWait = 0; } Settings.damageOps = getConfig().getBoolean("general.damageops", false); // Settings.ultraSafeBoats = // getConfig().getBoolean("general.ultrasafeboats", true); Settings.logInRemoveMobs = getConfig().getBoolean("general.loginremovemobs", true); Settings.islandRemoveMobs = getConfig().getBoolean("general.islandremovemobs", false); List<String> mobWhiteList = getConfig().getStringList("general.mobwhitelist"); Settings.mobWhiteList.clear(); String valid = "BLAZE, CREEPER, SKELETON, SPIDER, GIANT, ZOMBIE, GHAST, PIG_ZOMBIE, " + "ENDERMAN, CAVE_SPIDER, SILVERFISH, WITHER, WITCH, ENDERMITE," + " GUARDIAN"; for (String mobName : mobWhiteList) { if (valid.contains(mobName.toUpperCase())) { try { Settings.mobWhiteList.add(EntityType.valueOf(mobName.toUpperCase())); } catch (Exception e) { plugin.getLogger() .severe("Error in config.yml, mobwhitelist value '" + mobName + "' is invalid."); plugin.getLogger().severe( "Possible values are : Blaze, Cave_Spider, Creeper, Enderman, Endermite, Giant, Guardian, " + "Pig_Zombie, Silverfish, Skeleton, Spider, Witch, Wither, Zombie"); } } else { plugin.getLogger().severe("Error in config.yml, mobwhitelist value '" + mobName + "' is invalid."); plugin.getLogger().severe( "Possible values are : Blaze, Cave_Spider, Creeper, Enderman, Endermite, Giant, Guardian, " + "Pig_Zombie, Silverfish, Skeleton, Spider, Witch, Wither, Zombie"); } } // getLogger().info("DEBUG: island level is " + Settings.island_level); // Get chest items String chestItems = getConfig().getString("island.chestItems", ""); if (!chestItems.isEmpty()) { final String[] chestItemString = chestItems.split(" "); // getLogger().info("DEBUG: chest items = " + chestItemString); final ItemStack[] tempChest = new ItemStack[chestItemString.length]; for (int i = 0; i < tempChest.length; i++) { try { String[] amountdata = chestItemString[i].split(":"); if (amountdata[0].equals("POTION")) { // getLogger().info("DEBUG: Potion length " + // amountdata.length); if (amountdata.length == 2) { final String chestPotionEffect = getConfig().getString("island.chestPotion", ""); if (!chestPotionEffect.isEmpty()) { // Change the water bottle stack to a potion of some // kind Potion chestPotion = new Potion(PotionType.valueOf(chestPotionEffect)); tempChest[i] = chestPotion.toItemStack(Integer.parseInt(amountdata[1])); } } else if (amountdata.length == 3) { // getLogger().info("DEBUG: Potion type :" + // amountdata[1]); Potion chestPotion = new Potion(PotionType.valueOf(amountdata[1])); // getLogger().info("Potion in chest is :" + // chestPotion.getType().toString() + " x " + // amountdata[2]); tempChest[i] = chestPotion.toItemStack(Integer.parseInt(amountdata[2])); } else if (amountdata.length == 4) { // Extended or splash potions if (amountdata[2].equals("EXTENDED")) { Potion chestPotion = new Potion(PotionType.valueOf(amountdata[1])).extend(); // getLogger().info("Potion in chest is :" + // chestPotion.getType().toString() + // " extended duration x " + amountdata[3]); tempChest[i] = chestPotion.toItemStack(Integer.parseInt(amountdata[3])); } else if (amountdata[2].equals("SPLASH")) { Potion chestPotion = new Potion(PotionType.valueOf(amountdata[1])).splash(); // getLogger().info("Potion in chest is :" + // chestPotion.getType().toString() + " splash x " + // amountdata[3]); tempChest[i] = chestPotion.toItemStack(Integer.parseInt(amountdata[3])); } else if (amountdata[2].equals("EXTENDEDSPLASH")) { Potion chestPotion = new Potion(PotionType.valueOf(amountdata[1])).extend() .splash(); // getLogger().info("Potion in chest is :" + // chestPotion.getType().toString() + // " splash, extended duration x " + amountdata[3]); tempChest[i] = chestPotion.toItemStack(Integer.parseInt(amountdata[3])); } } } else { Material mat; if (StringUtils.isNumeric(amountdata[0])) { mat = Material.getMaterial(Integer.parseInt(amountdata[0])); } else { mat = Material.getMaterial(amountdata[0].toUpperCase()); } if (amountdata.length == 2) { tempChest[i] = new ItemStack(mat, Integer.parseInt(amountdata[1])); } else if (amountdata.length == 3) { tempChest[i] = new ItemStack(mat, Integer.parseInt(amountdata[2]), Short.parseShort(amountdata[1])); } } } catch (java.lang.IllegalArgumentException ex) { getLogger().severe( "Problem loading chest item from config.yml so skipping it: " + chestItemString[i]); getLogger().severe("Error is : " + ex.getMessage()); getLogger().info("Potential potion types are: "); for (PotionType c : PotionType.values()) getLogger().info(c.name()); } catch (Exception e) { getLogger().severe( "Problem loading chest item from config.yml so skipping it: " + chestItemString[i]); getLogger().info("Potential material types are: "); for (Material c : Material.values()) getLogger().info(c.name()); // e.printStackTrace(); } } Settings.chestItems = tempChest; } else { // Nothing in the chest Settings.chestItems = new ItemStack[0]; } Settings.allowPvP = getConfig().getBoolean("island.allowPvP", false); Settings.allowNetherPvP = getConfig().getBoolean("island.allowNetherPvP", false); Settings.allowBreakBlocks = getConfig().getBoolean("island.allowbreakblocks", false); Settings.allowPlaceBlocks = getConfig().getBoolean("island.allowplaceblocks", false); Settings.allowBedUse = getConfig().getBoolean("island.allowbeduse", false); Settings.allowBucketUse = getConfig().getBoolean("island.allowbucketuse", false); Settings.allowShearing = getConfig().getBoolean("island.allowshearing", false); Settings.allowEnderPearls = getConfig().getBoolean("island.allowenderpearls", false); Settings.allowDoorUse = getConfig().getBoolean("island.allowdooruse", false); Settings.allowLeverButtonUse = getConfig().getBoolean("island.allowleverbuttonuse", false); Settings.allowCropTrample = getConfig().getBoolean("island.allowcroptrample", false); Settings.allowChestAccess = getConfig().getBoolean("island.allowchestaccess", false); Settings.allowFurnaceUse = getConfig().getBoolean("island.allowfurnaceuse", false); Settings.allowRedStone = getConfig().getBoolean("island.allowredstone", false); Settings.allowMusic = getConfig().getBoolean("island.allowmusic", false); Settings.allowCrafting = getConfig().getBoolean("island.allowcrafting", false); Settings.allowBrewing = getConfig().getBoolean("island.allowbrewing", false); Settings.allowGateUse = getConfig().getBoolean("island.allowgateuse", false); Settings.allowHurtMobs = getConfig().getBoolean("island.allowhurtmobs", true); Settings.endermanDeathDrop = getConfig().getBoolean("island.endermandeathdrop", true); Settings.allowEndermanGriefing = getConfig().getBoolean("island.allowendermangriefing", true); Settings.allowCreeperDamage = getConfig().getBoolean("island.allowcreeperdamage", true); Settings.allowCreeperGriefing = getConfig().getBoolean("island.allowcreepergriefing", false); Settings.allowTNTDamage = getConfig().getBoolean("island.allowtntdamage", false); Settings.allowMonsterEggs = getConfig().getBoolean("island.allowspawneggs", false); Settings.allowBreeding = getConfig().getBoolean("island.allowbreeding", false); Settings.allowFire = getConfig().getBoolean("island.allowfire", false); Settings.allowFireSpread = getConfig().getBoolean("island.allowfirespread", false); Settings.allowChestDamage = getConfig().getBoolean("island.allowchestdamage", false); Settings.allowLeashUse = getConfig().getBoolean("island.allowleashuse", false); Settings.allowHurtMonsters = getConfig().getBoolean("island.allowhurtmonsters", true); Settings.allowEnchanting = getConfig().getBoolean("island.allowenchanting", true); Settings.allowAnvilUse = getConfig().getBoolean("island.allowanviluse", true); Settings.allowVisitorKeepInvOnDeath = getConfig().getBoolean("island.allowvisitorkeepinvondeath", false); Settings.allowVisitorItemDrop = getConfig().getBoolean("island.allowvisitoritemdrop", true); Settings.allowVisitorItemPickup = getConfig().getBoolean("island.allowvisitoritempickup", true); Settings.allowArmorStandUse = getConfig().getBoolean("island.allowarmorstanduse", false); Settings.allowBeaconAccess = getConfig().getBoolean("island.allowbeaconaccess", false); Settings.allowPortalUse = getConfig().getBoolean("island.allowportaluse", true); Settings.allowPressurePlate = getConfig().getBoolean("island.allowpressureplates", true); Settings.allowPistonPush = getConfig().getBoolean("island.allowpistonpush", true); Settings.allowHorseRiding = getConfig().getBoolean("island.allowhorseriding", false); Settings.allowHorseInvAccess = getConfig().getBoolean("island.allowhorseinventoryaccess", false); // Spawn Settings Settings.allowSpawnHorseRiding = getConfig().getBoolean("spawn.allowhorseriding", false); Settings.allowSpawnHorseInvAccess = getConfig().getBoolean("spawn.allowhorseinventoryaccess", false); Settings.allowSpawnPressurePlate = getConfig().getBoolean("spawn.allowpressureplates", true); Settings.allowSpawnDoorUse = getConfig().getBoolean("spawn.allowdooruse", true); Settings.allowSpawnLeverButtonUse = getConfig().getBoolean("spawn.allowleverbuttonuse", true); Settings.allowSpawnChestAccess = getConfig().getBoolean("spawn.allowchestaccess", true); Settings.allowSpawnFurnaceUse = getConfig().getBoolean("spawn.allowfurnaceuse", true); Settings.allowSpawnRedStone = getConfig().getBoolean("spawn.allowredstone", false); Settings.allowSpawnMusic = getConfig().getBoolean("spawn.allowmusic", true); Settings.allowSpawnCrafting = getConfig().getBoolean("spawn.allowcrafting", true); Settings.allowSpawnBrewing = getConfig().getBoolean("spawn.allowbrewing", true); Settings.allowSpawnGateUse = getConfig().getBoolean("spawn.allowgateuse", true); Settings.allowSpawnMobSpawn = getConfig().getBoolean("spawn.allowmobspawn", false); Settings.allowSpawnAnimalSpawn = getConfig().getBoolean("spawn.allowanimalspawn", true); Settings.allowSpawnAnimalKilling = getConfig().getBoolean("spawn.allowanimalkilling", false); Settings.allowSpawnMobKilling = getConfig().getBoolean("spawn.allowmobkilling", true); Settings.allowSpawnMonsterEggs = getConfig().getBoolean("spawn.allowspawneggs", false); Settings.allowSpawnEggs = getConfig().getBoolean("spawn.alloweggs", false); Settings.allowSpawnBreakBlocks = getConfig().getBoolean("spawn.allowbreakblocks", false); Settings.allowSpawnPlaceBlocks = getConfig().getBoolean("spawn.allowplaceblocks", false); Settings.allowSpawnNoAcidWater = getConfig().getBoolean("spawn.allowspawnnoacidwater", false); Settings.allowSpawnEnchanting = getConfig().getBoolean("spawn.allowenchanting", true); Settings.allowSpawnAnvilUse = getConfig().getBoolean("spawn.allowanviluse", true); Settings.allowSpawnBeaconAccess = getConfig().getBoolean("spawn.allowbeaconaccess", false); Settings.allowSpawnPVP = getConfig().getBoolean("spawn.allowPVP", false); Settings.allowSpawnMilking = getConfig().getBoolean("spawn.allowmilking", false); Settings.allowSpawnLavaCollection = getConfig().getBoolean("spawn.allowlavacollection", false); Settings.allowSpawnWaterCollection = getConfig().getBoolean("spawn.allowwatercollection", false); Settings.allowSpawnVisitorItemDrop = getConfig().getBoolean("spawn.allowvisitoritemdrop", true); Settings.allowSpawnVisitorItemPickup = getConfig().getBoolean("spawn.allowvisitoritempickup", true); // Challenges getChallenges(); // Challenge completion Settings.broadcastMessages = getConfig().getBoolean("general.broadcastmessages", true); // Levels // Get the blockvalues.yml file YamlConfiguration blockValuesConfig = Util.loadYamlFile("blockvalues.yml"); // Get the under water multiplier Settings.underWaterMultiplier = blockValuesConfig.getDouble("underwater", 1D); Settings.levelCost = blockValuesConfig.getInt("levelcost", 100); Settings.blockLimits = new HashMap<MaterialData, Integer>(); if (blockValuesConfig.isSet("limits")) { for (String material : blockValuesConfig.getConfigurationSection("limits").getKeys(false)) { try { String[] split = material.split(":"); byte data = 0; if (split.length > 1) { data = Byte.valueOf(split[1]); } Material mat; if (StringUtils.isNumeric(split[0])) { mat = Material.getMaterial(Integer.parseInt(split[0])); } else { mat = Material.valueOf(split[0].toUpperCase()); } MaterialData materialData = new MaterialData(mat); materialData.setData(data); Settings.blockLimits.put(materialData, blockValuesConfig.getInt("limits." + material, 0)); if (debug) { getLogger().info("Maximum number of " + materialData + " will be " + Settings.blockLimits.get(materialData)); } } catch (Exception e) { getLogger().warning( "Unknown material (" + material + ") in blockvalues.yml Limits section. Skipping..."); } } } Settings.blockValues = new HashMap<MaterialData, Integer>(); if (blockValuesConfig.isSet("blocks")) { for (String material : blockValuesConfig.getConfigurationSection("blocks").getKeys(false)) { try { String[] split = material.split(":"); byte data = 0; if (split.length > 1) { data = Byte.valueOf(split[1]); } Material mat; if (StringUtils.isNumeric(split[0])) { mat = Material.getMaterial(Integer.parseInt(split[0])); } else { mat = Material.valueOf(split[0].toUpperCase()); } MaterialData materialData = new MaterialData(mat); materialData.setData(data); Settings.blockValues.put(materialData, blockValuesConfig.getInt("blocks." + material, 0)); if (debug) { getLogger().info(mat.toString() + " value is " + Settings.blockValues.get(mat)); } } catch (Exception e) { // e.printStackTrace(); getLogger().warning( "Unknown material (" + material + ") in blockvalues.yml blocks section. Skipping..."); } } } else { getLogger().severe("No block values in blockvalues.yml! All island levels will be zero!"); } // Biome Settings Settings.biomeCost = getConfig().getDouble("biomesettings.defaultcost", 100D); if (Settings.biomeCost < 0D) { Settings.biomeCost = 0D; getLogger().warning("Biome default cost is < $0, so set to zero."); } String defaultBiome = getConfig().getString("biomesettings.defaultbiome", "PLAINS"); try { Settings.defaultBiome = Biome.valueOf(defaultBiome); } catch (Exception e) { getLogger().severe("Could not parse biome " + defaultBiome + " using PLAINS instead."); Settings.defaultBiome = Biome.PLAINS; } Settings.breedingLimit = getConfig().getInt("general.breedinglimit", 0); Settings.villagerLimit = getConfig().getInt("general.villagerlimit", 0); Settings.limitedBlocks = new HashMap<String, Integer>(); ConfigurationSection entityLimits = getConfig().getConfigurationSection("general.entitylimits"); if (entityLimits != null) { for (String entity : entityLimits.getKeys(false)) { int limit = entityLimits.getInt(entity.toUpperCase(), -1); if (limit > 0) { getLogger().info(entity.toUpperCase() + " will be limited to " + limit); } if (Material.getMaterial(entity.toUpperCase()) == null) { getLogger().warning("general.entitylimits section has unknown entity type: " + entity.toUpperCase() + " skipping..."); } else if (limit > -1) { Settings.limitedBlocks.put(entity.toUpperCase(), limit); if (entity.equalsIgnoreCase("REDSTONE_COMPARATOR")) { // Player can only ever place a redstone comparator in the OFF state Settings.limitedBlocks.put("REDSTONE_COMPARATOR_OFF", limit); } else if (entity.equalsIgnoreCase("BANNER")) { // To simplify banners, the banner is allowed and automatically made wall and standing banner Settings.limitedBlocks.put("WALL_BANNER", limit); Settings.limitedBlocks.put("STANDING_BANNER", limit); } else if (entity.equalsIgnoreCase("SIGN")) { // To simplify signs, the sign is allowed and automatically made wall and standing signs Settings.limitedBlocks.put("WALL_SIGN", limit); Settings.limitedBlocks.put("SIGN_POST", limit); } } } } // Legacy setting support for hopper limiting if (Settings.limitedBlocks.isEmpty()) { Settings.hopperLimit = getConfig().getInt("general.hopperlimit", -1); if (Settings.hopperLimit > 0) { Settings.limitedBlocks.put("HOPPER", Settings.hopperLimit); } } Settings.mobLimit = getConfig().getInt("general.moblimit", 0); Settings.removeCompleteOntimeChallenges = getConfig().getBoolean("general.removecompleteonetimechallenges", false); Settings.addCompletedGlow = getConfig().getBoolean("general.addcompletedglow", true); // All done return true; }