Solved Config List being overwritten

Discussion in 'Plugin Development' started by acer5999, Nov 25, 2014.

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


    I have noticed quite a large bug in my plugin. The config list for players is being overwritten a new location is being added. I am recording clicks on block and on every click there is supposed to be a new entry of a location under the players UUID
    - e6b31860-846f-4325-adc9-b03d120e5410 -476.0 66.0 579.0 0.0 0.0
    but whenever I click a block it overwrites the section leaving me with only one line even if I click 30 different blocks. No Errors.
    Code that handles it:
    1. List<String> list = getConfig().getStringList(p.getUniqueId().toString());
    2. list.add(LocationUtils.serialize(e.getClickedBlock().getLocation()));
    3. getConfig().set(p.getUniqueId().toString(), list);
    4. saveConfig();

  2. Offline


    acer5999 Try debugging. Is the list you are grabbing the config returning all of the values that are already in it?
  3. Offline


    Already tried and no, it just overwrites
  4. Offline


    acer5999 I mean out print the data you grab from the config before adding a new value to it.
  5. Offline


    Also tried, it outputs
    [e6b31860-846f-4325-adc9-b03d120e5410 -476.0 66.0 579.0 0.0 0.0]
    Then for every click on that block or another it outputs [ ]
    Edit: Skionz

    Never mind, it was my fault, I left a line in there that shouldn't have been that was overwriting it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 13, 2016
Thread Status:
Not open for further replies.

Share This Page