Commands aren't working...

Discussion in 'Plugin Development' started by blm456, Dec 17, 2013.

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

    blm456

    So I'm coding a plugin and when I'm trying to do commands all I'm getting back is the command usage I defined in the plugin.yml... There are no errors appearing in the console.

    Code:java
    1. @Override
    2. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    3. if(label.equalsIgnoreCase("jail")){
    4. sender.sendMessage("working");
    5. }
    6. return super.onCommand(sender, command, label, args);
    7. }


    any help would be great :D
     
  2. Offline

    Jaaakee224

    Might be wrong, but I think you didn't do the return statement correctly.
    Code:
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(label.equalsIgnoreCase("command")){
        sender.sendMessage("working");
     
    }
        return false;
     
  3. Offline

    blm456

    I tried setting the return to what it is, false, and true and nothing has worked...
     
  4. Offline

    Jaaakee224

    It has to be false, make sure you imported everything with Bukkit. Also don't copy what I did, make sure to add your }'s as well.
     
  5. Offline

    blm456

    I checked everything and It's not working -.-
     
  6. Offline

    Jaaakee224

    Give me what it says in the console.
     
  7. Offline

    blm456

    ok I run:
    Code:
    jail blm456
    and get back:
    Code:
    /jail <playername>
     
  8. Offline

    Goblom

    Make sure you have added the command to your plugin.yml. And are also using the getCommand() method
     
  9. Offline

    Jaaakee224

    Code:
     if(label.equalsIgnoreCase("command")){
    sender.sendMessage("working");
    If your command is /jail, why is this command "command"?
     
  10. Offline

    blm456

    I changed it for the forum
     
  11. Offline

    Jaaakee224

    It would help you if you left it, anyways, check your plugin.yml and add the command. Check your methods as well.
     
  12. Offline

    blm456

    oh ok... I edited the original post
     
  13. Offline

    Jaaakee224

    I edited my comment above, try it.
     
  14. Offline

    blm456

    well the weird thing is, I've made plugins with commands before and this is the first time I've seen this happen...

    could you give an example with the getCommand()

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page