Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Discussion' started by MeneerEzra, Feb 4, 2020.
how do i execute a player to do a command
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
On a more serious note, is this for a plugin you are making or do you need an already made solution?
In the plugin, you can use this:
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.
You can also just do Player#performCommand(@NotNull String command)