How to check name and version of my plugin? (code)

Discussion in 'Plugin Development' started by Urag, Aug 2, 2015.

Thread Status:
Not open for further replies.
  1. How to check name and version of my plugin? (code)
     
  2. Moved to Plugin Development.

    @Urag getDescription()
     
    Urag likes this.
  3. Can you explain more? I'm beginning with plugins.
     
  4. @Urag If you are getting this in onEnable for example you can use that method to get certain things. This will grab the information right from the plugin.yml

    Code:
    public void onEnable(){
        getLogger().info("This will print the author(s): " + getDescription().getAuthors());
    }
    This can be used to get version, description, author(s), name etc
     
    Urag likes this.
  5. @Urag That class isn't a plugin, you need to get the main class. You need to get the main class instance.
     
    Urag likes this.
  6. @bwfcwalshy
    How to do that? And then how to get plugin's description?
     
  7. @Urag Here is an example

    Code:
    MainClass main;
    public Class2(MainClass main){
        this.main = main;
    }
    main can then be used.
     
    Urag likes this.
  8. Last edited: Aug 2, 2015
  9. Offline

    MCMatters

    @Urag Many is wrong. Please learn java.
     
  10. Urag likes this.
  11. Urag likes this.
  12. @bwfcwalshy
    If it would be in my language i could do that.
    If you can - help me the easiest way. Please, give me the ready code. I'll see once and I'll remember it. I'm too stupid to do it by myself, sorry.
     
  13. @Urag
    This forum is not for giving you ready code. Everyone says they remember but they have no idea what it really does. You need to pass the plugin's instance through a constructor, that's what @bwfcwalshy was referring to.
     
  14. Offline

    NickDEV

    @Urag Why don't you use only one class if you're beginning with plugins? It's easier and i bet your codes aren't so big you can't orginaze, when you will become better and you need multiple classes to orginaze start using them not in the beginning. (or watch pogostick29dev i think he made multiple classes video).
     
    Urag likes this.
Thread Status:
Not open for further replies.

Share This Page