Search in sources :

Example 36 with YamlConfiguration

use of org.bukkit.configuration.file.YamlConfiguration in project WildernessTp by AcmeProject.

the class PortalzGoneWild method savePortal.

public void savePortal(String name, String portal, Player p) {
    WildTP.debug("Got save portal " + name + " " + portal);
    portalFile = new File(WildTP.instace.getDataFolder(), "Portals.yml");
    portalConf = new YamlConfiguration();
    try {
        portalConf.load(portalFile);
        portalConf.set(name, portal);
        portalConf.save(portalFile);
    } catch (InvalidConfigurationException | IOException e) {
        e.printStackTrace();
        p.sendMessage("Error occurred, check console logs");
        return;
    }
    p.sendMessage("Portal " + name + " created!");
    // dum lax
    loadConfig();
}
Also used : IOException(java.io.IOException) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) File(java.io.File) InvalidConfigurationException(org.bukkit.configuration.InvalidConfigurationException)

Aggregations

YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)36 File (java.io.File)24 IOException (java.io.IOException)21 InvalidConfigurationException (org.bukkit.configuration.InvalidConfigurationException)13 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)6 UUID (java.util.UUID)5 ArrayList (java.util.ArrayList)4 Location (org.bukkit.Location)4 FileConfiguration (org.bukkit.configuration.file.FileConfiguration)4 EntityType (org.bukkit.entity.EntityType)4 SettingsFlag (com.wasteofplastic.acidisland.Island.SettingsFlag)3 InputStream (java.io.InputStream)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 ChatColor (com.gamingmesh.jobs.util.ChatColor)2 DefaultInfo (de.Keyle.MyPet.api.entity.DefaultInfo)2 MyPetType (de.Keyle.MyPet.api.entity.MyPetType)2 InputStreamReader (java.io.InputStreamReader)2 TreeMap (java.util.TreeMap)2 Material (org.bukkit.Material)2