how do i execute a player to do a command

Discussion in 'Spigot Discussion' started by MeneerEzra, Feb 4, 2020.

  1. how do i execute a player to do a command
  2. Strahan


    I am fond of the guillotine for executions; it's quick and if you setup a large pegboard and some buckets right beneath it you can also enjoy a game of Plinko :D

    On a more serious note, is this for a plugin you are making or do you need an already made solution?
  3. In the plugin, you can use this:

    Code (Text):
    Bukkit.dispatchCommand(CommandSender, "command");
    This should work, CommandSender is an entity that executes the command. It can be a Player, or a console, or anyone that can execute a command. If you want a full list of subinterfaces that extends CommandSender interface, just look here :)

    If you want to execute a player to do a command without coding your own plugin, you can use many specific ways. For example, you can send clickable message using tellraw, you can use Command Blocks aswell.
  4. You can also just do Player#performCommand(@NotNull String command)
    • Like Like x 1