Commands Not Working

Discussion in 'Plugin Development' started by BlackLight2633, Jun 29, 2015.

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

    BlackLight2633

    I am trying to create a factions plugin, so I exported it, and when I typed '/f', nothing happened. I checked the console, and there was still nothing. This is the 'onCommand' method:
    Code:
    public boolean onCommand(Command cmd, CommandSender p, String commandLabel, String[] args) {
            if (cmd.getName().equalsIgnoreCase("faction") || cmd.getName().equalsIgnoreCase("f")) {
                if (p instanceof Player) {
                    if (((Player) p).getWorld().equals(Bukkit.getWorld("factions"))) {
                        CommandsManager.manageCommand((Player) p, args);
                    } else Methods.message((Player) p, "&cType /factions to get to the faction world.");
                } else {
                    Methods.message((Player) p, "&cThis command is only for ingame players!");
                } return true;
            } else if (cmd.getName().equalsIgnoreCase("testcmd")) {
                p.sendMessage("hi");
            }return false;
        }
    This is the plugin.yml:
    Code:
    name: CoreFactions
    prefix: Factions
    version: 0.0.1
    main: me.Sicarious.factions.Factions
    author: Sicarious
    commands:
      faction:
      aliases: f
      testcmd:
    
     
  2. Offline

    ark9026

    @BlackLight2633
    The layout for commands in the plugin.yml is:
    Code:
    commands:
                 faction:
                          description: Description goes here
                          usage: /<command>
                          aliases: f
                 testcmd:
    //Same stuff here
     
  3. Offline

    mkezar

    that doesn't really matter. I use a similar setup to @BlackLight2633 but when I reach commands, I indent.
     
  4. @mkezar
    Actually, @ark9026 is right. YML can be very sensitive. @BlackLight2633 put the aliases in the same indentation as the command name, which makes YML read it as a different command.
     
    ark9026 likes this.
Thread Status:
Not open for further replies.

Share This Page