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. Offline

    Urag

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

    bwfcwalshy Retired Staff

    Moved to Plugin Development.

    @Urag getDescription()
     
    Urag likes this.
  3. Offline

    Urag

    Can you explain more? I'm beginning with plugins.
     
  4. Offline

    bwfcwalshy Retired Staff

    @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. Offline

    Urag

  6. Offline

    bwfcwalshy Retired Staff

    @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.
  7. Offline

    Urag

    @bwfcwalshy
    How to do that? And then how to get plugin's description?
     
  8. Offline

    bwfcwalshy Retired Staff

    @Urag Here is an example

    Code:
    MainClass main;
    public Class2(MainClass main){
        this.main = main;
    }
    main can then be used.
     
    Urag likes this.
  9. Offline

    Urag

    Last edited: Aug 2, 2015
  10. Offline

    MCMatters

    @Urag Many is wrong. Please learn java.
     
  11. Offline

    bwfcwalshy Retired Staff

    Urag likes this.
  12. Offline

    Urag

  13. Offline

    bwfcwalshy Retired Staff

    Urag likes this.
  14. Offline

    Urag

    @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.
     
  15. Offline

    megamichiel

    @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.
     
  16. 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