Solved Plugin doesn't really do anything

Discussion in 'Plugin Development' started by SpongyBacon, Jul 2, 2014.

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

    SpongyBacon

    Hi!
    Essentially, i've been told to avoid using static as much as possible, so i've tried to remove it from my plugin (as it was breaking stuff), but now when I use my plugin, it just doesn't do anything. It doesn't have errors, and enables as normal.

    When I type commands, it just returns the usage too.

    Main class: http://paste.md-5.net/pefelonice.avrasm
    plugin.yml: http://paste.md-5.net/gumugifime.sm

    If you want to see any more classes, then just ask and i'll be happy to show you.
    Thanks, hope you can help!
     
  2. Offline

    tommyhoogstra

    If you are no longer using statics and this problem has been caused, then perhaps it can't access the classes needed?
     
    SpongyBacon likes this.
  3. Offline

    SpongyBacon

    Thing is i've added it all into the constructors (See the main class)
     
  4. your onEnable method is the problem

    it should not pass in any arguments...
    since you have onEnable with arguments passed in it does not get called so it should always look like this no matter what, otherwise you are not overriding the onEnable method like you should be..

    Code:java
    1. @Override
    2. public void onEnable() {
    3. //stuff goes here
    4. }


    you are initiallizing your classes incorrectly too they should be done so like for your stone sword class for example should be done like this.

    Code:java
    1. public STONE_SWORD stone_sword;
    2.  
    3. @Override
    4. public void onEnable() {
    5. this.stone_sword = new STONE_SWORD();//
    6. }


    also by convention your class names should start with one capital and captials for each new word so for STONE_SWORD class should be named StoneSword or simular.
     
    SpongyBacon and tommyhoogstra like this.
  5. Offline

    SpongyBacon

    Woah thanks alot, i'll give this a try!
     
  6. Offline

    Traks

    Basically what teozfrank said. This is the reason you should always include the @Override annotation when overriding methods.
     
  7. Its not a requirement, but doing so can take advantage of the compiler checking to make sure you actually are overriding a method when you think you are. This way, if you make a common mistake of misspelling a method name or not correctly matching the parameters (which is what the OP did), you will be warned that your method does not actually override as you think it does. Secondly, it makes your code easier to understand because it is more obvious when methods are overwritten.
     
    mythbusterma likes this.
  8. Offline

    SpongyBacon

Thread Status:
Not open for further replies.

Share This Page