Reloading config necessary?

Discussion in 'Plugin Development' started by recon88, Nov 26, 2012.

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

    recon88

    I got a simple friendlist system which is shared through 3 plugins.
    The main plugin will save it to friends.yml if someone adds me as his friend.
    But the other plugins are still using the old values (= I'm not a friend).
    It would work if I restart the server now.

    Do I have to reload the config before I access it again from other plugins?
    Or is there anything else which could be wrong?

    Code:java
    1.  
    2. // Should I add the reloadfriends() here?
    3. List<String> friends = ChestLock.friendsconf.getStringList(blockOwner + ".friends");
    4. // After that I'm checking if List "friends" contains the player who is trying to access
    5. friends.clear();
    6.  


    Code:java
    1.  
    2. public void reloadfriends() {
    3. if (friendsfile == null) {
    4. friendsfile = new File(getDataFolder(), "friends.yml");
    5. friendlist = YamlConfiguration.loadConfiguration(friendsfile);
    6. }
    7. }
    8.  
     
  2. Offline

    raGan.

    yes, you need to reload it
     
  3. Offline

    recon88

    So all plugins which interacs with the friends.yml have to reload the config on every single command right?
    Why? Is the data stored in ram ? Does it just update when I reload the file?

    Edit:
    Wouldn't be a BufferedReader/Writer better in this case?
     
  4. Offline

    raGan.

    Well, you can store the data inside a variable in the main plugin and have it accessed by side plugins through the API of some sort.
     
Thread Status:
Not open for further replies.

Share This Page