Shortcut Plugin

Discussion in 'Programming' started by DJJujuVI, May 31, 2016.

  1. Hey guys Im a new developer, I started learning 4 days ago and I am trying to turn a certain command into a shortcut for doing it. Example: /give grass 1 you do /grass 1 . Can you do that or not?
    Thanks!
     
  2. This should be in the Spigot Plugin Development section :p

    But assuming that you're creating your own plugin and own commands, the plugin.yml gives you the ability create aliases of the command that you're writing.

    Here's a link to the official documentation on the plugin.yml, just do Ctrl+F to do a quick search on the page for aliases.
     
  3. I think this is what you mean.

    Code (Text):
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
            if(alias.equalsIgnoreCase("grass")) {
                String nr = args[0];
                Player p = (Player) sender;
                p.chat("/give grass " + nr);
            }
            return false;
        }
     
  4. if only that was right...
     
    • Funny Funny x 1