Get File from other package

Discussion in 'Plugin Development' started by Dreeass, Dec 18, 2012.

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

    Dreeass

    So I've got some stuff set up for multilingual support, but I always get a null URL when trying to get the file from another package, how do I get the file which is an yml as a File object? Let's state that the package the yml file is in is me.Dreeass.plugin.locale and the file is called english.yml.
     
  2. use Plugin.getResource(String resourcePath), this returns an inputstream.
    That inputstream can be passed to YamlConfiguration.loadConfiguration.

    Path should be me/Dreeass/plugin/locale/FILE.EXT
     
  3. Offline

    Dreeass

    Is Plugin the main file or is it a variable, cause I use main to direct to my main file in the constructor. When I use Plugin, it gives me a couple of different options like PluginBase, Event and Logger.
     
  4. You want it to be a variable referencing your plugin class, (the one you wrote that extends JavaPlugin)
     
  5. Offline

    Dreeass

    I found out that the methods that I was using via the getClassLoader worked fine, but that I forgot to set the name when I called the object from another class. Thanks anyway.
     
Thread Status:
Not open for further replies.

Share This Page