Getting Data from other plugins [no API's]

Discussion in 'Plugin Development' started by stargateanubis14, Jan 11, 2012.

Thread Status:
Not open for further replies.
  1. I'm trying to work on a web interface for users to view all their data online. This is fairly simple to do for plugins using MYSQL, but i'm also wanting to get data that is stored in other plugin's folders... (such as users saved locations, town settings, etc etc)... the problem is, there's no API.

    I'm fairly new to plugin and java dev, but i catch on pretty fast.
    So if anyone has any ideas to try, lemme know.


    Again, all i want is to be able to read from basic config/data files, to get a result (from there i can pass info to where it needs to go)


    THANKS!
     
  2. If the plugins themselves don't offer their data willingly, you can process the configs manually but that's not really a good method because you must get the convertor for each version of each plugin you support, and that's alot.

    It's doable tough.
     
  3. Does your webserver have access to all the files? (Like the config.yml files.) Then you can just make your own file reader and read the config's yourself.
     
  4. @Digi
    Hrm... i was hoping it would be a BIT easier (mainly because i'm a complete nub, and haven't much time to figure all that out).
    I was hoping to do something like:
    Code:
    <otherplugin>.getConfig().getString("string to look for", "default value");
    Normally <otherplugin> would be 'this'... i was hoping it would be someway like that to check.
    No, my web server doesn't have access to the files on the MC server (2 diff things). I'm using another plugin to send data to the web server (and then updating that way).
     
  5. Offline

    wwsean08

    you could use reflection to read their data, though reflection is a pretty advanced topic in java, and hard to understand in my opinion. If you don't mind ugly code check out reflection here
     
  6. @stargateanubis14
    Actually you kinda can, you can't use getConfig(), you just load other configs using YamlConfiguration.loadConfiguration("file here"); and just use getString() and stuff, but you still have to make those a class for each plugin to have the nodes wrote down.

    The problem is for custom storages, like flat file.
     
  7. Offline

    desht

    Err, why can't you use getConfig() ? There's no reason why this shouldn't work:

    PHP:
    for (Plugin p Bukkit.getServer().getPlugins()) {
      
    FileConfiguration cfg p.getConfig();
      
    // do what you need to do with the configuration
    }
    Of course, this will only work for those plugins who actually use the Bukkit configuration API to manage their configs. There's no general way to know exactly what custom configuration & data storage mechanism every plugin uses.

    If you want to pull everything from all plugins, you could use reflection, but again, there's no general way to know what data should actually be presented to a user (i.e. the vast majority of a plugin's internal workings should not be of interest to anyone but the plugin developer).
     
  8. I meant you can't use your plugin's instance of getConfig() and making a method to open customly named files would also be easier for other file names than config.yml, but that works :p
     
  9. Well, for now, i think i'm going to see about using the provided API's for the ones i have, and try some other things out later (when i have more time)
     
  10. You could also ask the plugin developers to provide a API for the processed data so your plugin can populate it on server's website.
     
  11. yeah, i'm thinkin about that too ;)

    But for now, its time to get into the Towny API, and figure that out (i'm such a noob with this stuff).I can make it to a certain point without errors, but eventually, it just decides to be stupid @:
     
Thread Status:
Not open for further replies.

Share This Page