|
| 1 | +--- |
| 2 | +title: Conditions |
| 3 | +sidebar_position: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +## Structure |
| 7 | + |
| 8 | +```yaml title="tasks.yml" |
| 9 | +get_diamonds: |
| 10 | + type: block_break |
| 11 | + |
| 12 | + conditions: |
| 13 | + - type: block |
| 14 | + materials: |
| 15 | + - DIAMOND_ORE |
| 16 | + - GOLD_ORE |
| 17 | + |
| 18 | + rewards: |
| 19 | + - guild_xp:100 |
| 20 | +``` |
| 21 | +
|
| 22 | +We are going to focus on the `conditions` part of the task structure. <br/> |
| 23 | + |
| 24 | +`Condtions` is a list of conditions written in this format: |
| 25 | + |
| 26 | +```yaml |
| 27 | +- type: <condition_type> |
| 28 | + <condition_parameters> |
| 29 | +``` |
| 30 | + |
| 31 | +where `<condition_type>` is the type of condition and `<condition_parameters>` are the parameters for that |
| 32 | +condition. <br/> |
| 33 | + |
| 34 | +## Parameters |
| 35 | + |
| 36 | +Before looking at the available condition types, let's look at the parameters formats that can be used in |
| 37 | +conditions. <br/> |
| 38 | + |
| 39 | +- String to value: `<parameter_name>:<value>` <br/> |
| 40 | +Example: `min-food:10` <br/> |
| 41 | + |
| 42 | +- String to list of values as YAML array. <br/> |
| 43 | +Example: |
| 44 | +```yaml |
| 45 | +materials: |
| 46 | + - DIAMOND_ORE |
| 47 | + - GOLD_ORE |
| 48 | + ``` |
| 49 | + |
| 50 | +### How do parameters work effectively? |
| 51 | + |
| 52 | +You will be able to find both formats depending on the condition type. <br/> |
| 53 | + |
| 54 | +In the complete documentation you will be able to find: |
| 55 | + |
| 56 | +- The accepted conditions for each task |
| 57 | +- The parameter name of each condition |
| 58 | +- The accepted values and formats for each parameter ( |
| 59 | + |
| 60 | +:::note |
| 61 | +Keep in mind that **you can't** use a different format from the one specified in the documentation for that condition |
| 62 | +type. <br/> |
| 63 | +You can get into trouble if you try to use a different format, so please follow the documentation carefully. <br/> |
| 64 | +::: |
| 65 | + |
| 66 | +## Types |
| 67 | + |
| 68 | +Condition types are string values which define the type of condition. <br/> |
| 69 | + |
| 70 | +:::warning |
| 71 | +The plugin actually supports ONLY the 1.8 achievements and tasks, so as of now, you can not use later achievements or |
| 72 | +tasks. <br/> |
| 73 | +We will implement features of newer versions in the future. <br/> |
| 74 | +::: |
| 75 | + |
| 76 | +### General Conditions |
| 77 | + |
| 78 | +These conditions will be structured using a list. <br/> |
| 79 | +In the table below, you can find the type id, the path and allowed values for each condition. |
| 80 | + |
| 81 | +| Type | Path | Allowed Values | Example Values | |
| 82 | +|-------------|----------------|-----------------------------------------------------------------------------------------|-----------------------------| |
| 83 | +| achievement | `achievements` | [Achievement IDs](https://helpch.at/docs/1.8/index.html?org/bukkit/Achievement.html) | `BREW_POTION`, `KILL_ENEMY` | |
| 84 | +| biome | `biomes` | [Biome IDs](https://helpch.at/docs/1.8/index.html?org/bukkit/block/Biome.html) | `DESERT`, `FOREST`, `TAIGA` | |
| 85 | +| block | `materials` | [Material IDs](https://helpch.at/docs/1.8/index.html?org/bukkit/Material.html) | `DIAMOND_ORE`, `GOLD_ORE` | |
| 86 | +| entity | `entities` | [Entity IDs](https://helpch.at/docs/1.8/index.html?org/bukkit/entity/EntityType.html) | `CREEPER`, `ZOMBIE` | |
| 87 | +| item | `materials` | [Material IDs](https://helpch.at/docs/1.8/index.html?org/bukkit/Material.html) | `DIAMOND_ORE`, `GOLD_ORE` | |
| 88 | +| potion | `potion_types` | [Potion Types](https://helpch.at/docs/1.8/index.html?org/bukkit/potion/PotionType.html) | `SPEED`, `SLOWNESS` | |
| 89 | + |
| 90 | +### Player Conditions |
| 91 | + |
| 92 | +For player conditions, we usually have different parameters for each condition type. <br/> |
| 93 | + |
| 94 | +<details> |
| 95 | + <summary>Player Experience</summary> |
| 96 | + |
| 97 | + Condition based on the player's experience level and points.<br/> |
| 98 | + If `check-level` is true, the player's level must be within the specified range.<br/> |
| 99 | + If `check-exp` is true, the player's experience points must be within the specified range.<br/> |
| 100 | + |
| 101 | + ```yaml |
| 102 | + type: player_experience |
| 103 | + min-level: 10 |
| 104 | + max-level: 20 |
| 105 | + check-level: true |
| 106 | +
|
| 107 | + min-exp: 1000 |
| 108 | + max-exp: 5000 |
| 109 | + check-exp: true |
| 110 | + ``` |
| 111 | + |
| 112 | +</details> |
| 113 | + |
| 114 | +<details> |
| 115 | + <summary>Player Flight</summary> |
| 116 | + |
| 117 | + Condition based on the player's ability to fly or flying state.<br/> |
| 118 | + If `is-flying` is true, the player must be flying.<br/> |
| 119 | + If `check-allow-flight` is true, the player must be allowed to fly.<br/> |
| 120 | + |
| 121 | + ```yaml |
| 122 | + type: player_flight |
| 123 | + is-flying: true |
| 124 | + check-allow-flight: true |
| 125 | + ``` |
| 126 | + |
| 127 | +</details> |
| 128 | + |
| 129 | +<details> |
| 130 | + <summary>Player Food</summary> |
| 131 | + |
| 132 | + Condition based on the player's food level.<br/> |
| 133 | + `min-food` and `max-food` define the accepted food level range.<br/> |
| 134 | + |
| 135 | + ```yaml |
| 136 | + type: player_food |
| 137 | + min-food: 10 |
| 138 | + max-food: 20 |
| 139 | + ``` |
| 140 | + |
| 141 | +</details> |
| 142 | + |
| 143 | +<details> |
| 144 | + <summary>Player Game Mode</summary> |
| 145 | + |
| 146 | + Condition based on the player's game mode.<br/> |
| 147 | + `gamemodes` is a list of accepted game modes: `SURVIVAL`, `CREATIVE`, `ADVENTURE`, `SPECTATOR`.<br/> |
| 148 | + |
| 149 | + ```yaml |
| 150 | + type: player_gamemode |
| 151 | + gamemodes: |
| 152 | + - SURVIVAL |
| 153 | + - CREATIVE |
| 154 | + ``` |
| 155 | + |
| 156 | +</details> |
| 157 | + |
| 158 | +<details> |
| 159 | + <summary>Player Health</summary> |
| 160 | + |
| 161 | + Condition based on the player's health.<br/> |
| 162 | + `min-health` and `max-health` define the accepted health range.<br/> |
| 163 | + |
| 164 | + ```yaml |
| 165 | + type: player_health |
| 166 | + min-health: 10 |
| 167 | + max-health: 20 |
| 168 | + ``` |
| 169 | + |
| 170 | +</details> |
| 171 | + |
| 172 | +<details> |
| 173 | + <summary>Player Location</summary> |
| 174 | + |
| 175 | + Condition based on the player's location.<br/> |
| 176 | + `worlds` is a list of accepted worlds.<br/> |
| 177 | + If `check-coordinates` is true, the player's coordinates must be within the specified min and max for x, y, z.<br/> |
| 178 | + |
| 179 | + ```yaml |
| 180 | + type: player_location |
| 181 | + worlds: |
| 182 | + - world1 |
| 183 | + - world2 |
| 184 | +
|
| 185 | + check-coordinates: true |
| 186 | + min-x: 100 |
| 187 | + max-x: 200 |
| 188 | + min-y: 50 |
| 189 | + max-y: 100 |
| 190 | + min-z: 100 |
| 191 | + max-z: 200 |
| 192 | + ``` |
| 193 | + |
| 194 | +</details> |
| 195 | + |
| 196 | +<details> |
| 197 | + <summary>Player Permission</summary> |
| 198 | + |
| 199 | + Condition based on the player's permissions.<br/> |
| 200 | + `permissions` is a list of required permissions.<br/> |
| 201 | + If `require-all` is true, the player must have all listed permissions.<br/> |
| 202 | + |
| 203 | + ```yaml |
| 204 | + type: player_permission |
| 205 | + permissions: |
| 206 | + - guilds.tasks.test |
| 207 | + - guilds.tasks.another-test |
| 208 | + require-all: true |
| 209 | + ``` |
| 210 | + |
| 211 | +</details> |
| 212 | + |
| 213 | +<details> |
| 214 | + <summary>Player Potion Effect</summary> |
| 215 | + |
| 216 | + Condition based on the player's active potion effects.<br/> |
| 217 | + `potion-effects` is a list of required effects.<br/> |
| 218 | + If `require-all` is true, the player must have all listed effects.<br/> |
| 219 | + |
| 220 | + ```yaml |
| 221 | + type: player_potion |
| 222 | + potion-effects: |
| 223 | + - SPEED |
| 224 | + - SLOWNESS |
| 225 | + require-all: true |
| 226 | + ``` |
| 227 | + |
| 228 | +</details> |
| 229 | + |
| 230 | +<details> |
| 231 | + <summary>Player Sneak</summary> |
| 232 | + |
| 233 | + Condition based on the player's sneak state.<br/> |
| 234 | + If `is-sneaking` is true, the player must be sneaking.<br/> |
| 235 | + If `check-sneak` is true, the sneak state will be checked.<br/> |
| 236 | + |
| 237 | + ```yaml |
| 238 | + type: player_sneak |
| 239 | + is-sneaking: true |
| 240 | + check-sneak: true |
| 241 | + ``` |
| 242 | + |
| 243 | +</details> |
0 commit comments