CMD Error

Discussion in 'Plugin Development' started by The Fancy Whale, Oct 2, 2013.

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

    The Fancy Whale

    I am designing a plugin for the first time and I tried adding a command but whenever I try I get errors and I can not seem to get rid of them
    Code:java
    1. package gpp.MaarioChase;
    2.  
    3. import org.bukkit.command.CommandSender;
    4.  
    5. public class MaarioChaseCommandExecuter {
    6.  
    7. @Override
    8. public boolean onCommand)(CommandSender sender, Command cmd, String label, String[] args) {
    9. if (cmd.getName().equalsIgnoreCase("mc info")) {
    10. sender.sendMessage("This plugin was created by Tiffany Valenti AKA The Fancy Whale");
    11. return true;
    12. }
    13. }
    14. return false;
    15. }


    The error i always get is from cmd.getname... and it says cmd can not be resolved.
    All help would be much appreciated! Thanks !
     
  2. Offline

    AguilaAudaz

    You don't have to put spaces there, just add arguments

    Replace the line:

    Code:java
    1. if (cmd.getName().equalsIgnoreCase("mc info")) {


    for:

    Code:java
    1. if(cmd.getName().equalsIgnoreCase("mc"))
    2. if(args.length >= 1 && args[0].equalsIgnoreCase("info"))


    Im not sure if this is right.
     
  3. Offline

    The Fancy Whale

    AguilaAudaz Okay I will try that

    AguilaAudaz Created more errors :/ Thanks for trying though

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

    AguilaAudaz

    Be careful with the brackets, this should work
     
  5. Offline

    Janmm14

  6. Offline

    Gater12

    The Fancy Whale Delete that parenthesis on the end of
    public Boolean onCommand
     
    The Fancy Whale likes this.
  7. Offline

    The Fancy Whale

    Gater12 I did that. It helped but not all of the problems solved.
     
  8. Offline

    xTrollxDudex

  9. Offline

    The Fancy Whale

  10. Offline

    xTrollxDudex

    The Fancy Whale
    No you didn't.
     
    Janmm14 likes this.
Thread Status:
Not open for further replies.

Share This Page