Plugin Does nothing @ all.

Discussion in 'Plugin Development' started by ladylady1, Mar 5, 2015.

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

    ladylady1

    Trying to make a plugin so if a player types /op it tells them instead to type /getop but if they have xxx permission. then it ops them. or the target.

    Code: http://pastebin.com/djry9r22
    plugin.yml: http://pastebin.com/x8rDzyqF

    If i type /op in game it does nothing. No error, No message @ all. And still doesnt op me on top of that.
     
  2. @ladylady1 Please learn Java before trying to code with an API that's written in it. If you learn at least the basics of Java things will make so much more sense to you when coding, debugging, etc. Anyway, onto your problem. A couple of things with your plugin:
    1. You're returning false in your onCommand method. Change that to true.
    2. You aren't using any brackets in your else statement in your onCommand method.
    3. You don't need to log when the plugin enables/disables, Bukkit already does this for you.
    4. Learn Java! :)
    5. Check if the sender is a player before casting.
    6. Your plugin.yml is all out of whack. Please see an online reference to a proper plugin.yml
    Hope this helped a little! :)
     
    Last edited: Mar 6, 2015
    Regablith likes this.
  3. Offline

    SuperOriginal

  4. Offline

    Rocoty

    The problem is that you did not override the onCommand method. The last parameter should be a String array (or String varargs), not a String. If you had used the @Override annotation the compiler would have let you know this. Always use this annotation when overriding. It makes your intent clear and prevents mistakes like this.

    Your plugin.yml may also be partly at fault. Your indentation seems a bit off.
     
Thread Status:
Not open for further replies.

Share This Page