Module: predicate
Overview
This module provides a collection of predicate commands.
They can be used to test the conditions.
Color Boxes
◉ How it works?
A predicate command will return an integer value to represent the SUCCESS or FAILED test result.
It relies on the return value of command in vanilla Minecraft.
See https://minecraft.fandom.com/wiki/Commands/return
Actually, you can also use the predicate command with command block.
◉ Test a condition, and then run a command if success.
Issue: /run as player Alice chain has-perm? %player:name% 4 chain say value is true
◉ Test if a player is holding an apple
Issue: /command-debug is-holding? Steve minecraft:apple
◉ Test if a player has specified string permission
Issue: /command-debug has-perm? Steve fuji.permission.back
◉ Test if a player's health >= 10
Issue: /command-debug <=? Steve 10 %player:health%
◉ Test if a player killed more than 100 zombies.
Issue: /command-debug <=? Steve 100 %player:statistic_raw minecraft:killed minecraft:zombie%
◉ Leverage the vanilla Minecraft statistics
See: https://minecraft.fandom.com/wiki/Statistics
◉ More examples
You can see more examples in command_meta.IF module and command_meta.chain module.
Commands
- Command Syntax:
/!=? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/<=? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/<? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/=? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/>=? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/>? <ServerPlayer player> <double value> <GreedyString numericValueString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/equals? <ServerPlayer player> <String expectedString> <GreedyString placeholderString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/false? <ServerPlayer player> <GreedyString placeholderString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/has-exp-level? <ServerPlayer player> <int expLevel> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/has-exp? <ServerPlayer player> <int exp> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/has-item? <ServerPlayer player> <Result itemPredicate> <int count> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
-
Command Syntax:
/has-level? <OfflineGameProfile player> <int levelPermission> -
Document: Predicate to test if the player has the level-perm?
-
Can be executed by console:
true -
Required Level Permission:
4 -
Required String Permission:
null
- Command Syntax:
/has-perm? <OfflineGameProfile player> <GreedyString stringPermission> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
-
Command Syntax:
/has-players? [Integer n] -
Document: Predicate if online players >= n.
-
Can be executed by console:
true -
Required Level Permission:
4 -
Required String Permission:
null
- Command Syntax:
/is-holding? <ServerPlayer player> <Result itemPredicate> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/is-in-gamemode? <ServerPlayer player> <GameType gameMode> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/is-in-world? <ServerPlayer player> <Dimension dimension> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/is-op? <ServerPlayer player> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/matches? <ServerPlayer player> <String expectedString> <GreedyString placeholderString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null
- Command Syntax:
/true? <ServerPlayer player> <GreedyString placeholderString> - Document: null
- Can be executed by console:
true - Required Level Permission:
4 - Required String Permission:
null