Solved Can someone help me with my plugin commands please

Discussion in 'Plugin Development' started by EnchantedMiners, May 30, 2015.

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


    Hello, i am currently coding a plugins idk if this is the right forum but please staffs if i am in the wrong one please move it not just remove it. ok so i need a dev to help me with the commands aparently i suck with commands i have all the methods of the plugin almost done i just need someone who can code commands we can use saros or any other way to share a project team viewer etc..
    Last edited by a moderator: May 30, 2015
  2. Offline


  3. Offline


    I think it might help if we get an example of what you have already done?
  4. Offline


    I'm not a big fan of giving code away - but I'll give you an example and explain it. I hope you can learn from it, at least.

    * CommandSender, sender - the player who performs the * command.
    * Command, cmd - the command
    * commandLabel - the command alias
    * String[] args - additional arguments, such as "/ban cookielover7"
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            if(!(sender instanceof Player))
    // If the sender isn't a player, nothing will happen. So if the console performs it, there will be no action. Of course you can add an action and make it send a message to the console. Example: sender.sendMessage("Only players can perform this command!")
                return false;
    //Now we're making the action if the player performs the command.
            Player p = (Player) sender; // We're making a variable, "p" is equals to sender.
             if (cmd.getName().equalsIgnoreCase("test")) { //The command, in this case test
             p.sendMessage("Wow, this test works);
    Please don't simply copy it, learn from it.
  5. @SemmieboyV Eh... Almost ^^
    sender can be Player OR ConsoleCommandSender
    And the commands must be registered in the plugin.yml file
  6. Offline


Thread Status:
Not open for further replies.

Share This Page