Solved getDataFolder is returning null

Discussion in 'BungeeCord Plugin Development' started by KarmaConfigs, Feb 13, 2020.

  1. What do you mean with "Dependency Injection?", and also, I'm using mkdir, not mkdirs


    Fast search on google*: I'm not doing any dependecy Injection, at least, I didn't see any
     
  2. md_5

    Administrator Developer

    Not answering the problem...
     
  3. SteelPhoenix

    Moderator

    But with proper dependency injection OP would have more oversight. When using static it may not be clear what is loaded when
     
    • Agree Agree x 1
  4. Ok, now Its when I get confused, should I use static or not?
     
  5. No. Static = bad. Static should be used only for utility classes (aaand I forgot about the other usage, can someone from the java geeks remember? thanks)

    Dependency injection tutorial (thanks to MrDienns)

    Yes I answered the problem. The file object is non null (this) which means the plugin object is null which is triggering that issue. Why the plugin object is null? Because no proper dependency injection or no proper singleton is present.
     
    • Winner Winner x 1
  6. Can I do dependency injections in bungee?, Because the tutorial sais "Spigot plugins & Dependency Injections", also, do I need to use maven?

    This is definitely out of my knowledge, anyway I'll try out
     
  7. Of course you can. It is java so you can use it everywhere.
     
  8. @MrIvanPlays
    Wow thanks, it's working, I already listen about using static is bad, that's why I wasn't using it, until like everyone in this post, told me to use it, thanks.

    NOTE:
    Solution: Use Dependency Injection

    - Marking thread as solved