Java Code Examples for com.dsh105.commodus.config.YAMLConfig#getBoolean()
The following examples show how to use
com.dsh105.commodus.config.YAMLConfig#getBoolean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PetNames.java From SonarPet with GNU General Public License v3.0 | 5 votes |
public static boolean allow(String input, IPet pet) { YAMLConfig config = ConfigOptions.instance.getConfig(); String nameToCheck = ChatColor.stripColor(input); ConfigurationSection cs = config.getConfigurationSection("petNames"); if (cs != null) { for (String key : cs.getKeys(false)) { if (key.equalsIgnoreCase(nameToCheck)) { String value = config.getString("petNames." + key); return pet.getOwner().hasPermission("echopet.pet.name.override") || !(value.equalsIgnoreCase("deny") || value.equalsIgnoreCase("false")); } } } if (config.getBoolean("petNamesRegexMatching")) { List<Map<String, String>> csRegex = (List<Map<String, String>>) config.get("petNamesRegex"); if (!csRegex.isEmpty()) { for (Map<String, String> regexMap : csRegex) { for (Map.Entry<String, String> entry : regexMap.entrySet()) { if (nameToCheck.matches(entry.getKey())) { return pet.getOwner().hasPermission("echopet.pet.name.override") || !(entry.getValue().equalsIgnoreCase("deny") || entry.getValue().equalsIgnoreCase("false")); } } } } } return true; }
Example 2
Source File: SimpleAnimationLoader.java From HoloAPI with GNU General Public License v3.0 | 5 votes |
public void loadAnimationConfiguration(YAMLConfig config) { KEY_TO_IMAGE_MAP.clear(); URL_UNLOADED.clear(); File imageFolder = new File(HoloAPI.getCore().getDataFolder() + File.separator + "animations"); if (!imageFolder.exists()) { imageFolder.mkdirs(); } ConfigurationSection cs = config.getConfigurationSection("animations"); if (cs != null) { for (String key : cs.getKeys(false)) { String path = "animations." + key + "."; String imagePath = config.getString(path + "path"); if (imagePath == null) { HoloAPI.LOG.info("Failed to load animation: " + key + ". Invalid path"); continue; } int imageHeight = config.getInt(path + "height", 10); int frameRate = config.getInt(path + "frameRate", 10); boolean requiresBorder = config.getBoolean(path + "requiresBorder", true); String imageChar = config.getString(path + "characterType", ImageChar.BLOCK.getHumanName()); String imageType = config.getString(path + "type", "FILE"); if (!GeneralUtil.isEnumType(ImageLoader.ImageLoadType.class, imageType.toUpperCase())) { HoloAPI.LOG.info("Failed to load animation: " + key + ". Invalid image type."); continue; } AnimationLoadType type = AnimationLoadType.valueOf(imageType.toUpperCase()); AnimatedImageGenerator generator = findGenerator(type, key, imagePath, frameRate, imageHeight, imageChar, requiresBorder); if (generator != null) { this.KEY_TO_IMAGE_MAP.put(key, generator); } } } loaded = true; if (!KEY_TO_IMAGE_MAP.isEmpty() || !URL_UNLOADED.isEmpty()) { HoloAPI.LOG.info("Animations loaded."); } }
Example 3
Source File: SimpleImageLoader.java From HoloAPI with GNU General Public License v3.0 | 5 votes |
public void loadImageConfiguration(YAMLConfig config) { KEY_TO_IMAGE_MAP.clear(); URL_UNLOADED.clear(); File imageFolder = new File(HoloAPI.getCore().getDataFolder() + File.separator + "images"); if (!imageFolder.exists()) { imageFolder.mkdirs(); } ConfigurationSection cs = config.getConfigurationSection("images"); if (cs != null) { for (String key : cs.getKeys(false)) { String path = "images." + key + "."; String imagePath = config.getString(path + "path"); int imageHeight = config.getInt(path + "height", 10); String imageChar = config.getString(path + "characterType", ImageChar.BLOCK.getHumanName()); String imageType = config.getString(path + "type", "FILE"); boolean requiresBorder = config.getBoolean(path + "requiresBorder", true); if (!GeneralUtil.isEnumType(ImageLoader.ImageLoadType.class, imageType.toUpperCase())) { HoloAPI.LOG.info("Failed to load image: " + key + ". Invalid image type."); continue; } ImageLoader.ImageLoadType type = ImageLoader.ImageLoadType.valueOf(imageType.toUpperCase()); ImageGenerator generator = findGenerator(type, key, imagePath, imageHeight, imageChar, requiresBorder); if (generator != null) { this.KEY_TO_IMAGE_MAP.put(key, generator); } } } loaded = true; if (!KEY_TO_IMAGE_MAP.isEmpty() || !URL_UNLOADED.isEmpty()) { HoloAPI.LOG.info("Images loaded."); } }
Example 4
Source File: PetNames.java From EchoPet with GNU General Public License v3.0 | 5 votes |
public static boolean allow(String input, IPet pet) { YAMLConfig config = ConfigOptions.instance.getConfig(); String nameToCheck = ChatColor.stripColor(input); ConfigurationSection cs = config.getConfigurationSection("petNames"); if (cs != null) { for (String key : cs.getKeys(false)) { if (key.equalsIgnoreCase(nameToCheck)) { String value = config.getString("petNames." + key); return pet.getOwner().hasPermission("echopet.pet.name.override") || !(value.equalsIgnoreCase("deny") || value.equalsIgnoreCase("false")); } } } if (config.getBoolean("petNamesRegexMatching")) { List<Map<String, String>> csRegex = (List<Map<String, String>>) config.get("petNamesRegex"); if (!csRegex.isEmpty()) { for (Map<String, String> regexMap : csRegex) { for (Map.Entry<String, String> entry : regexMap.entrySet()) { if (nameToCheck.matches(entry.getKey())) { return pet.getOwner().hasPermission("echopet.pet.name.override") || !(entry.getValue().equalsIgnoreCase("deny") || entry.getValue().equalsIgnoreCase("false")); } } } } } return true; }