Skip to content

Execution commands

Sven Rahn edited this page Jun 13, 2018 · 24 revisions

If

/cu execute if <conditionCmd> <commands...> 

The conditionCmd is executed first. If the returned CommandResult is SUCCESS, the following commands are executed.

You have to wrap all commands in the if command in " quotes:

/cu execute if "*cu has money KitCrafty 30" "*say KitCrafty has at least 30$" ^-- conditionCmd ^-- actual command 

Longer example:

/cu execute if "*cu has money KitCrafty 30" "*say KitCrafty has at least 30$" "*give KitCrafty minecraft:cookie 1" "*say and therefore he got one cookie" ^-- conditionCmd ^-- actual command #1 ^-- actual command #2 ^-- actual command #3 

You can use any condition command from this plugin or any other command from another plugin which returns a meaningful CommandResult. For further help you can ask me on my discord.

You can also invert the returned CommandResult:

/cu execute if not .... 

Delayed

/cu execute delayed <duration> <command> 

duration is specified like described here.

Example: /cu execute delayed 2s say This was delayed by 2 seconds!

Note: This does not persist between server restarts! So delays of 1d or more are not recommended.

WhenOnline

/cu execute whenOnline <playerName>|<playerUuid> <command> 

This allows you to execute commands automatically when a player that is currently offline joins the server again. This may be useful for lottery-like use cases, the selected winner is offline but still has to receive his prize. This example would look like this:

/cu execute whenOnline KitCrafty *give $p minecraft:cookie 3

$p gets replaced by the target, here KitCrafty. The * makes the command to be executed by the console which has all permissions.

If the player is online when execute whenOnlince is executed, the give command is executed right away. So you can wrap every command targeting a player in execute whenOnline to be safe that the player is online.

The commands get executed in the order they were queued.

Parsed

/cu execute parsed <targetPlayerName>|<targetPlayerUuid> <command> 
/cu execute parsed KitCrafty *say The player name is %player%! 

Parses the given command against PlaceholderAPI. It replaces any placeholder, like %player%. If you use the v4.5-pre-release on this page, you can even use %user% to target offline players.

Clone this wiki locally