Solved getDataFolder outside of JavaPlugin?

Discussion in 'Spigot Plugin Development' started by TheCreeperCow, Jun 7, 2017.

Thread Status:
Not open for further replies.
  1. Hi i would like to know if its possible to use getDataFolder() outside of the extended JavaPlugin class, if so how?
     
  2. Using the variable of your class JavaPlugin

    ---

    En utilisant la variable de ta class JavaPlugin
     
    • Agree Agree x 1
  3. I always make a static variable for the main class, and i can reach from everywhere. :)
     
    • Optimistic Optimistic x 1
  4. Thanks that worked now i have an different issue of needing to make a static reference to it but not able to because the thing is non-static how could i resolve this?
     
  5. Gianluca

    Gianluca Retired Resource Staff
    Retired Patron

    Create a way to access your main class elsewhere. The static method above is an option, but, it shouldn't be used as an access modifier

    Code (Text):
    private NameOfMainClass plugin;

    public NameOfCurrentClass(NameOfMainClass plugin) {
      this.plugin = plugin
    }
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.