Saving but returns error

Discussion in 'Plugin Development' started by SnowPingerr, Aug 11, 2019.

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

    SnowPingerr

    Hello I am making a plugin and I am using this to save my hashmap,Value and list

    Code:
    @Override
        public void onDisable()
        {
            for(String p : getCC().keySet())
            {
                getConfig().set("chunkcredits."+ p , getCC().get(p));
            }
            for(String p : getMasters().keySet())
            {
                getConfig().set("gmasters."+ p , getMasters().get(p));
            }
            for(String p : getGroupN().keySet())
            {
                getConfig().set("groupnames."+ p , getGroupN().get(p));
            }
            for(String p : getGroups().keySet())
            {
                getConfig().set("groups."+ p , getGroups().get(p));
            }
            for(String p : getGSize().keySet())
            {
                getConfig().set("groupsize."+ p , getGSize().get(p));
            }
            for(String p : getGChunks().keySet())
            {
                getConfig().set("chunks."+ p , getGChunks().get(p));
            }
    l.103        getConfig().set("citynames.", cityname);  #cityname is a List<String>
            saveConfig();
        }
    and I was a little bit confused when it returned me this in the console while trying to reload the server

    Error 1 (open)

    [00:12:23 ERROR]: Error occurred while disabling SnowClaim v1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: Cannot set to an empty path
    at org.apache.commons.lang.Validate.notEmpty(Validate.java:321) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.configuration.MemorySection.set(MemorySection.java:177) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at org.bukkit.configuration.MemorySection.set(MemorySection.java:211) ~[craftbukkit-1.13.2.jar:git-Bukkit-84f3da3]
    at fr.snowdingerr.snowclaim.mainclass.onDisable(mainclass.java:103) ~[?:?]


    ConfigFile (open)

    ########################################
    ########## Les Données. #############
    ########################################
    chunkcredits:

    gmasters:

    groupnames:

    groups:

    groupsize:

    chunks:

    citynames:


    if anyone tells me the error I would gladdly thanks him ^^
     
  2. Offline

    ToldiIII

    Where the getCC(), getMasters() methods? Or these methods only a Map<String, String>? Also, make sure you put the object key/value to the map what you want to be listed.
     
  3. Offline

    Strahan

    Why not just write the HashMap to the config directly? Would seem to be a lot easier to me.
     
Thread Status:
Not open for further replies.

Share This Page