Setting warps with a settingsmanager problem. (HELP!)

Discussion in 'Plugin Development' started by yrucool1, Apr 27, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    yrucool1

    Code:
                                    settings.getData().set("Teams." + settings.getData().getString(p.getName() + ".Team" + ".HQ.True-or-False"), "True");
                                    settings.getData().set("Teams." + settings.getData().getString(p.getName() + ".Team" + ".HQ.X"), p.getLocation().getX());
                                    settings.getData().set("Teams." + settings.getData().getString(p.getName() + ".Team" + ".HQ.Y"), p.getLocation().getY());
                                    settings.getData().set("Teams." + settings.getData().getString(p.getName() + ".Team" + ".HQ.Z"), p.getLocation().getZ());
    Here is the code I am using for a teams plugin I am using. "settings" is just a simple settingsmanager with a data and config file. The problem I am having is that in 1.6 I was able to use a int and a double in settings.getdata.set. Now I can only use an Object. Any one know how to turn a players coordinates into an Object but still be saved in the data file as a number? I don't know if its because I have to also use bukkit api other then just craftbukkit or what.

    Error on "set" The method set(String, Object) in the type MemorySection is not applicable for the arguments (String, double)
     
  2. Offline

    nverdier

    @yrucool1 Please show your 'simple settingsmanager'...
     
  3. Offline

    Protophite

    @yrucool1
    What does your getData return in your settings class
     
  4. Offline

    yrucool1

    @nverdier @Protophite

    Code:
    package Manager;
    
    import java.io.File;
    import java.io.IOException;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.configuration.file.YamlConfiguration;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.PluginDescriptionFile;
    
    public class SettingsManager
    {
    
         private SettingsManager() { }
       
         static SettingsManager instance = new SettingsManager();
      
         public static SettingsManager getInstance() {
                 return instance;
         }
      
         Plugin p;
      
         FileConfiguration config;
         File cfile;
      
         FileConfiguration data;
         File dfile;
      
         public void setup(Plugin p) {
                 cfile = new File(p.getDataFolder(), "config.yml");
                 config = p.getConfig();
                 //config.options().copyDefaults(true);
                 //saveConfig();
              
                 if (!p.getDataFolder().exists()) {
                         p.getDataFolder().mkdir();
                 }
              
                 dfile = new File(p.getDataFolder(), "data.yml");
              
                 if (!dfile.exists()) {
                         try {
                                 dfile.createNewFile();
                         }
                         catch (IOException e) {
                                 Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not create data.yml!");
                         }
                 }
              
                 data = YamlConfiguration.loadConfiguration(dfile);
         }
      
         public FileConfiguration getData() {
                 return data;
         }
      
         public void saveData() {
                 try {
                         data.save(dfile);
                 }
                 catch (IOException e) {
                         Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save data.yml!");
                 }
         }
      
         public void reloadData() {
                 data = YamlConfiguration.loadConfiguration(dfile);
         }
      
         public FileConfiguration getConfig() {
                 return config;
         }
      
         public void saveConfig() {
                 try {
                         config.save(cfile);
                 }
                 catch (IOException e) {
                         Bukkit.getServer().getLogger().severe(ChatColor.RED + "Could not save config.yml!");
                 }
         }
      
         public void reloadConfig() {
                 config = YamlConfiguration.loadConfiguration(cfile);
         }
      
         public PluginDescriptionFile getDesc() {
                 return p.getDescription();
         }
    }
     
  5. Offline

    yrucool1

    HELP me
     
  6. Offline

    CoolGamerXD

    Explain again in better manner what you really want...
     
Thread Status:
Not open for further replies.

Share This Page