Need help with ConfigurationSerialization

Discussion in 'Plugin Development' started by MiniDigger, Aug 28, 2013.

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

    MiniDigger

    Hello guys,
    i have some problems with the serializations of my objects.
    I have a object implementing ConfigurationSerializable. My serialization methods are like that:
    Code:java
    1. @Override
    2. public Map<String, Object> serialize() {
    3. Map<String, Object> result = new LinkedHashMap<>();
    4.  
    5. result.put("name", name);
    6.  
    7. return result;
    8. }


    Code:java
    1. public static User deserialize(Map<String, Object> args) {
    2. User result = new User();
    3. result.name = (String) args.get("name");
    4. return result;
    5. }


    I registered the class in my onEnable() like this:
    Code:
    ConfigurationSerialization.registerClass(User.class, "User");
    When i save the object into a config i can see the object there.
    But when i load it user.name is null. Can anybody tell me why?

    nobody who can help me?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  2. Offline

    Minecrell

    MiniDigger
    Can you post the code where you loading the users here?
     
  3. Offline

    MiniDigger

    Minecrell
    Hier sind die Zeilen (here are the lines)
    load: users = (ArrayList<User>) config.get("users");
    save: config.set("users", users);
     
Thread Status:
Not open for further replies.

Share This Page