Examples of YamlConfiguration


Examples of org.bukkit.configuration.file.YamlConfiguration

        if (!Config.getInstance().getEntityModsEnabled()) {
            return;
        }

        File entityFile = new File(mcMMO.p.getDataFolder(), "mods" + File.separator + "entities.default.yml");
        YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);

        String entityName = entity.getType().toString();
        String sanitizedEntityName = entityName.replace(".", "_");

        if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
            return;
        }

        entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
        entitiesFile.set(sanitizedEntityName + ".Tameable", false);
        entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
        entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
        entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
        entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
        entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);

        String className = "";

        try {
            className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
        }
        catch (Exception e) {
            if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
                className = entity.getClass().getName();
            }
            else {
                e.printStackTrace();
            }
        }

        CustomEntity customEntity = new CustomEntity(1.0D, false, 0, false, null, 0);
        customEntityTypeMap.put(entityName, customEntity);
        customEntityClassMap.put(className, customEntity);

        try {
            entitiesFile.save(entityFile);
            mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
        }
        catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.bukkit.configuration.file.YamlConfiguration

    /**
     * Save formula file.
     */
    public void saveFormula() {
        mcMMO.p.debug("Saving previous XP formula type...");
        YamlConfiguration formulasFile = new YamlConfiguration();
        formulasFile.set("Previous_Formula", previousFormula.toString());

        try {
            formulasFile.save(formulaFile);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

Examples of org.bukkit.configuration.file.YamlConfiguration

            String apiKey = null;
            String latest = null;

            if (updaterFolder.exists()) {
                if (updaterConfigFile.exists()) {
                    final YamlConfiguration config = YamlConfiguration.loadConfiguration(updaterConfigFile);
                    apiKey = config.getString("api-key");
                }
            }

            URL url;
            try {
View Full Code Here

Examples of org.bukkit.configuration.file.YamlConfiguration

    @Test
    public void testSerialization() throws Throwable {
        for (TestColor testColor : examples) {
            Color base = Color.fromRGB(testColor.rgb);

            YamlConfiguration toSerialize = new YamlConfiguration();
            toSerialize.set("color", base);
            String serialized = toSerialize.saveToString();

            YamlConfiguration deserialized = new YamlConfiguration();
            deserialized.loadFromString(serialized);

            assertThat(testColor.name + " on " + serialized, base, is(deserialized.getColor("color")));
        }
    }
View Full Code Here

Examples of org.spout.cereal.config.yaml.YamlConfiguration

public class InputConfiguration extends ConfigurationHolderConfiguration {
  public static final ConfigurationHolder TOGGLE_INVENTORY = new ConfigurationHolder("KEY_E", "toggle-inventory");

  public InputConfiguration() {
    super(new YamlConfiguration(new File(VanillaPlugin.getInstance().getDataFolder(), "input.yml")));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.