Solved FileConfiguration

Discussion in 'Plugin Development' started by Sneling, Dec 10, 2014.

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

    Sneling

    Hello,
    I was wondering if it was possible to actually delete an entry in a FileConfiguration.
    Here is the syntax:
    I register a sign locations, infos in line, etc.. And, I want that, if the sign is break, the data in the FileConfiguration is deleted with it (I know it's not the best way to stock infos in a fileconfiguration, but I did like that here..). After searching, i'm still not sure if we can.
    I don't want to set the value to null, I want to delete the entry.

    FileConfiguration format:
    http://pastebin.com/4bvEdxhX
    According to the example I gave, I would like to delete "blabla" and all it's sub-entries.

    Thanks
     
  2. Offline

    Skionz

  3. Offline

    Sneling

    I tried setting the "blabla" to null, changes nothing. Let me test something else. If it works, ill post.

    EDIT: Didn't work...
     
  4. Offline

    Skionz

    @Sneling Make sure to save the config.
     
  5. Offline

    Sneling

  6. Offline

    Skionz

    @Sneling Post the stack-trace and the entire relevant class.
     
  7. Offline

    Sneling

  8. Offline

    Skionz

    @Sneling My bad, I misinterpreted your other message. Trying checking if the location in the config is the same as the one on the sign by printing out all of the values.
     
  9. Offline

    Sneling

    @Skionz It actually is. I'll try getting this world thing out.

    EDIT: Still, without world... This thing is getting really strange.

    After some recoil on my code, I can see my error.
    In the BreakSignManager, I check if the location are exactly the same, but the X,Y,Z are not, as they true one is in double( I mean by that, with probably 00.2545..), and the virtual location is in int.

    Just change the if(...) to: if(e.getBlock().getLocation().getBlockX() == l.getBlockX() && e.getBlock().getLocation().getBlockY() == l.getBlockY() && e.getBlock().getLocation().getBlockZ() == l.getBlockZ())

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

Share This Page