Command not found

Discussion in 'Plugin Development' started by XxZHALO13Xx, Dec 28, 2014.

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

    XxZHALO13Xx

    I make my commands like

    Code:
      @Override
        public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
       if (sender instanceof Player){
                Player p = (Player) sender;
    
                if (args.length == 0){
                    p.sendMessage(ChatColor.DARK_RED + "-----" + ChatColor.RED + ChatColor.BOLD + "Vault Commands" + ChatColor.DARK_RED + "-----");
                    p.sendMessage(ChatColor.YELLOW + "/vault open");
                }
                else{
                    String cmd = args[0];
    
                    if (cmd.equalsIgnoreCase("open")){
    and what i want it to do is if someone types something thats not a command it'll say "That isn't a command do /whatever to see the correct command" to explain myself better: /commands op. op is the command and if it doesn't equal op or whatever else i have then i want it to do waht i said above
     
  2. @XxZHALO13Xx Do if(command.getName().equalsIgnoreCase("Blah"){ above the sender instance. I am not sure whether you mean the proper command or arguments, if proper command do an else to the if statement I said before and say the message to sender. If it is arguments then make your if's and else if's and end it with an else.
     
  3. Offline

    iRamonHD

    Do you have your plugin.yml setup well? With :

    Code:
    name:
    version:
    description:
    commands:
      yourcommand:
        description: Here's your description.
    ?

    <Edited by bwfcwalshy: Formatted, code tags makes it formatted plus it looks better :) >
     
  4. Offline

    CheesyFreezy

    Is this the main class? If it's not go to your main class and create a onEnable() void. In this void you should add this line of code:
    Code:
    getCommand("vault").setExecutor(new <Command Class Name>());
     
  5. Offline

    XxZHALO13Xx

    @CheesyFreezy lol this is a old thread and yes it was my main class
     
  6. Offline

    CheesyFreezy

  7. Offline

    XxZHALO13Xx

Thread Status:
Not open for further replies.

Share This Page