Bukkit FileConfiguration not working (only on óne server)

Discussion in 'Plugin Development' started by Rprrr, Mar 27, 2013.

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

    Rprrr

    Hi,

    I'm having lots of trouble with the FileConfiguration.

    So yeah, let me explain this: I've made a plugin that uses a .yml file for storage. It stores data in the file, and it sometimes retrieves data. I had this working perfectly with my own FileManager class - it worked on my testing server and my server.

    However, I've also sent the plugin to someone else, but he's having major trouble with running it on his server. Writing in the file works fine, and there are no errors when loading it. The fact that the plugin can write in the file, means there should be no errors with different file separators on different operating systems (I've even had that problem before with the class, and I fixed it then). Saving the file also works fine.

    It's just when I want to get data from the file when the problems occurs. For some reason, it can't find items that I put in - and I know they're in, because you can see them in the file.

    What's making this really, really strange is that I don't have this problem on any other server. It's just that server - the same plugin works perfectly for me on my testing server and on my server.

    Anyway, because I thought that the problem could be caused by my own FileManager, I decided to get rid of the FileManager class, and go back to the basic Bukkit FileConfiguration (plugin.getConfig()). I rewrote everything so that was used in all cases.

    But, the problem remained. The plugin still works perfectly on my server - like it used to do. But even with Bukkit's own YML-functions, it doesn't work.

    Does anyone have an idea? I've literally tried everything in order to solve this.

    Thanks in advance!
     
  2. Offline

    Nitnelave

    Give us some sample code on how you use the file, (read and write), and some characteristics of both systems. Try to use it on a third system to see which behaviour is exceptional, or what it is linked to.
     
  3. Offline

    Rprrr

    Nitnelave
    I simply read using Bukkit's methods:
    Code:
    String displayName = itemStack.getItemMeta().getDisplayName();
     
    plugin.reloadConfig();       
                                   
    if (plugin.getConfig().getConfigurationSection(displayName) != null || plugin.getConfig().contains(displayName) || plugin.getConfig().get(displayName) !=null){
    That's also how I write:
    Code:
            plugin.reloadConfig();
           
            plugin.getConfig().set(displayName + "." + 1 + "." + 1, "Something");
     
            plugin.saveConfig();
    These codes work perfect on my own PC's testing server - and it also works fine on my server that's hosted on another system (by a hosting company). I have no idea what the exceptional behaviour on the other server is being caused by.. :s.

    Thanks for your help, any ideas?
     
  4. Offline

    Nitnelave

    Have you checked that the same input generates the same file on both servers? Have you tried reading a file he created on your server?
    Give us some characteristics of both servers (what os? what java version? bukkit version?).
     
  5. Offline

    Rprrr

    Nitnelave
    Well, it is not my server, so I do not know all specs.

    I don't think the operating system is influencing this, because the plugin is able to find the file on both servers (it manages to write in it).

    I do know that we've tested it with several Bukkit builds (in fact, the server ran the same Bukkit build as on the server it wasn't working on). On both servers, the .yml files look the same after putting the same data in. The only difference is that one server can't read from the .yml file.. :s
     
  6. Offline

    Nitnelave

    Would it be a permission problem on linux? It wouldn't have access to the file? Try and output simply the file to the console as a simple text file.
    And tell us what OS the systems are using and the java version!
     
  7. Offline

    Rprrr

    Nitnelave
    Alright, I think I actually found the error - it are the colour codes.

    I was using coloured strings, and for some reason (OS, perhaps), on one server the colour code characters appeared as a '?', and on the other servers it appeared as a '§'. So I think that's causing the problems..
     
  8. Offline

    Nitnelave

    I think Bukkit has methods for converting back and forth colour codes.
     
Thread Status:
Not open for further replies.

Share This Page