CommandPrompter now allows you to add a command to execute after all of the prompts have been completed called PostCommand
Examples below are in the context of a player. If you're using Console Delegate, the commands will be sent as console, making some commands have the wrong arguments. Adjust your command arguments respectively.
A PostCommand
is an assignable PromptQueueArgument
with the key -exa
, which stands for execute after
, which tells the parser to add a command that the plugin is going to execute after all of the prompts have been completed.
Here is an example:
This should execute the command /say hello world!
after completion.
An additional feature is the ability to put placeholders if you want to use one of the answers from the prompts. The placeholder format is p:<index>
. Since I'm using the index, the index of the first prompt will always be 0
.
let's say, I enter Hello World!
on the text prompt, the command to execute at the end should be /say Hello World!
Another feature available starting from 2.3.0
is the ability to have more than one Post Command
. Here's an example of this.
The main command is /time set
however, we have three post commands that also clear the weather and also broadcast that the time and weather had been changed.
You can add a tick delay for a post command by adding a :<ticks>
after the exa
With the example above, we ask which player to give operator to. But after 100 ticks (5 seconds), we remove that operator status from that player.
This is another useful feature when you want to execute a command when the player cancels the command completion. This gives you the ability to re-open another menu if the prompt is canceled.
The example above will re-open the punish
menu if the anvil prompt gets canceled.