CommandExecutor not work? :?

Discussion in 'Plugin Development' started by gokarter24, Jun 29, 2014.

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


    I'm trying to get this command to work but its not working, all it does it sends /partner back to the player, here is my code :

    Thanks for helping in advance :D
  2. Offline


    Line 30:
    1. Player req = Bukkit.getPlayer(args[1]);
    Need to check if that argument is null before you reference it. Also, arrays start at 0, not 1, so if that is supposed to be the first argument, check that.

    Line 93:
    1. return false;
    This is why it always spits out the command usage. You have to return true to not do so. Return false tells the server that the command was not fired correctly, so it sends the usage from plugin.yml.

    As for the rest of your code, I can't really tell what is going on here... Looks like you're using another API (I assume that's what "API" in the code is) so I don't have a clue about it's methods. Though, I also don't see any imports for "API" either... Might want to look into that.
  3. Offline


    the req player variable is for the command /partner accept <player> so thats right I changed the other thing you told me so I will try it out. bdubz4552

    I don't whats wrong!?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 9, 2016
  4. Offline


    gokarter24 Have you registered your command in the main class, and in the plugin.yml?
  5. Offline


  6. Offline

    1Rogue Retired Staff

    If you're casting to player, check the type first. Don't just cast without knowing.
  7. Offline


    okay, will do. Any other advice? 1Rogue
Thread Status:
Not open for further replies.

Share This Page