diff --git a/catalog/README.md b/catalog/README.md index 94bac8efd..d68eed14c 100644 --- a/catalog/README.md +++ b/catalog/README.md @@ -33,7 +33,8 @@ relative to. } ``` -- `id` is the key its settings are saved under. **Never change it**, saved settings would be lost. +- `id` is the key its settings are saved under. To rename it, move the old id into `fallbackIds`: the + plugin then still loads settings and game states saved under it, and a lookup by it finds the entry. - `key` is the message key below `challenge` (`challenge.cut-clean.name`, `.desc`). - `icon` is a `Material` constant, `color` (`"#RRGGBB"`) tints a potion or leather item. - `since`, `updated` mark the entry new or updated in the menu; `beta` leaves its class out of the @@ -47,7 +48,7 @@ Exactly one definition: | field | registers | |---|---| -| `class` | a class with a constructor without parameters; `requires` names a plugin it needs. Its commands come from the class (`CommandProvider`) | +| `class` | a class with a constructor without parameters; `requires` names a plugin it needs. Its commands come from the class (`CommandProvider`). `pairing` (`trigger`, `action`) names the custom challenge it plays at heart, its own rules on top, for a builder outside the plugin to point to it | | `preset` | `trigger`, `triggerSettings`, `action`, `actionSettings` and an optional `value` (`unit` is a `ValueUnit` constant, `min`, `max`, `default`) filled into a setting written `${value}` | | `damageRule` | the `DamageCause` constants it covers, `"*"` for all | | `materialRule` | the `Material` constants it covers | @@ -62,7 +63,7 @@ challenge class has an entry. in every bundled language, for readers without the plugin such as a website, which can read it from the repository. Each challenge also carries `styled`: its name, its description lines and its item tooltip as run through the menu's item formats, each line a list of text runs with the colour (hex) and bold the game -renders them with. A preset names its `trigger` and `action`, and the top-level `triggers` and `actions` +renders them with. `fallbackIds` lists the ids a challenge had before, for a reader that linked to it under one. A preset names its `trigger` and `action`, a challenge with a `pairing` names it the same way under `pairing`, and the top-level `triggers` and `actions` list what custom challenges are built from, with the same texts. Lore lines are joined into paragraphs, and a value the plugin fills in at runtime reads as an ellipsis or is left out. The file is committed: after changing the catalog or a challenge's texts, run `./gradlew :catalog:exportCatalog` and commit the result. `CatalogExportTest` fails while it is out of date. diff --git a/catalog/export/catalog.json b/catalog/export/catalog.json index 9258f9256..f30e86129 100644 --- a/catalog/export/catalog.json +++ b/catalog/export/catalog.json @@ -8483,10 +8483,17 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "random_item" } }, { - "id": "preset-damage-random-item", + "id": "damage-random-item", + "fallbackIds": [ + "preset-damage-random-item" + ], "category": "randomizer", "icon": { "material": "BEACON" @@ -8661,7 +8668,10 @@ } }, { - "id": "preset-level-random-item", + "id": "level-random-item", + "fallbackIds": [ + "preset-level-random-item" + ], "category": "randomizer", "icon": { "material": "EXPERIENCE_BOTTLE" @@ -8836,7 +8846,10 @@ } }, { - "id": "preset-advancement-random-item", + "id": "advancement-random-item", + "fallbackIds": [ + "preset-advancement-random-item" + ], "category": "randomizer", "icon": { "material": "KNOWLEDGE_BOOK" @@ -9157,6 +9170,10 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "random_hotbar" } }, { @@ -9337,6 +9354,10 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "drop_random_item" } }, { @@ -9517,6 +9538,10 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "remove_random_item" } }, { @@ -9719,6 +9744,10 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "swap_random_item" } }, { @@ -11117,7 +11146,10 @@ } }, { - "id": "preset-chunk-random-mob", + "id": "chunk-random-mob", + "fallbackIds": [ + "preset-chunk-random-mob" + ], "category": "entities", "icon": { "material": "SPAWNER" @@ -11515,7 +11547,10 @@ } }, { - "id": "preset-break-random-mob", + "id": "break-random-mob", + "fallbackIds": [ + "preset-break-random-mob" + ], "category": "entities", "icon": { "material": "IRON_PICKAXE" @@ -11690,7 +11725,10 @@ } }, { - "id": "preset-place-random-mob", + "id": "place-random-mob", + "fallbackIds": [ + "preset-place-random-mob" + ], "category": "entities", "icon": { "material": "BRICKS" @@ -11865,7 +11903,10 @@ } }, { - "id": "preset-craft-random-mob", + "id": "craft-random-mob", + "fallbackIds": [ + "preset-craft-random-mob" + ], "category": "entities", "icon": { "material": "CRAFTING_TABLE" @@ -12231,10 +12272,17 @@ ] ] } + }, + "pairing": { + "trigger": "jump", + "action": "random_mob" } }, { - "id": "preset-damage-random-mob", + "id": "damage-random-mob", + "fallbackIds": [ + "preset-damage-random-mob" + ], "category": "entities", "icon": { "material": "BLAZE_SPAWN_EGG" @@ -12416,7 +12464,10 @@ } }, { - "id": "preset-interval-random-mob", + "id": "interval-random-mob", + "fallbackIds": [ + "preset-interval-random-mob" + ], "category": "entities", "icon": { "material": "ZOMBIE_SPAWN_EGG" @@ -14781,6 +14832,10 @@ ] ] } + }, + "pairing": { + "trigger": "move_block", + "action": "damage" } }, { @@ -14976,6 +15031,10 @@ ] ] } + }, + "pairing": { + "trigger": "sneak", + "action": "damage" } }, { @@ -15171,6 +15230,10 @@ ] ] } + }, + "pairing": { + "trigger": "jump", + "action": "damage" } }, { @@ -15380,6 +15443,10 @@ ] ] } + }, + "pairing": { + "trigger": "block_break", + "action": "damage" } }, { @@ -15589,6 +15656,10 @@ ] ] } + }, + "pairing": { + "trigger": "block_place", + "action": "damage" } }, { @@ -15842,6 +15913,10 @@ ] ] } + }, + "pairing": { + "trigger": "pickup_item", + "action": "damage" } }, { @@ -16014,6 +16089,10 @@ ] ] } + }, + "pairing": { + "trigger": "advancement", + "action": "damage" } }, { @@ -16713,6 +16792,10 @@ ] ] } + }, + "pairing": { + "trigger": "damage", + "action": "freeze" } }, { @@ -17097,6 +17180,10 @@ ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "random_effect" } }, { @@ -17268,6 +17355,181 @@ ] ] } + }, + "pairing": { + "trigger": "new_chunk", + "action": "random_effect" + } + }, + { + "id": "biomeeffect", + "category": "effect", + "icon": { + "material": "MOSS_BLOCK" + }, + "name": { + "en": "Biome = Effect", + "de": "Biom = Effekt" + }, + "description": { + "en": [ + "Every biome gives you its own potion effect" + ], + "de": [ + "Jedes Biom gibt dir einen eigenen Effekt" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Biome = Effect", + "color": "#00AAAA" + } + ], + "description": [ + [ + { + "text": "Every " + }, + { + "text": "biome", + "color": "#00AAAA" + }, + { + "text": " gives you" + } + ], + [ + { + "text": "its own " + }, + { + "text": "potion effect", + "color": "#00AAAA" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Biome = Effect", + "color": "#00AAAA" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Every ", + "color": "#AAAAAA" + }, + { + "text": "biome", + "color": "#00AAAA" + }, + { + "text": " gives you", + "color": "#AAAAAA" + } + ], + [ + { + "text": "its own ", + "color": "#AAAAAA" + }, + { + "text": "potion effect", + "color": "#00AAAA" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "Biom = Effekt", + "color": "#00AAAA" + } + ], + "description": [ + [ + { + "text": "Jedes " + }, + { + "text": "Biom", + "color": "#00AAAA" + }, + { + "text": " gibt dir" + } + ], + [ + { + "text": "einen " + }, + { + "text": "eigenen Effekt", + "color": "#00AAAA" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Biom = Effekt", + "color": "#00AAAA" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Jedes ", + "color": "#AAAAAA" + }, + { + "text": "Biom", + "color": "#00AAAA" + }, + { + "text": " gibt dir", + "color": "#AAAAAA" + } + ], + [ + { + "text": "einen ", + "color": "#AAAAAA" + }, + { + "text": "eigenen Effekt", + "color": "#00AAAA" + } + ] + ] + } } }, { @@ -17603,51 +17865,65 @@ ] ] } + }, + "pairing": { + "trigger": "damage", + "action": "permanent_effect" } }, { - "id": "entityrandomeffect", + "id": "killeffect", "category": "effect", "icon": { - "material": "PHANTOM_MEMBRANE" + "material": "DRAGON_BREATH" }, "name": { - "en": "Mobs Have Random Effects", - "de": "Mobs Haben Zufällige Effekte" + "en": "Kill = Effect", + "de": "Kill = Effekt" }, "description": { "en": [ - "Every Mob has a random potion effect with max amplifier" + "Every kill and every hit from a mob gives you a permanent effect" ], "de": [ - "Jedes Mob hat einen zufälligen Effekt auf höchster Stufe" + "Jeder Kill und jeder Treffer von einem Mob gibt dir einen Dauereffekt" ] }, "styled": { "en": { "name": [ { - "text": "Mobs Have Random Effects", - "color": "#AA00AA" + "text": "Kill = Effect", + "color": "#AA0000" } ], "description": [ [ { - "text": "Every Mob", - "color": "#AA00AA" + "text": "Every " }, { - "text": " has a random" + "text": "kill", + "color": "#AA0000" + }, + { + "text": " and every " + }, + { + "text": "hit", + "color": "#AA0000" + }, + { + "text": " from" } ], [ { - "text": "potion effect with " + "text": "a mob gives you a " }, { - "text": "max amplifier", - "color": "#AA00AA" + "text": "permanent effect", + "color": "#AA0000" } ] ], @@ -17661,8 +17937,8 @@ "text": " " }, { - "text": "Mobs Have Random Effects", - "color": "#AA00AA" + "text": "Kill = Effect", + "color": "#AA0000" } ], [ @@ -17672,22 +17948,34 @@ ], [ { - "text": "Every Mob", - "color": "#AA00AA" + "text": "Every ", + "color": "#AAAAAA" }, { - "text": " has a random", + "text": "kill", + "color": "#AA0000" + }, + { + "text": " and every ", + "color": "#AAAAAA" + }, + { + "text": "hit", + "color": "#AA0000" + }, + { + "text": " from", "color": "#AAAAAA" } ], [ { - "text": "potion effect with ", + "text": "a mob gives you a ", "color": "#AAAAAA" }, { - "text": "max amplifier", - "color": "#AA00AA" + "text": "permanent effect", + "color": "#AA0000" } ] ] @@ -17695,27 +17983,37 @@ "de": { "name": [ { - "text": "Mobs Haben Zufällige Effekte", - "color": "#AA00AA" + "text": "Kill = Effekt", + "color": "#AA0000" } ], "description": [ [ { - "text": "Jedes Mob", - "color": "#AA00AA" + "text": "Jeder " }, { - "text": " hat einen zufälligen" + "text": "Kill", + "color": "#AA0000" + }, + { + "text": " und jeder " + }, + { + "text": "Treffer", + "color": "#AA0000" + }, + { + "text": " von" } ], [ { - "text": "Effekt auf " + "text": "einem Mob gibt dir einen " }, { - "text": "höchster Stufe", - "color": "#AA00AA" + "text": "Dauereffekt", + "color": "#AA0000" } ] ], @@ -17729,7 +18027,176 @@ "text": " " }, { - "text": "Mobs Haben Zufällige Effekte", + "text": "Kill = Effekt", + "color": "#AA0000" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Jeder ", + "color": "#AAAAAA" + }, + { + "text": "Kill", + "color": "#AA0000" + }, + { + "text": " und jeder ", + "color": "#AAAAAA" + }, + { + "text": "Treffer", + "color": "#AA0000" + }, + { + "text": " von", + "color": "#AAAAAA" + } + ], + [ + { + "text": "einem Mob gibt dir einen ", + "color": "#AAAAAA" + }, + { + "text": "Dauereffekt", + "color": "#AA0000" + } + ] + ] + } + } + }, + { + "id": "entityrandomeffect", + "category": "effect", + "icon": { + "material": "PHANTOM_MEMBRANE" + }, + "name": { + "en": "Mobs Have Random Effects", + "de": "Mobs Haben Zufällige Effekte" + }, + "description": { + "en": [ + "Every Mob has a random potion effect with max amplifier" + ], + "de": [ + "Jedes Mob hat einen zufälligen Effekt auf höchster Stufe" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Mobs Have Random Effects", + "color": "#AA00AA" + } + ], + "description": [ + [ + { + "text": "Every Mob", + "color": "#AA00AA" + }, + { + "text": " has a random" + } + ], + [ + { + "text": "potion effect with " + }, + { + "text": "max amplifier", + "color": "#AA00AA" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Mobs Have Random Effects", + "color": "#AA00AA" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Every Mob", + "color": "#AA00AA" + }, + { + "text": " has a random", + "color": "#AAAAAA" + } + ], + [ + { + "text": "potion effect with ", + "color": "#AAAAAA" + }, + { + "text": "max amplifier", + "color": "#AA00AA" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "Mobs Haben Zufällige Effekte", + "color": "#AA00AA" + } + ], + "description": [ + [ + { + "text": "Jedes Mob", + "color": "#AA00AA" + }, + { + "text": " hat einen zufälligen" + } + ], + [ + { + "text": "Effekt auf " + }, + { + "text": "höchster Stufe", + "color": "#AA00AA" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Mobs Haben Zufällige Effekte", "color": "#AA00AA" } ], @@ -18162,6 +18629,10 @@ ] ] } + }, + "pairing": { + "trigger": "level_up", + "action": "modify_border" } }, { @@ -18573,6 +19044,10 @@ ] ] } + }, + "pairing": { + "trigger": "damage", + "action": "modify_border" } }, { @@ -18745,6 +19220,10 @@ ] ] } + }, + "pairing": { + "trigger": "new_chunk", + "action": "chunk_to_block" } }, { @@ -20862,7 +21341,10 @@ } }, { - "id": "preset-interval-border", + "id": "interval-border", + "fallbackIds": [ + "preset-interval-border" + ], "category": "world", "icon": { "material": "PURPLE_GLAZED_TERRACOTTA" @@ -25342,6 +25824,10 @@ ] ] } + }, + "pairing": { + "trigger": "move_block", + "action": "remove_random_item" } }, { @@ -25550,10 +26036,17 @@ ] ] } + }, + "pairing": { + "trigger": "damage", + "action": "clear_inventory" } }, { - "id": "preset-interval-clear-inventory", + "id": "interval-clear-inventory", + "fallbackIds": [ + "preset-interval-clear-inventory" + ], "category": "inventory", "icon": { "material": "TRAPPED_CHEST" @@ -25941,6 +26434,10 @@ ] ] } + }, + "pairing": { + "trigger": "pickup_item", + "action": "boost_in_air" } }, { @@ -26629,51 +27126,58 @@ ] ] } + }, + "pairing": { + "trigger": "move_up", + "action": "kill" } }, { - "id": "onlydirt", + "id": "onlyup", "category": "movement", "icon": { - "material": "DIRT" + "material": "LADDER" }, "name": { - "en": "Leave Dirt = Death", - "de": "Dirt verlassen = Tod" + "en": "Go Down = Death", + "de": "Nach unten = Tod" }, "description": { "en": [ - "You must stay on dirt otherwise you will die" + "You may never stand lower than the highest you have stood" ], "de": [ - "Wenn du nicht auf Erde stehst, stirbst du" + "Du darfst nie tiefer stehen als an deinem höchsten Punkt" ] }, "styled": { "en": { "name": [ { - "text": "Leave Dirt = Death", + "text": "Go Down = Death", "color": "#FF5555" } ], "description": [ [ { - "text": "You must stay on " + "text": "You may never " }, { - "text": "dirt", + "text": "stand lower", "color": "#FF5555" } ], [ { - "text": "otherwise you will " + "text": "than the " }, { - "text": "die", + "text": "highest", "color": "#FF5555" + }, + { + "text": " you have stood" } ] ], @@ -26687,7 +27191,7 @@ "text": " " }, { - "text": "Leave Dirt = Death", + "text": "Go Down = Death", "color": "#FF5555" } ], @@ -26698,22 +27202,26 @@ ], [ { - "text": "You must stay on ", + "text": "You may never ", "color": "#AAAAAA" }, { - "text": "dirt", + "text": "stand lower", "color": "#FF5555" } ], [ { - "text": "otherwise you will ", + "text": "than the ", "color": "#AAAAAA" }, { - "text": "die", + "text": "highest", "color": "#FF5555" + }, + { + "text": " you have stood", + "color": "#AAAAAA" } ] ] @@ -26721,30 +27229,27 @@ "de": { "name": [ { - "text": "Dirt verlassen = Tod", + "text": "Nach unten = Tod", "color": "#FF5555" } ], "description": [ [ { - "text": "Wenn du nicht auf " + "text": "Du darfst nie " }, { - "text": "Erde", + "text": "tiefer stehen", "color": "#FF5555" } ], [ { - "text": "stehst, " + "text": "als an deinem " }, { - "text": "stirbst", + "text": "höchsten Punkt", "color": "#FF5555" - }, - { - "text": " du" } ] ], @@ -26758,7 +27263,7 @@ "text": " " }, { - "text": "Dirt verlassen = Tod", + "text": "Nach unten = Tod", "color": "#FF5555" } ], @@ -26769,76 +27274,82 @@ ], [ { - "text": "Wenn du nicht auf ", + "text": "Du darfst nie ", "color": "#AAAAAA" }, { - "text": "Erde", + "text": "tiefer stehen", "color": "#FF5555" } ], [ { - "text": "stehst, ", + "text": "als an deinem ", "color": "#AAAAAA" }, { - "text": "stirbst", + "text": "höchsten Punkt", "color": "#FF5555" - }, - { - "text": " du", - "color": "#AAAAAA" } ] ] } + }, + "pairing": { + "trigger": "move_down", + "action": "kill" } }, { - "id": "higherjumps", + "id": "levelteleport", "category": "movement", "icon": { - "material": "RABBIT_FOOT" + "material": "ENDER_PEARL" }, "name": { - "en": "Higher Jumps", - "de": "Höhere Sprünge" + "en": "Level = Teleport", + "de": "Level = Teleport" }, "description": { "en": [ - "The more you jump, the higher you jump" + "You can't walk, but every level gives you an ender pearl" ], "de": [ - "Umso öfter du springst, desto höher springst du" + "Du kannst nicht laufen, aber jedes Level gibt dir eine Enderperle" ] }, "styled": { "en": { "name": [ { - "text": "Higher Jumps", - "color": "#55FF55" + "text": "Level = Teleport", + "color": "#AA00AA" } ], "description": [ [ { - "text": "The more " + "text": "You " }, { - "text": "you jump", - "color": "#55FF55" + "text": "can't walk", + "color": "#AA00AA" }, { - "text": ", the " + "text": ", but every" + } + ], + [ + { + "text": "level", + "color": "#AA00AA" }, { - "text": "higher", - "color": "#55FF55" + "text": " gives you an " }, { - "text": " you jump" + "text": "ender pearl", + "color": "#AA00AA" } ] ], @@ -26852,8 +27363,8 @@ "text": " " }, { - "text": "Higher Jumps", - "color": "#55FF55" + "text": "Level = Teleport", + "color": "#AA00AA" } ], [ @@ -26863,24 +27374,30 @@ ], [ { - "text": "The more ", + "text": "You ", "color": "#AAAAAA" }, { - "text": "you jump", - "color": "#55FF55" + "text": "can't walk", + "color": "#AA00AA" }, { - "text": ", the ", + "text": ", but every", "color": "#AAAAAA" - }, + } + ], + [ { - "text": "higher", - "color": "#55FF55" + "text": "level", + "color": "#AA00AA" }, { - "text": " you jump", + "text": " gives you an ", "color": "#AAAAAA" + }, + { + "text": "ender pearl", + "color": "#AA00AA" } ] ] @@ -26888,27 +27405,34 @@ "de": { "name": [ { - "text": "Höhere Sprünge", - "color": "#55FF55" + "text": "Level = Teleport", + "color": "#AA00AA" } ], "description": [ [ { - "text": "Umso öfter", - "color": "#55FF55" + "text": "Du " }, { - "text": " du springst," + "text": "kannst nicht laufen", + "color": "#AA00AA" + }, + { + "text": ", aber jedes" } ], [ { - "text": "desto höher", - "color": "#55FF55" + "text": "Level", + "color": "#AA00AA" }, { - "text": " springst du" + "text": " gibt dir eine " + }, + { + "text": "Enderperle", + "color": "#AA00AA" } ] ], @@ -26922,8 +27446,8 @@ "text": " " }, { - "text": "Höhere Sprünge", - "color": "#55FF55" + "text": "Level = Teleport", + "color": "#AA00AA" } ], [ @@ -26933,22 +27457,30 @@ ], [ { - "text": "Umso öfter", - "color": "#55FF55" + "text": "Du ", + "color": "#AAAAAA" }, { - "text": " du springst,", + "text": "kannst nicht laufen", + "color": "#AA00AA" + }, + { + "text": ", aber jedes", "color": "#AAAAAA" } ], [ { - "text": "desto höher", - "color": "#55FF55" + "text": "Level", + "color": "#AA00AA" }, { - "text": " springst du", + "text": " gibt dir eine ", "color": "#AAAAAA" + }, + { + "text": "Enderperle", + "color": "#AA00AA" } ] ] @@ -26956,54 +27488,51 @@ } }, { - "id": "hungerperblock", + "id": "onlyminecart", "category": "movement", "icon": { - "material": "ROTTEN_FLESH" + "material": "MINECART" }, "name": { - "en": "Walk = Hunger", - "de": "Laufen = Hunger" + "en": "Only Minecart", + "de": "Nur mit Minecart" }, "description": { "en": [ - "You lose food for every block you walk" + "You sit in a minecart the whole time and can't get out" ], "de": [ - "Du bekommst Hunger durch jeden Block, den du gehst" + "Du sitzt die ganze Zeit in einer Lore und kommst nicht raus" ] }, "styled": { "en": { "name": [ { - "text": "Walk = Hunger", - "color": "#FFAA00" + "text": "Only Minecart", + "color": "#AAAAAA" } ], "description": [ [ { - "text": "You lose " + "text": "You sit in a " }, { - "text": "food", - "color": "#FFAA00" + "text": "minecart", + "color": "#AAAAAA" }, { - "text": " for" + "text": " the" } ], [ { - "text": "every " - }, - { - "text": "block", - "color": "#FFAA00" + "text": "whole time and " }, { - "text": " you walk" + "text": "can't get out", + "color": "#AAAAAA" } ] ], @@ -27017,8 +27546,8 @@ "text": " " }, { - "text": "Walk = Hunger", - "color": "#FFAA00" + "text": "Only Minecart", + "color": "#AAAAAA" } ], [ @@ -27028,29 +27557,13 @@ ], [ { - "text": "You lose ", - "color": "#AAAAAA" - }, - { - "text": "food", - "color": "#FFAA00" - }, - { - "text": " for", + "text": "You sit in a minecart the", "color": "#AAAAAA" } ], [ { - "text": "every ", - "color": "#AAAAAA" - }, - { - "text": "block", - "color": "#FFAA00" - }, - { - "text": " you walk", + "text": "whole time and can't get out", "color": "#AAAAAA" } ] @@ -27059,33 +27572,27 @@ "de": { "name": [ { - "text": "Laufen = Hunger", - "color": "#FFAA00" + "text": "Nur mit Minecart", + "color": "#AAAAAA" } ], "description": [ [ { - "text": "Du bekommst " - }, - { - "text": "Hunger", - "color": "#FFAA00" - }, - { - "text": " durch" + "text": "Du sitzt die ganze Zeit in einer" } ], [ { - "text": "jeden " + "text": "Lore", + "color": "#AAAAAA" }, { - "text": "Block", - "color": "#FFAA00" + "text": " und " }, { - "text": ", den du gehst" + "text": "kommst nicht raus", + "color": "#AAAAAA" } ] ], @@ -27099,8 +27606,8 @@ "text": " " }, { - "text": "Laufen = Hunger", - "color": "#FFAA00" + "text": "Nur mit Minecart", + "color": "#AAAAAA" } ], [ @@ -27110,29 +27617,13 @@ ], [ { - "text": "Du bekommst ", - "color": "#AAAAAA" - }, - { - "text": "Hunger", - "color": "#FFAA00" - }, - { - "text": " durch", + "text": "Du sitzt die ganze Zeit in einer", "color": "#AAAAAA" } ], [ { - "text": "jeden ", - "color": "#AAAAAA" - }, - { - "text": "Block", - "color": "#FFAA00" - }, - { - "text": ", den du gehst", + "text": "Lore und kommst nicht raus", "color": "#AAAAAA" } ] @@ -27141,74 +27632,48 @@ } }, { - "id": "fivehundredblocks", + "id": "onlydirt", "category": "movement", "icon": { - "material": "OAK_SIGN" + "material": "DIRT" }, "name": { - "en": "500 Blocks = Random Stack", - "de": "500 Blöcke = Zufälliger Stack" + "en": "Leave Dirt = Death", + "de": "Dirt verlassen = Tod" }, "description": { "en": [ - "Every 500 Blocks walked players will get a 64 stack of a random item. Blocks and Entities won't drop any items." + "You must stay on dirt otherwise you will die" ], "de": [ - "Alle 500 Blöcke, die du läufst, bekommst du 64 eines zufälliges Items. Es droppen keine Items von Blöcken und Entities mehr." + "Wenn du nicht auf Erde stehst, stirbst du" ] }, "styled": { "en": { "name": [ { - "text": "500 Blocks = Random Stack", - "color": "#AA00AA" + "text": "Leave Dirt = Death", + "color": "#FF5555" } ], "description": [ [ { - "text": "Every 500 Blocks walked", - "color": "#AA00AA" - }, - { - "text": " players" - } - ], - [ - { - "text": "will get a " - }, - { - "text": "64 stack", - "color": "#AA00AA" + "text": "You must stay on " }, { - "text": " of a random item." + "text": "dirt", + "color": "#FF5555" } ], [ { - "text": "Blocks", - "color": "#AA00AA" - }, - { - "text": " and " - }, - { - "text": "Entities", - "color": "#AA00AA" - }, - { - "text": " won't " - }, - { - "text": "drop", - "color": "#AA00AA" + "text": "otherwise you will " }, { - "text": " any items." + "text": "die", + "color": "#FF5555" } ] ], @@ -27222,8 +27687,8 @@ "text": " " }, { - "text": "500 Blocks = Random Stack", - "color": "#AA00AA" + "text": "Leave Dirt = Death", + "color": "#FF5555" } ], [ @@ -27233,52 +27698,22 @@ ], [ { - "text": "Every 500 Blocks walked", - "color": "#AA00AA" - }, - { - "text": " players", - "color": "#AAAAAA" - } - ], - [ - { - "text": "will get a ", + "text": "You must stay on ", "color": "#AAAAAA" }, { - "text": "64 stack", - "color": "#AA00AA" - }, - { - "text": " of a random item.", - "color": "#AAAAAA" + "text": "dirt", + "color": "#FF5555" } ], [ { - "text": "Blocks", - "color": "#AA00AA" - }, - { - "text": " and ", - "color": "#AAAAAA" - }, - { - "text": "Entities", - "color": "#AA00AA" - }, - { - "text": " won't ", + "text": "otherwise you will ", "color": "#AAAAAA" }, { - "text": "drop", - "color": "#AA00AA" - }, - { - "text": " any items.", - "color": "#AAAAAA" + "text": "die", + "color": "#FF5555" } ] ] @@ -27286,72 +27721,875 @@ "de": { "name": [ { - "text": "500 Blöcke = Zufälliger Stack", - "color": "#AA00AA" + "text": "Dirt verlassen = Tod", + "color": "#FF5555" } ], "description": [ [ { - "text": "Alle", - "color": "#AA00AA" + "text": "Wenn du nicht auf " }, { - "text": " 500 Blöcke, die du " + "text": "Erde", + "color": "#FF5555" + } + ], + [ + { + "text": "stehst, " }, { - "text": "läufst", - "color": "#AA00AA" + "text": "stirbst", + "color": "#FF5555" }, { - "text": "," + "text": " du" } - ], + ] + ], + "tooltip": [ [ { - "text": "bekommst du " + "text": "»", + "color": "#555555" }, { - "text": "64", - "color": "#AA00AA" + "text": " " }, { - "text": " eines " + "text": "Dirt verlassen = Tod", + "color": "#FF5555" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Wenn du nicht auf ", + "color": "#AAAAAA" + }, + { + "text": "Erde", + "color": "#FF5555" + } + ], + [ + { + "text": "stehst, ", + "color": "#AAAAAA" + }, + { + "text": "stirbst", + "color": "#FF5555" + }, + { + "text": " du", + "color": "#AAAAAA" + } + ] + ] + } + } + }, + { + "id": "higherjumps", + "category": "movement", + "icon": { + "material": "RABBIT_FOOT" + }, + "name": { + "en": "Higher Jumps", + "de": "Höhere Sprünge" + }, + "description": { + "en": [ + "The more you jump, the higher you jump" + ], + "de": [ + "Umso öfter du springst, desto höher springst du" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Higher Jumps", + "color": "#55FF55" + } + ], + "description": [ + [ + { + "text": "The more " + }, + { + "text": "you jump", + "color": "#55FF55" + }, + { + "text": ", the " + }, + { + "text": "higher", + "color": "#55FF55" + }, + { + "text": " you jump" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Higher Jumps", + "color": "#55FF55" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "The more ", + "color": "#AAAAAA" + }, + { + "text": "you jump", + "color": "#55FF55" + }, + { + "text": ", the ", + "color": "#AAAAAA" + }, + { + "text": "higher", + "color": "#55FF55" + }, + { + "text": " you jump", + "color": "#AAAAAA" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "Höhere Sprünge", + "color": "#55FF55" + } + ], + "description": [ + [ + { + "text": "Umso öfter", + "color": "#55FF55" + }, + { + "text": " du springst," + } + ], + [ + { + "text": "desto höher", + "color": "#55FF55" + }, + { + "text": " springst du" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Höhere Sprünge", + "color": "#55FF55" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Umso öfter", + "color": "#55FF55" + }, + { + "text": " du springst,", + "color": "#AAAAAA" + } + ], + [ + { + "text": "desto höher", + "color": "#55FF55" + }, + { + "text": " springst du", + "color": "#AAAAAA" + } + ] + ] + } + } + }, + { + "id": "hungerperblock", + "category": "movement", + "icon": { + "material": "ROTTEN_FLESH" + }, + "name": { + "en": "Walk = Hunger", + "de": "Laufen = Hunger" + }, + "description": { + "en": [ + "You lose food for every block you walk" + ], + "de": [ + "Du bekommst Hunger durch jeden Block, den du gehst" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Walk = Hunger", + "color": "#FFAA00" + } + ], + "description": [ + [ + { + "text": "You lose " + }, + { + "text": "food", + "color": "#FFAA00" + }, + { + "text": " for" + } + ], + [ + { + "text": "every " + }, + { + "text": "block", + "color": "#FFAA00" + }, + { + "text": " you walk" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Walk = Hunger", + "color": "#FFAA00" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "You lose ", + "color": "#AAAAAA" + }, + { + "text": "food", + "color": "#FFAA00" + }, + { + "text": " for", + "color": "#AAAAAA" + } + ], + [ + { + "text": "every ", + "color": "#AAAAAA" + }, + { + "text": "block", + "color": "#FFAA00" + }, + { + "text": " you walk", + "color": "#AAAAAA" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "Laufen = Hunger", + "color": "#FFAA00" + } + ], + "description": [ + [ + { + "text": "Du bekommst " + }, + { + "text": "Hunger", + "color": "#FFAA00" + }, + { + "text": " durch" + } + ], + [ + { + "text": "jeden " + }, + { + "text": "Block", + "color": "#FFAA00" + }, + { + "text": ", den du gehst" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Laufen = Hunger", + "color": "#FFAA00" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Du bekommst ", + "color": "#AAAAAA" + }, + { + "text": "Hunger", + "color": "#FFAA00" + }, + { + "text": " durch", + "color": "#AAAAAA" + } + ], + [ + { + "text": "jeden ", + "color": "#AAAAAA" + }, + { + "text": "Block", + "color": "#FFAA00" + }, + { + "text": ", den du gehst", + "color": "#AAAAAA" + } + ] + ] + } + }, + "pairing": { + "trigger": "move_block", + "action": "hunger" + } + }, + { + "id": "fivehundredblocks", + "category": "movement", + "icon": { + "material": "OAK_SIGN" + }, + "name": { + "en": "500 Blocks = Random Stack", + "de": "500 Blöcke = Zufälliger Stack" + }, + "description": { + "en": [ + "Every 500 Blocks walked players will get a 64 stack of a random item. Blocks and Entities won't drop any items." + ], + "de": [ + "Alle 500 Blöcke, die du läufst, bekommst du 64 eines zufälliges Items. Es droppen keine Items von Blöcken und Entities mehr." + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "500 Blocks = Random Stack", + "color": "#AA00AA" + } + ], + "description": [ + [ + { + "text": "Every 500 Blocks walked", + "color": "#AA00AA" + }, + { + "text": " players" + } + ], + [ + { + "text": "will get a " + }, + { + "text": "64 stack", + "color": "#AA00AA" + }, + { + "text": " of a random item." + } + ], + [ + { + "text": "Blocks", + "color": "#AA00AA" + }, + { + "text": " and " + }, + { + "text": "Entities", + "color": "#AA00AA" + }, + { + "text": " won't " + }, + { + "text": "drop", + "color": "#AA00AA" + }, + { + "text": " any items." + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "500 Blocks = Random Stack", + "color": "#AA00AA" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Every 500 Blocks walked", + "color": "#AA00AA" + }, + { + "text": " players", + "color": "#AAAAAA" + } + ], + [ + { + "text": "will get a ", + "color": "#AAAAAA" + }, + { + "text": "64 stack", + "color": "#AA00AA" + }, + { + "text": " of a random item.", + "color": "#AAAAAA" + } + ], + [ + { + "text": "Blocks", + "color": "#AA00AA" + }, + { + "text": " and ", + "color": "#AAAAAA" + }, + { + "text": "Entities", + "color": "#AA00AA" + }, + { + "text": " won't ", + "color": "#AAAAAA" + }, + { + "text": "drop", + "color": "#AA00AA" + }, + { + "text": " any items.", + "color": "#AAAAAA" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "500 Blöcke = Zufälliger Stack", + "color": "#AA00AA" + } + ], + "description": [ + [ + { + "text": "Alle", + "color": "#AA00AA" + }, + { + "text": " 500 Blöcke, die du " + }, + { + "text": "läufst", + "color": "#AA00AA" + }, + { + "text": "," + } + ], + [ + { + "text": "bekommst du " + }, + { + "text": "64", + "color": "#AA00AA" + }, + { + "text": " eines " + }, + { + "text": "zufälliges Items", + "color": "#AA00AA" + }, + { + "text": "." + } + ], + [ + { + "text": "Es droppen " + }, + { + "text": "keine Items", + "color": "#AA00AA" + }, + { + "text": " von" + } + ], + [ + { + "text": "Blöcken", + "color": "#AA00AA" + }, + { + "text": " und " + }, + { + "text": "Entities", + "color": "#AA00AA" + }, + { + "text": " mehr." + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "500 Blöcke = Zufälliger Stack", + "color": "#AA00AA" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Alle", + "color": "#AA00AA" + }, + { + "text": " 500 Blöcke, die du ", + "color": "#AAAAAA" + }, + { + "text": "läufst", + "color": "#AA00AA" + }, + { + "text": ",", + "color": "#AAAAAA" + } + ], + [ + { + "text": "bekommst du ", + "color": "#AAAAAA" + }, + { + "text": "64", + "color": "#AA00AA" + }, + { + "text": " eines ", + "color": "#AAAAAA" + }, + { + "text": "zufälliges Items", + "color": "#AA00AA" + }, + { + "text": ".", + "color": "#AAAAAA" + } + ], + [ + { + "text": "Es droppen ", + "color": "#AAAAAA" + }, + { + "text": "keine Items", + "color": "#AA00AA" + }, + { + "text": " von", + "color": "#AAAAAA" + } + ], + [ + { + "text": "Blöcken", + "color": "#AA00AA" + }, + { + "text": " und ", + "color": "#AAAAAA" + }, + { + "text": "Entities", + "color": "#AA00AA" + }, + { + "text": " mehr.", + "color": "#AAAAAA" + } + ] + ] + } + } + }, + { + "id": "movemousedamage", + "category": "movement", + "icon": { + "material": "COMPASS" + }, + "name": { + "en": "Look Around = Damage", + "de": "Umsehen = Schaden" + }, + "description": { + "en": [ + "You take damage everytime you move your view" + ], + "de": [ + "Wenn du deinen Blick bewegst, erleidest du den gesetzen Schaden" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Look Around = Damage", + "color": "#FF5555" + } + ], + "description": [ + [ + { + "text": "You take " + }, + { + "text": "damage", + "color": "#FF5555" + }, + { + "text": " everytime" + } + ], + [ + { + "text": "you " + }, + { + "text": "move", + "color": "#FF5555" + }, + { + "text": " your " + }, + { + "text": "view", + "color": "#FF5555" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" }, { - "text": "zufälliges Items", - "color": "#AA00AA" + "text": " " }, { - "text": "." + "text": "Look Around = Damage", + "color": "#FF5555" } ], [ { - "text": "Es droppen " + "text": " " + } + ], + [ + { + "text": "You take ", + "color": "#AAAAAA" }, { - "text": "keine Items", - "color": "#AA00AA" + "text": "damage", + "color": "#FF5555" }, { - "text": " von" + "text": " everytime", + "color": "#AAAAAA" } ], [ { - "text": "Blöcken", - "color": "#AA00AA" + "text": "you ", + "color": "#AAAAAA" }, { - "text": " und " + "text": "move", + "color": "#FF5555" }, { - "text": "Entities", - "color": "#AA00AA" + "text": " your ", + "color": "#AAAAAA" }, { - "text": " mehr." + "text": "view", + "color": "#FF5555" + } + ] + ] + }, + "de": { + "name": [ + { + "text": "Umsehen = Schaden", + "color": "#FF5555" + } + ], + "description": [ + [ + { + "text": "Wenn du deinen " + }, + { + "text": "Blick bewegst", + "color": "#FF5555" + }, + { + "text": "," + } + ], + [ + { + "text": "erleidest du den " + }, + { + "text": "gesetzen Schaden", + "color": "#FF5555" } ] ], @@ -27365,8 +28603,8 @@ "text": " " }, { - "text": "500 Blöcke = Zufälliger Stack", - "color": "#AA00AA" + "text": "Umsehen = Schaden", + "color": "#FF5555" } ], [ @@ -27376,16 +28614,12 @@ ], [ { - "text": "Alle", - "color": "#AA00AA" - }, - { - "text": " 500 Blöcke, die du ", + "text": "Wenn du deinen ", "color": "#AAAAAA" }, { - "text": "läufst", - "color": "#AA00AA" + "text": "Blick bewegst", + "color": "#FF5555" }, { "text": ",", @@ -27394,56 +28628,202 @@ ], [ { - "text": "bekommst du ", + "text": "erleidest du den ", "color": "#AAAAAA" }, { - "text": "64", - "color": "#AA00AA" + "text": "gesetzen Schaden", + "color": "#FF5555" + } + ] + ] + } + }, + "pairing": { + "trigger": "move_camera", + "action": "damage" + } + }, + { + "id": "maxbiometime", + "category": "limited_time", + "icon": { + "material": "SPRUCE_SAPLING" + }, + "name": { + "en": "Max Biome Time", + "de": "Maximale Biom Zeit" + }, + "description": { + "en": [ + "The time that you may spend in every biome is limited" + ], + "de": [ + "Die Zeit, die du in jedem Biom sein darfst, ist begrenzt" + ] + }, + "styled": { + "en": { + "name": [ + { + "text": "Max Biome Time", + "color": "#00AA00" + } + ], + "description": [ + [ + { + "text": "The " }, { - "text": " eines ", + "text": "time", + "color": "#00AA00" + }, + { + "text": " that you may spend" + } + ], + [ + { + "text": "in every " + }, + { + "text": "biome", + "color": "#00AA00" + }, + { + "text": " is limited" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Max Biome Time", + "color": "#00AA00" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "The ", "color": "#AAAAAA" }, { - "text": "zufälliges Items", - "color": "#AA00AA" + "text": "time", + "color": "#00AA00" }, { - "text": ".", + "text": " that you may spend", "color": "#AAAAAA" } ], [ { - "text": "Es droppen ", + "text": "in every ", "color": "#AAAAAA" }, { - "text": "keine Items", - "color": "#AA00AA" + "text": "biome", + "color": "#00AA00" }, { - "text": " von", + "text": " is limited", "color": "#AAAAAA" } + ] + ] + }, + "de": { + "name": [ + { + "text": "Maximale Biom Zeit", + "color": "#00AA00" + } + ], + "description": [ + [ + { + "text": "Die " + }, + { + "text": "Zeit", + "color": "#00AA00" + }, + { + "text": ", die du in jedem " + }, + { + "text": "Biom", + "color": "#00AA00" + } ], [ { - "text": "Blöcken", - "color": "#AA00AA" + "text": "sein darfst, ist " }, { - "text": " und ", + "text": "begrenzt", + "color": "#00AA00" + } + ] + ], + "tooltip": [ + [ + { + "text": "»", + "color": "#555555" + }, + { + "text": " " + }, + { + "text": "Maximale Biom Zeit", + "color": "#00AA00" + } + ], + [ + { + "text": " " + } + ], + [ + { + "text": "Die ", "color": "#AAAAAA" }, { - "text": "Entities", - "color": "#AA00AA" + "text": "Zeit", + "color": "#00AA00" }, { - "text": " mehr.", + "text": ", die du in jedem ", + "color": "#AAAAAA" + }, + { + "text": "Biom", + "color": "#00AA00" + } + ], + [ + { + "text": "sein darfst, ist ", "color": "#AAAAAA" + }, + { + "text": "begrenzt", + "color": "#00AA00" } ] ] @@ -27451,58 +28831,54 @@ } }, { - "id": "movemousedamage", - "category": "movement", + "id": "maxheighttime", + "category": "limited_time", "icon": { - "material": "COMPASS" + "material": "PARROT_SPAWN_EGG" }, "name": { - "en": "Look Around = Damage", - "de": "Umsehen = Schaden" + "en": "Max Height Time", + "de": "Maximale Höhen Zeit" }, "description": { "en": [ - "You take damage everytime you move your view" + "The time that you may spend on every height is limited" ], "de": [ - "Wenn du deinen Blick bewegst, erleidest du den gesetzen Schaden" + "Die Zeit, die du auf jeder Höhe sein darfst, ist begrenzt" ] }, "styled": { "en": { "name": [ { - "text": "Look Around = Damage", - "color": "#FF5555" + "text": "Max Height Time", + "color": "#5555FF" } ], "description": [ [ { - "text": "You take " + "text": "The " }, { - "text": "damage", - "color": "#FF5555" + "text": "time", + "color": "#5555FF" }, { - "text": " everytime" + "text": " that you may spend" } ], [ { - "text": "you " - }, - { - "text": "move", - "color": "#FF5555" + "text": "on every " }, { - "text": " your " + "text": "height", + "color": "#5555FF" }, { - "text": "view", - "color": "#FF5555" + "text": " is limited" } ] ], @@ -27516,8 +28892,8 @@ "text": " " }, { - "text": "Look Around = Damage", - "color": "#FF5555" + "text": "Max Height Time", + "color": "#5555FF" } ], [ @@ -27527,34 +28903,30 @@ ], [ { - "text": "You take ", + "text": "The ", "color": "#AAAAAA" }, { - "text": "damage", - "color": "#FF5555" + "text": "time", + "color": "#5555FF" }, { - "text": " everytime", + "text": " that you may spend", "color": "#AAAAAA" } ], [ { - "text": "you ", + "text": "on every ", "color": "#AAAAAA" }, { - "text": "move", - "color": "#FF5555" + "text": "height", + "color": "#5555FF" }, { - "text": " your ", + "text": " is limited", "color": "#AAAAAA" - }, - { - "text": "view", - "color": "#FF5555" } ] ] @@ -27562,30 +28934,34 @@ "de": { "name": [ { - "text": "Umsehen = Schaden", - "color": "#FF5555" + "text": "Maximale Höhen Zeit", + "color": "#5555FF" } ], "description": [ [ { - "text": "Wenn du deinen " + "text": "Die " }, { - "text": "Blick bewegst", - "color": "#FF5555" + "text": "Zeit", + "color": "#5555FF" }, { - "text": "," + "text": ", die du auf jeder " + }, + { + "text": "Höhe", + "color": "#5555FF" } ], [ { - "text": "erleidest du den " + "text": "sein darfst, ist " }, { - "text": "gesetzen Schaden", - "color": "#FF5555" + "text": "begrenzt", + "color": "#5555FF" } ] ], @@ -27599,8 +28975,8 @@ "text": " " }, { - "text": "Umsehen = Schaden", - "color": "#FF5555" + "text": "Maximale Höhen Zeit", + "color": "#5555FF" } ], [ @@ -27610,26 +28986,30 @@ ], [ { - "text": "Wenn du deinen ", + "text": "Die ", "color": "#AAAAAA" }, { - "text": "Blick bewegst", - "color": "#FF5555" + "text": "Zeit", + "color": "#5555FF" }, { - "text": ",", + "text": ", die du auf jeder ", "color": "#AAAAAA" + }, + { + "text": "Höhe", + "color": "#5555FF" } ], [ { - "text": "erleidest du den ", + "text": "sein darfst, ist ", "color": "#AAAAAA" }, { - "text": "gesetzen Schaden", - "color": "#FF5555" + "text": "begrenzt", + "color": "#5555FF" } ] ] @@ -27637,54 +29017,44 @@ } }, { - "id": "maxbiometime", - "category": "limited_time", + "id": "watermlg", + "category": "extra_world", "icon": { - "material": "SPRUCE_SAPLING" + "material": "WATER_BUCKET" }, "name": { - "en": "Max Biome Time", - "de": "Maximale Biom Zeit" + "en": "Interval = Water MLG", + "de": "Intervall = Water MLG" }, "description": { "en": [ - "The time that you may spend in every biome is limited" + "You have to do a Water MLG over and over again" ], "de": [ - "Die Zeit, die du in jedem Biom sein darfst, ist begrenzt" + "Du musst immer wieder einen Water MLG absolvieren" ] }, "styled": { "en": { "name": [ { - "text": "Max Biome Time", - "color": "#00AA00" + "text": "Interval = Water MLG", + "color": "#55FFFF" } ], "description": [ [ { - "text": "The " - }, - { - "text": "time", - "color": "#00AA00" + "text": "You have to do a " }, { - "text": " that you may spend" + "text": "Water MLG", + "color": "#55FFFF" } ], [ { - "text": "in every " - }, - { - "text": "biome", - "color": "#00AA00" - }, - { - "text": " is limited" + "text": "over and over again" } ] ], @@ -27698,8 +29068,8 @@ "text": " " }, { - "text": "Max Biome Time", - "color": "#00AA00" + "text": "Interval = Water MLG", + "color": "#55FFFF" } ], [ @@ -27709,29 +29079,17 @@ ], [ { - "text": "The ", + "text": "You have to do a ", "color": "#AAAAAA" }, { - "text": "time", - "color": "#00AA00" - }, - { - "text": " that you may spend", - "color": "#AAAAAA" + "text": "Water MLG", + "color": "#55FFFF" } ], [ { - "text": "in every ", - "color": "#AAAAAA" - }, - { - "text": "biome", - "color": "#00AA00" - }, - { - "text": " is limited", + "text": "over and over again", "color": "#AAAAAA" } ] @@ -27740,34 +29098,30 @@ "de": { "name": [ { - "text": "Maximale Biom Zeit", - "color": "#00AA00" + "text": "Intervall = Water MLG", + "color": "#55FFFF" } ], "description": [ [ { - "text": "Die " - }, - { - "text": "Zeit", - "color": "#00AA00" - }, - { - "text": ", die du in jedem " + "text": "Du musst " }, { - "text": "Biom", - "color": "#00AA00" + "text": "immer wieder", + "color": "#55FFFF" } ], [ { - "text": "sein darfst, ist " + "text": "einen " }, { - "text": "begrenzt", - "color": "#00AA00" + "text": "Water MLG", + "color": "#55FFFF" + }, + { + "text": " absolvieren" } ] ], @@ -27781,8 +29135,8 @@ "text": " " }, { - "text": "Maximale Biom Zeit", - "color": "#00AA00" + "text": "Intervall = Water MLG", + "color": "#55FFFF" } ], [ @@ -27792,85 +29146,89 @@ ], [ { - "text": "Die ", - "color": "#AAAAAA" - }, - { - "text": "Zeit", - "color": "#00AA00" - }, - { - "text": ", die du in jedem ", + "text": "Du musst ", "color": "#AAAAAA" }, { - "text": "Biom", - "color": "#00AA00" + "text": "immer wieder", + "color": "#55FFFF" } ], [ { - "text": "sein darfst, ist ", + "text": "einen ", "color": "#AAAAAA" }, { - "text": "begrenzt", - "color": "#00AA00" + "text": "Water MLG", + "color": "#55FFFF" + }, + { + "text": " absolvieren", + "color": "#AAAAAA" } ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "water_mlg" } }, { - "id": "maxheighttime", - "category": "limited_time", + "id": "jumpandrun", + "category": "extra_world", "icon": { - "material": "PARROT_SPAWN_EGG" + "material": "ACACIA_STAIRS" }, "name": { - "en": "Max Height Time", - "de": "Maximale Höhen Zeit" + "en": "Interval = Jump and Run", + "de": "Intervall = Jump and Run" }, "description": { "en": [ - "The time that you may spend on every height is limited" + "Every few minutes you have to do a random jump and run which gets harder every time" ], "de": [ - "Die Zeit, die du auf jeder Höhe sein darfst, ist begrenzt" + "In einem gesetzten Intervall muss ein zufälliger Spieler ein Jump and Run absolvieren Schafft er es nicht, stirbt er" ] }, "styled": { "en": { "name": [ { - "text": "Max Height Time", - "color": "#5555FF" + "text": "Interval = Jump and Run", + "color": "#FFAA00" } ], "description": [ [ { - "text": "The " + "text": "Every " }, { - "text": "time", - "color": "#5555FF" + "text": "few minutes", + "color": "#FFAA00" }, { - "text": " that you may spend" + "text": " you have to do a random" } ], [ { - "text": "on every " + "text": "jump and run", + "color": "#FFAA00" + }, + { + "text": " which gets " }, { - "text": "height", - "color": "#5555FF" + "text": "harder", + "color": "#FFAA00" }, { - "text": " is limited" + "text": " every time" } ] ], @@ -27884,8 +29242,8 @@ "text": " " }, { - "text": "Max Height Time", - "color": "#5555FF" + "text": "Interval = Jump and Run", + "color": "#FFAA00" } ], [ @@ -27895,29 +29253,33 @@ ], [ { - "text": "The ", + "text": "Every ", "color": "#AAAAAA" }, { - "text": "time", - "color": "#5555FF" + "text": "few minutes", + "color": "#FFAA00" }, { - "text": " that you may spend", + "text": " you have to do a random", "color": "#AAAAAA" } ], [ { - "text": "on every ", + "text": "jump and run", + "color": "#FFAA00" + }, + { + "text": " which gets ", "color": "#AAAAAA" }, { - "text": "height", - "color": "#5555FF" + "text": "harder", + "color": "#FFAA00" }, { - "text": " is limited", + "text": " every time", "color": "#AAAAAA" } ] @@ -27926,34 +29288,56 @@ "de": { "name": [ { - "text": "Maximale Höhen Zeit", - "color": "#5555FF" + "text": "Intervall = Jump and Run", + "color": "#FFAA00" } ], "description": [ [ { - "text": "Die " + "text": "In einem gesetzten " }, { - "text": "Zeit", - "color": "#5555FF" + "text": "Intervall", + "color": "#FFAA00" }, { - "text": ", die du auf jeder " + "text": " muss ein" + } + ], + [ + { + "text": "zufälliger Spieler", + "color": "#FFAA00" }, { - "text": "Höhe", - "color": "#5555FF" + "text": " ein " + }, + { + "text": "Jump and Run", + "color": "#FFAA00" + }, + { + "text": " absolvieren" } ], [ { - "text": "sein darfst, ist " + "text": "Schafft er es " }, { - "text": "begrenzt", - "color": "#5555FF" + "text": "nicht", + "color": "#FFAA00" + }, + { + "text": ", " + }, + { + "text": "stirbt", + "color": "#FFAA00" + }, + { + "text": " er" } ] ], @@ -27967,8 +29351,8 @@ "text": " " }, { - "text": "Maximale Höhen Zeit", - "color": "#5555FF" + "text": "Intervall = Jump and Run", + "color": "#FFAA00" } ], [ @@ -27978,75 +29362,103 @@ ], [ { - "text": "Die ", + "text": "In einem gesetzten ", "color": "#AAAAAA" }, { - "text": "Zeit", - "color": "#5555FF" + "text": "Intervall", + "color": "#FFAA00" }, { - "text": ", die du auf jeder ", + "text": " muss ein", "color": "#AAAAAA" + } + ], + [ + { + "text": "zufälliger Spieler", + "color": "#FFAA00" }, { - "text": "Höhe", - "color": "#5555FF" + "text": " ein ", + "color": "#AAAAAA" + }, + { + "text": "Jump and Run", + "color": "#FFAA00" + }, + { + "text": " absolvieren", + "color": "#AAAAAA" } ], [ { - "text": "sein darfst, ist ", + "text": "Schafft er es ", "color": "#AAAAAA" }, { - "text": "begrenzt", - "color": "#5555FF" + "text": "nicht", + "color": "#FFAA00" + }, + { + "text": ", ", + "color": "#AAAAAA" + }, + { + "text": "stirbt", + "color": "#FFAA00" + }, + { + "text": " er", + "color": "#AAAAAA" } ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "jnr" } }, { - "id": "watermlg", - "category": "extra_world", + "id": "no-eating", + "fallbackIds": [ + "preset-no-eating" + ], + "category": "misc_challenge", "icon": { - "material": "WATER_BUCKET" + "material": "COOKED_BEEF" }, "name": { - "en": "Interval = Water MLG", - "de": "Intervall = Water MLG" + "en": "No Eating", + "de": "Kein Essen" }, "description": { "en": [ - "You have to do a Water MLG over and over again" + "You cannot eat anything" ], "de": [ - "Du musst immer wieder einen Water MLG absolvieren" + "Du kannst nichts essen" ] }, "styled": { "en": { "name": [ { - "text": "Interval = Water MLG", - "color": "#55FFFF" + "text": "No Eating", + "color": "#FF5555" } ], "description": [ [ { - "text": "You have to do a " + "text": "You cannot " }, { - "text": "Water MLG", - "color": "#55FFFF" - } - ], - [ - { - "text": "over and over again" + "text": "eat anything", + "color": "#FF5555" } ] ], @@ -28060,8 +29472,8 @@ "text": " " }, { - "text": "Interval = Water MLG", - "color": "#55FFFF" + "text": "No Eating", + "color": "#FF5555" } ], [ @@ -28071,18 +29483,12 @@ ], [ { - "text": "You have to do a ", + "text": "You cannot ", "color": "#AAAAAA" }, { - "text": "Water MLG", - "color": "#55FFFF" - } - ], - [ - { - "text": "over and over again", - "color": "#AAAAAA" + "text": "eat anything", + "color": "#FF5555" } ] ] @@ -28090,30 +29496,18 @@ "de": { "name": [ { - "text": "Intervall = Water MLG", - "color": "#55FFFF" + "text": "Kein Essen", + "color": "#FF5555" } ], "description": [ [ { - "text": "Du musst " - }, - { - "text": "immer wieder", - "color": "#55FFFF" - } - ], - [ - { - "text": "einen " - }, - { - "text": "Water MLG", - "color": "#55FFFF" + "text": "Du kannst " }, { - "text": " absolvieren" + "text": "nichts essen", + "color": "#FF5555" } ] ], @@ -28127,8 +29521,8 @@ "text": " " }, { - "text": "Intervall = Water MLG", - "color": "#55FFFF" + "text": "Kein Essen", + "color": "#FF5555" } ], [ @@ -28138,85 +29532,68 @@ ], [ { - "text": "Du musst ", - "color": "#AAAAAA" - }, - { - "text": "immer wieder", - "color": "#55FFFF" - } - ], - [ - { - "text": "einen ", + "text": "Du kannst ", "color": "#AAAAAA" }, { - "text": "Water MLG", - "color": "#55FFFF" - }, - { - "text": " absolvieren", - "color": "#AAAAAA" + "text": "nichts essen", + "color": "#FF5555" } ] ] } + }, + "preset": { + "trigger": "consume_item", + "action": "cancel" } }, { - "id": "jumpandrun", - "category": "extra_world", + "id": "foodonce", + "category": "misc_challenge", "icon": { - "material": "ACACIA_STAIRS" + "material": "COOKED_BEEF" }, "name": { - "en": "Interval = Jump and Run", - "de": "Intervall = Jump and Run" + "en": "Food Once", + "de": "Jedes Essen nur einmal" }, "description": { "en": [ - "Every few minutes you have to do a random jump and run which gets harder every time" + "Each food can be eaten only once" ], "de": [ - "In einem gesetzten Intervall muss ein zufälliger Spieler ein Jump and Run absolvieren Schafft er es nicht, stirbt er" + "Du kannst jedes Essen nur einmal essen" ] }, "styled": { "en": { "name": [ { - "text": "Interval = Jump and Run", - "color": "#FFAA00" + "text": "Food Once", + "color": "#FF5555" } ], "description": [ [ { - "text": "Every " + "text": "Each " }, { - "text": "few minutes", - "color": "#FFAA00" + "text": "food", + "color": "#FF5555" }, { - "text": " you have to do a random" + "text": " can be" } ], [ { - "text": "jump and run", - "color": "#FFAA00" - }, - { - "text": " which gets " - }, - { - "text": "harder", - "color": "#FFAA00" + "text": "eaten", + "color": "#FF5555" }, { - "text": " every time" + "text": " only once" } ] ], @@ -28230,8 +29607,8 @@ "text": " " }, { - "text": "Interval = Jump and Run", - "color": "#FFAA00" + "text": "Food Once", + "color": "#FF5555" } ], [ @@ -28241,33 +29618,25 @@ ], [ { - "text": "Every ", + "text": "Each ", "color": "#AAAAAA" }, { - "text": "few minutes", - "color": "#FFAA00" + "text": "food", + "color": "#FF5555" }, { - "text": " you have to do a random", + "text": " can be", "color": "#AAAAAA" } ], [ { - "text": "jump and run", - "color": "#FFAA00" - }, - { - "text": " which gets ", - "color": "#AAAAAA" - }, - { - "text": "harder", - "color": "#FFAA00" + "text": "eaten", + "color": "#FF5555" }, { - "text": " every time", + "text": " only once", "color": "#AAAAAA" } ] @@ -28276,56 +29645,27 @@ "de": { "name": [ { - "text": "Intervall = Jump and Run", - "color": "#FFAA00" + "text": "Jedes Essen nur einmal", + "color": "#FF5555" } ], "description": [ [ { - "text": "In einem gesetzten " - }, - { - "text": "Intervall", - "color": "#FFAA00" - }, - { - "text": " muss ein" - } - ], - [ - { - "text": "zufälliger Spieler", - "color": "#FFAA00" - }, - { - "text": " ein " - }, - { - "text": "Jump and Run", - "color": "#FFAA00" + "text": "Du kannst jedes " }, { - "text": " absolvieren" + "text": "Essen", + "color": "#FF5555" } ], [ { - "text": "Schafft er es " - }, - { - "text": "nicht", - "color": "#FFAA00" - }, - { - "text": ", " - }, - { - "text": "stirbt", - "color": "#FFAA00" + "text": "nur einmal " }, { - "text": " er" + "text": "essen", + "color": "#FF5555" } ] ], @@ -28339,8 +29679,8 @@ "text": " " }, { - "text": "Intervall = Jump and Run", - "color": "#FFAA00" + "text": "Jedes Essen nur einmal", + "color": "#FF5555" } ], [ @@ -28350,56 +29690,22 @@ ], [ { - "text": "In einem gesetzten ", - "color": "#AAAAAA" - }, - { - "text": "Intervall", - "color": "#FFAA00" - }, - { - "text": " muss ein", - "color": "#AAAAAA" - } - ], - [ - { - "text": "zufälliger Spieler", - "color": "#FFAA00" - }, - { - "text": " ein ", + "text": "Du kannst jedes ", "color": "#AAAAAA" }, { - "text": "Jump and Run", - "color": "#FFAA00" - }, - { - "text": " absolvieren", - "color": "#AAAAAA" + "text": "Essen", + "color": "#FF5555" } ], [ { - "text": "Schafft er es ", - "color": "#AAAAAA" - }, - { - "text": "nicht", - "color": "#FFAA00" - }, - { - "text": ", ", + "text": "nur einmal ", "color": "#AAAAAA" }, { - "text": "stirbt", - "color": "#FFAA00" - }, - { - "text": " er", - "color": "#AAAAAA" + "text": "essen", + "color": "#FF5555" } ] ] @@ -28407,39 +29713,58 @@ } }, { - "id": "preset-no-eating", + "id": "foodlaunch", "category": "misc_challenge", "icon": { - "material": "COOKED_BEEF" + "material": "CAKE" }, "name": { - "en": "No Eating", - "de": "Kein Essen" + "en": "Eat = Launch", + "de": "Essen = Hochgeschleudert" }, "description": { "en": [ - "You cannot eat anything" + "When you eat an item you will be launched into the air" ], "de": [ - "Du kannst nichts essen" + "Wenn du ein Item isst, wirst du in die Luft geschleudert" ] }, "styled": { "en": { "name": [ { - "text": "No Eating", + "text": "Eat = Launch", "color": "#FF5555" } ], "description": [ [ { - "text": "You cannot " + "text": "When you " }, { - "text": "eat anything", + "text": "eat", + "color": "#FF5555" + }, + { + "text": " an " + }, + { + "text": "item", + "color": "#FF5555" + } + ], + [ + { + "text": "you will be " + }, + { + "text": "launched", "color": "#FF5555" + }, + { + "text": " into the air" } ] ], @@ -28453,7 +29778,7 @@ "text": " " }, { - "text": "No Eating", + "text": "Eat = Launch", "color": "#FF5555" } ], @@ -28464,12 +29789,34 @@ ], [ { - "text": "You cannot ", + "text": "When you ", "color": "#AAAAAA" }, { - "text": "eat anything", + "text": "eat", + "color": "#FF5555" + }, + { + "text": " an ", + "color": "#AAAAAA" + }, + { + "text": "item", + "color": "#FF5555" + } + ], + [ + { + "text": "you will be ", + "color": "#AAAAAA" + }, + { + "text": "launched", "color": "#FF5555" + }, + { + "text": " into the air", + "color": "#AAAAAA" } ] ] @@ -28477,18 +29824,33 @@ "de": { "name": [ { - "text": "Kein Essen", + "text": "Essen = Hochgeschleudert", "color": "#FF5555" } ], "description": [ [ { - "text": "Du kannst " + "text": "Wenn du ein " }, { - "text": "nichts essen", + "text": "Item isst", "color": "#FF5555" + }, + { + "text": "," + } + ], + [ + { + "text": "wirst du " + }, + { + "text": "in die Luft", + "color": "#FF5555" + }, + { + "text": " geschleudert" } ] ], @@ -28502,7 +29864,7 @@ "text": " " }, { - "text": "Kein Essen", + "text": "Essen = Hochgeschleudert", "color": "#FF5555" } ], @@ -28513,68 +29875,82 @@ ], [ { - "text": "Du kannst ", + "text": "Wenn du ein ", "color": "#AAAAAA" }, { - "text": "nichts essen", + "text": "Item isst", + "color": "#FF5555" + }, + { + "text": ",", + "color": "#AAAAAA" + } + ], + [ + { + "text": "wirst du ", + "color": "#AAAAAA" + }, + { + "text": "in die Luft", "color": "#FF5555" + }, + { + "text": " geschleudert", + "color": "#AAAAAA" } ] ] } }, - "preset": { + "pairing": { "trigger": "consume_item", - "action": "cancel" + "action": "boost_in_air" } }, { - "id": "foodonce", + "id": "notrading", "category": "misc_challenge", "icon": { - "material": "COOKED_BEEF" + "material": "EMERALD" }, "name": { - "en": "Food Once", - "de": "Jedes Essen nur einmal" + "en": "No Trading", + "de": "Kein Handeln" }, "description": { "en": [ - "Each food can be eaten only once" + "You cannot trade with villagers" ], "de": [ - "Du kannst jedes Essen nur einmal essen" + "Du kannst nicht mit Villager handeln" ] }, "styled": { "en": { "name": [ { - "text": "Food Once", - "color": "#FF5555" + "text": "No Trading", + "color": "#00AA00" } ], "description": [ [ { - "text": "Each " + "text": "You " }, { - "text": "food", - "color": "#FF5555" + "text": "cannot", + "color": "#00AA00" }, { - "text": " can be" + "text": " trade" } ], [ { - "text": "eaten", - "color": "#FF5555" - }, - { - "text": " only once" + "text": "with villagers" } ] ], @@ -28588,8 +29964,8 @@ "text": " " }, { - "text": "Food Once", - "color": "#FF5555" + "text": "No Trading", + "color": "#00AA00" } ], [ @@ -28599,25 +29975,21 @@ ], [ { - "text": "Each ", + "text": "You ", "color": "#AAAAAA" }, { - "text": "food", - "color": "#FF5555" + "text": "cannot", + "color": "#00AA00" }, { - "text": " can be", + "text": " trade", "color": "#AAAAAA" } ], [ { - "text": "eaten", - "color": "#FF5555" - }, - { - "text": " only once", + "text": "with villagers", "color": "#AAAAAA" } ] @@ -28626,27 +29998,30 @@ "de": { "name": [ { - "text": "Jedes Essen nur einmal", - "color": "#FF5555" + "text": "Kein Handeln", + "color": "#00AA00" } ], "description": [ [ { - "text": "Du kannst jedes " + "text": "Du kannst " }, { - "text": "Essen", - "color": "#FF5555" + "text": "nicht", + "color": "#00AA00" + }, + { + "text": " mit" } ], [ { - "text": "nur einmal " + "text": "Villager " }, { - "text": "essen", - "color": "#FF5555" + "text": "handeln", + "color": "#00AA00" } ] ], @@ -28660,8 +30035,8 @@ "text": " " }, { - "text": "Jedes Essen nur einmal", - "color": "#FF5555" + "text": "Kein Handeln", + "color": "#00AA00" } ], [ @@ -28671,22 +30046,26 @@ ], [ { - "text": "Du kannst jedes ", + "text": "Du kannst ", "color": "#AAAAAA" }, { - "text": "Essen", - "color": "#FF5555" + "text": "nicht", + "color": "#00AA00" + }, + { + "text": " mit", + "color": "#AAAAAA" } ], [ { - "text": "nur einmal ", + "text": "Villager ", "color": "#AAAAAA" }, { - "text": "essen", - "color": "#FF5555" + "text": "handeln", + "color": "#00AA00" } ] ] @@ -28694,58 +30073,42 @@ } }, { - "id": "foodlaunch", + "id": "noexp", "category": "misc_challenge", "icon": { - "material": "CAKE" + "material": "EXPERIENCE_BOTTLE" }, "name": { - "en": "Eat = Launch", - "de": "Essen = Hochgeschleudert" + "en": "Pick Up XP = Death", + "de": "XP aufheben = Tod" }, "description": { "en": [ - "When you eat an item you will be launched into the air" + "If you pickup EXP you die" ], "de": [ - "Wenn du ein Item isst, wirst du in die Luft geschleudert" + "Wenn du XP aufsammelst, stirbst du" ] }, "styled": { "en": { "name": [ { - "text": "Eat = Launch", - "color": "#FF5555" + "text": "Pick Up XP = Death", + "color": "#55FF55" } ], "description": [ [ { - "text": "When you " - }, - { - "text": "eat", - "color": "#FF5555" - }, - { - "text": " an " - }, - { - "text": "item", - "color": "#FF5555" - } - ], - [ - { - "text": "you will be " + "text": "If you pickup " }, { - "text": "launched", - "color": "#FF5555" + "text": "EXP", + "color": "#55FF55" }, { - "text": " into the air" + "text": " you die" } ] ], @@ -28759,8 +30122,8 @@ "text": " " }, { - "text": "Eat = Launch", - "color": "#FF5555" + "text": "Pick Up XP = Death", + "color": "#55FF55" } ], [ @@ -28770,33 +30133,15 @@ ], [ { - "text": "When you ", - "color": "#AAAAAA" - }, - { - "text": "eat", - "color": "#FF5555" - }, - { - "text": " an ", - "color": "#AAAAAA" - }, - { - "text": "item", - "color": "#FF5555" - } - ], - [ - { - "text": "you will be ", + "text": "If you pickup ", "color": "#AAAAAA" }, { - "text": "launched", - "color": "#FF5555" + "text": "EXP", + "color": "#55FF55" }, { - "text": " into the air", + "text": " you die", "color": "#AAAAAA" } ] @@ -28805,33 +30150,21 @@ "de": { "name": [ { - "text": "Essen = Hochgeschleudert", - "color": "#FF5555" + "text": "XP aufheben = Tod", + "color": "#55FF55" } ], "description": [ [ { - "text": "Wenn du ein " - }, - { - "text": "Item isst", - "color": "#FF5555" - }, - { - "text": "," - } - ], - [ - { - "text": "wirst du " + "text": "Wenn du " }, { - "text": "in die Luft", - "color": "#FF5555" + "text": "XP", + "color": "#55FF55" }, { - "text": " geschleudert" + "text": " aufsammelst, stirbst du" } ] ], @@ -28845,8 +30178,8 @@ "text": " " }, { - "text": "Essen = Hochgeschleudert", - "color": "#FF5555" + "text": "XP aufheben = Tod", + "color": "#55FF55" } ], [ @@ -28856,78 +30189,86 @@ ], [ { - "text": "Wenn du ein ", - "color": "#AAAAAA" - }, - { - "text": "Item isst", - "color": "#FF5555" - }, - { - "text": ",", - "color": "#AAAAAA" - } - ], - [ - { - "text": "wirst du ", + "text": "Wenn du ", "color": "#AAAAAA" }, { - "text": "in die Luft", - "color": "#FF5555" + "text": "XP", + "color": "#55FF55" }, { - "text": " geschleudert", + "text": " aufsammelst, stirbst du", "color": "#AAAAAA" } ] ] } + }, + "pairing": { + "trigger": "gain_xp", + "action": "kill" } }, { - "id": "notrading", + "id": "nosharedadvancements", "category": "misc_challenge", "icon": { - "material": "EMERALD" + "material": "KNOWLEDGE_BOOK" }, "name": { - "en": "No Trading", - "de": "Kein Handeln" + "en": "Repeat Advancement = Death", + "de": "Doppeltes Advancement = Tod" }, "description": { "en": [ - "You cannot trade with villagers" + "You're not allowed to get advancements someone else already did. Else you'll die." ], "de": [ - "Du kannst nicht mit Villager handeln" + "Spieler dürfen nicht die gleichen Advancements abschließen, sonst stirbt der Spieler" ] }, "styled": { "en": { "name": [ { - "text": "No Trading", + "text": "Repeat Advancement = Death", "color": "#00AA00" } ], "description": [ [ { - "text": "You " + "text": "You're " }, { - "text": "cannot", + "text": "not allowed", "color": "#00AA00" }, { - "text": " trade" + "text": " to get " + }, + { + "text": "advancements", + "color": "#00AA00" + }, + { + "text": " someone else" } ], [ { - "text": "with villagers" + "text": "already did", + "color": "#00AA00" + }, + { + "text": ". Else " + }, + { + "text": "you'll die", + "color": "#00AA00" + }, + { + "text": "." } ] ], @@ -28941,7 +30282,7 @@ "text": " " }, { - "text": "No Trading", + "text": "Repeat Advancement = Death", "color": "#00AA00" } ], @@ -28952,21 +30293,41 @@ ], [ { - "text": "You ", + "text": "You're ", "color": "#AAAAAA" }, { - "text": "cannot", + "text": "not allowed", + "color": "#00AA00" + }, + { + "text": " to get ", + "color": "#AAAAAA" + }, + { + "text": "advancements", + "color": "#00AA00" + }, + { + "text": " someone else", + "color": "#AAAAAA" + } + ], + [ + { + "text": "already did", + "color": "#00AA00" + }, + { + "text": ". Else ", + "color": "#AAAAAA" + }, + { + "text": "you'll die", "color": "#00AA00" }, { - "text": " trade", - "color": "#AAAAAA" - } - ], - [ - { - "text": "with villagers", + "text": ".", "color": "#AAAAAA" } ] @@ -28975,29 +30336,40 @@ "de": { "name": [ { - "text": "Kein Handeln", + "text": "Doppeltes Advancement = Tod", "color": "#00AA00" } ], "description": [ [ { - "text": "Du kannst " + "text": "Spieler dürfen " }, { "text": "nicht", "color": "#00AA00" }, { - "text": " mit" + "text": " die " + }, + { + "text": "gleichen Advancements", + "color": "#00AA00" } ], [ { - "text": "Villager " + "text": "abschließen, sonst " }, { - "text": "handeln", + "text": "stirbt", + "color": "#00AA00" + }, + { + "text": " der " + }, + { + "text": "Spieler", "color": "#00AA00" } ] @@ -29012,7 +30384,7 @@ "text": " " }, { - "text": "Kein Handeln", + "text": "Doppeltes Advancement = Tod", "color": "#00AA00" } ], @@ -29023,7 +30395,7 @@ ], [ { - "text": "Du kannst ", + "text": "Spieler dürfen ", "color": "#AAAAAA" }, { @@ -29031,17 +30403,29 @@ "color": "#00AA00" }, { - "text": " mit", + "text": " die ", "color": "#AAAAAA" + }, + { + "text": "gleichen Advancements", + "color": "#00AA00" } ], [ { - "text": "Villager ", + "text": "abschließen, sonst ", "color": "#AAAAAA" }, { - "text": "handeln", + "text": "stirbt", + "color": "#00AA00" + }, + { + "text": " der ", + "color": "#AAAAAA" + }, + { + "text": "Spieler", "color": "#00AA00" } ] @@ -29050,42 +30434,46 @@ } }, { - "id": "noexp", + "id": "onedurability", "category": "misc_challenge", "icon": { - "material": "EXPERIENCE_BOTTLE" + "material": "WOODEN_HOE" }, "name": { - "en": "Pick Up XP = Death", - "de": "XP aufheben = Tod" + "en": "One Durability", + "de": "Eine Haltbarkeit" }, "description": { "en": [ - "If you pickup EXP you die" + "Items are destroyed after one use" ], "de": [ - "Wenn du XP aufsammelst, stirbst du" + "Items gehen nach einer Benutzung kaputt" ] }, "styled": { "en": { "name": [ { - "text": "Pick Up XP = Death", - "color": "#55FF55" + "text": "One Durability", + "color": "#AA0000" } ], "description": [ [ { - "text": "If you pickup " + "text": "Items are " }, { - "text": "EXP", - "color": "#55FF55" + "text": "destroyed", + "color": "#AA0000" }, { - "text": " you die" + "text": " after one " + }, + { + "text": "use", + "color": "#AA0000" } ] ], @@ -29099,8 +30487,8 @@ "text": " " }, { - "text": "Pick Up XP = Death", - "color": "#55FF55" + "text": "One Durability", + "color": "#AA0000" } ], [ @@ -29110,16 +30498,20 @@ ], [ { - "text": "If you pickup ", + "text": "Items are ", "color": "#AAAAAA" }, { - "text": "EXP", - "color": "#55FF55" + "text": "destroyed", + "color": "#AA0000" }, { - "text": " you die", + "text": " after one ", "color": "#AAAAAA" + }, + { + "text": "use", + "color": "#AA0000" } ] ] @@ -29127,21 +30519,29 @@ "de": { "name": [ { - "text": "XP aufheben = Tod", - "color": "#55FF55" + "text": "Eine Haltbarkeit", + "color": "#AA0000" } ], "description": [ [ { - "text": "Wenn du " + "text": "Items", + "color": "#AA0000" }, { - "text": "XP", - "color": "#55FF55" + "text": " gehen nach " }, { - "text": " aufsammelst, stirbst du" + "text": "einer", + "color": "#AA0000" + }, + { + "text": " Benutzung " + }, + { + "text": "kaputt", + "color": "#AA0000" } ] ], @@ -29155,8 +30555,8 @@ "text": " " }, { - "text": "XP aufheben = Tod", - "color": "#55FF55" + "text": "Eine Haltbarkeit", + "color": "#AA0000" } ], [ @@ -29166,16 +30566,24 @@ ], [ { - "text": "Wenn du ", + "text": "Items", + "color": "#AA0000" + }, + { + "text": " gehen nach ", "color": "#AAAAAA" }, { - "text": "XP", - "color": "#55FF55" + "text": "einer", + "color": "#AA0000" }, { - "text": " aufsammelst, stirbst du", + "text": " Benutzung ", "color": "#AAAAAA" + }, + { + "text": "kaputt", + "color": "#AA0000" } ] ] @@ -29183,65 +30591,55 @@ } }, { - "id": "nosharedadvancements", + "id": "lowdroprate", "category": "misc_challenge", "icon": { - "material": "KNOWLEDGE_BOOK" + "material": "WOODEN_AXE" }, "name": { - "en": "Repeat Advancement = Death", - "de": "Doppeltes Advancement = Tod" + "en": "Low Drop Chance", + "de": "Niedrige Dropchance" }, "description": { "en": [ - "You're not allowed to get advancements someone else already did. Else you'll die." + "The drop chance of each block will be set to the defined percentage" ], "de": [ - "Spieler dürfen nicht die gleichen Advancements abschließen, sonst stirbt der Spieler" + "Die Dropchance jedes Blockes wird auf die angegebene Prozentzahl gesetzt" ] }, "styled": { "en": { "name": [ { - "text": "Repeat Advancement = Death", - "color": "#00AA00" + "text": "Low Drop Chance", + "color": "#FFAA00" } ], "description": [ [ { - "text": "You're " - }, - { - "text": "not allowed", - "color": "#00AA00" + "text": "The " }, { - "text": " to get " + "text": "drop chance", + "color": "#FFAA00" }, { - "text": "advancements", - "color": "#00AA00" + "text": " of each " }, { - "text": " someone else" + "text": "block", + "color": "#FFAA00" } ], [ { - "text": "already did", - "color": "#00AA00" - }, - { - "text": ". Else " - }, - { - "text": "you'll die", - "color": "#00AA00" + "text": "will be set to the defined " }, { - "text": "." + "text": "percentage", + "color": "#FFAA00" } ] ], @@ -29255,8 +30653,8 @@ "text": " " }, { - "text": "Repeat Advancement = Death", - "color": "#00AA00" + "text": "Low Drop Chance", + "color": "#FFAA00" } ], [ @@ -29266,42 +30664,30 @@ ], [ { - "text": "You're ", + "text": "The ", "color": "#AAAAAA" }, { - "text": "not allowed", - "color": "#00AA00" + "text": "drop chance", + "color": "#FFAA00" }, { - "text": " to get ", + "text": " of each ", "color": "#AAAAAA" }, { - "text": "advancements", - "color": "#00AA00" - }, - { - "text": " someone else", - "color": "#AAAAAA" + "text": "block", + "color": "#FFAA00" } ], [ { - "text": "already did", - "color": "#00AA00" - }, - { - "text": ". Else ", + "text": "will be set to the defined ", "color": "#AAAAAA" }, { - "text": "you'll die", - "color": "#00AA00" - }, - { - "text": ".", - "color": "#AAAAAA" + "text": "percentage", + "color": "#FFAA00" } ] ] @@ -29309,41 +30695,40 @@ "de": { "name": [ { - "text": "Doppeltes Advancement = Tod", - "color": "#00AA00" + "text": "Niedrige Dropchance", + "color": "#FFAA00" } ], "description": [ [ { - "text": "Spieler dürfen " + "text": "Die " }, { - "text": "nicht", - "color": "#00AA00" + "text": "Dropchance", + "color": "#FFAA00" }, { - "text": " die " + "text": " jedes " }, { - "text": "gleichen Advancements", - "color": "#00AA00" + "text": "Blockes", + "color": "#FFAA00" + }, + { + "text": " wird auf die" } ], [ { - "text": "abschließen, sonst " - }, - { - "text": "stirbt", - "color": "#00AA00" + "text": "angegebene " }, { - "text": " der " + "text": "Prozentzahl", + "color": "#FFAA00" }, { - "text": "Spieler", - "color": "#00AA00" + "text": " gesetzt" } ] ], @@ -29357,8 +30742,8 @@ "text": " " }, { - "text": "Doppeltes Advancement = Tod", - "color": "#00AA00" + "text": "Niedrige Dropchance", + "color": "#FFAA00" } ], [ @@ -29368,38 +30753,38 @@ ], [ { - "text": "Spieler dürfen ", + "text": "Die ", + "color": "#AAAAAA" + }, + { + "text": "Dropchance", + "color": "#FFAA00" + }, + { + "text": " jedes ", "color": "#AAAAAA" }, { - "text": "nicht", - "color": "#00AA00" + "text": "Blockes", + "color": "#FFAA00" }, { - "text": " die ", + "text": " wird auf die", "color": "#AAAAAA" - }, - { - "text": "gleichen Advancements", - "color": "#00AA00" } ], [ { - "text": "abschließen, sonst ", + "text": "angegebene ", "color": "#AAAAAA" }, { - "text": "stirbt", - "color": "#00AA00" + "text": "Prozentzahl", + "color": "#FFAA00" }, { - "text": " der ", + "text": " gesetzt", "color": "#AAAAAA" - }, - { - "text": "Spieler", - "color": "#00AA00" } ] ] @@ -29407,46 +30792,48 @@ } }, { - "id": "onedurability", + "id": "uncraftitems", "category": "misc_challenge", "icon": { - "material": "WOODEN_HOE" + "material": "CRAFTING_TABLE" }, "name": { - "en": "One Durability", - "de": "Eine Haltbarkeit" + "en": "Interval = Items Uncraft", + "de": "Intervall = Items entcraften" }, "description": { "en": [ - "Items are destroyed after one use" + "Items in your inventory are crafting back all few seconds" ], "de": [ - "Items gehen nach einer Benutzung kaputt" + "Alle Items in deinem Inventar craften sich alle paar Sekunden zurück" ] }, "styled": { "en": { "name": [ { - "text": "One Durability", - "color": "#AA0000" + "text": "Interval = Items Uncraft", + "color": "#FFAA00" } ], "description": [ [ { - "text": "Items are " + "text": "Items", + "color": "#FFAA00" }, { - "text": "destroyed", - "color": "#AA0000" - }, + "text": " in your inventory are" + } + ], + [ { - "text": " after one " + "text": "crafting", + "color": "#FFAA00" }, { - "text": "use", - "color": "#AA0000" + "text": " back all few seconds" } ] ], @@ -29460,8 +30847,8 @@ "text": " " }, { - "text": "One Durability", - "color": "#AA0000" + "text": "Interval = Items Uncraft", + "color": "#FFAA00" } ], [ @@ -29471,20 +30858,22 @@ ], [ { - "text": "Items are ", - "color": "#AAAAAA" - }, - { - "text": "destroyed", - "color": "#AA0000" + "text": "Items", + "color": "#FFAA00" }, { - "text": " after one ", + "text": " in your inventory are", "color": "#AAAAAA" + } + ], + [ + { + "text": "crafting", + "color": "#FFAA00" }, { - "text": "use", - "color": "#AA0000" + "text": " back all few seconds", + "color": "#AAAAAA" } ] ] @@ -29492,29 +30881,34 @@ "de": { "name": [ { - "text": "Eine Haltbarkeit", - "color": "#AA0000" + "text": "Intervall = Items entcraften", + "color": "#FFAA00" } ], "description": [ [ { - "text": "Items", - "color": "#AA0000" + "text": "Alle " }, { - "text": " gehen nach " + "text": "Items", + "color": "#FFAA00" }, { - "text": "einer", - "color": "#AA0000" + "text": " in deinem Inventar " }, { - "text": " Benutzung " + "text": "craften", + "color": "#FFAA00" + } + ], + [ + { + "text": "sich alle paar Sekunden " }, { - "text": "kaputt", - "color": "#AA0000" + "text": "zurück", + "color": "#FFAA00" } ] ], @@ -29528,8 +30922,8 @@ "text": " " }, { - "text": "Eine Haltbarkeit", - "color": "#AA0000" + "text": "Intervall = Items entcraften", + "color": "#FFAA00" } ], [ @@ -29538,81 +30932,103 @@ } ], [ + { + "text": "Alle ", + "color": "#AAAAAA" + }, { "text": "Items", - "color": "#AA0000" + "color": "#FFAA00" }, { - "text": " gehen nach ", + "text": " in deinem Inventar ", "color": "#AAAAAA" }, { - "text": "einer", - "color": "#AA0000" - }, + "text": "craften", + "color": "#FFAA00" + } + ], + [ { - "text": " Benutzung ", + "text": "sich alle paar Sekunden ", "color": "#AAAAAA" }, { - "text": "kaputt", - "color": "#AA0000" + "text": "zurück", + "color": "#FFAA00" } ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "uncraft_inventory" } }, { - "id": "lowdroprate", + "id": "endergames", "category": "misc_challenge", "icon": { - "material": "WOODEN_AXE" + "material": "ENDER_PEARL" }, "name": { - "en": "Low Drop Chance", - "de": "Niedrige Dropchance" + "en": "Interval = Swap With Mob", + "de": "Intervall = Tausch mit Mob" }, "description": { "en": [ - "The drop chance of each block will be set to the defined percentage" + "Every few minutes you will be swapped with a random entity in a 200 blocks range" ], "de": [ - "Die Dropchance jedes Blockes wird auf die angegebene Prozentzahl gesetzt" + "Alle paar Minuten wirst du mit einem zufälligem Entity aus einem 200 Block Radius getauscht" ] }, "styled": { "en": { "name": [ { - "text": "Low Drop Chance", - "color": "#FFAA00" + "text": "Interval = Swap With Mob", + "color": "#AA00AA" } ], "description": [ [ { - "text": "The " + "text": "Every " }, { - "text": "drop chance", - "color": "#FFAA00" + "text": "few minutes", + "color": "#AA00AA" }, { - "text": " of each " + "text": " you will be" + } + ], + [ + { + "text": "swapped", + "color": "#AA00AA" }, { - "text": "block", - "color": "#FFAA00" + "text": " with a " + }, + { + "text": "random entity", + "color": "#AA00AA" } ], [ { - "text": "will be set to the defined " + "text": "in a " }, { - "text": "percentage", - "color": "#FFAA00" + "text": "200 blocks", + "color": "#AA00AA" + }, + { + "text": " range" } ] ], @@ -29626,8 +31042,8 @@ "text": " " }, { - "text": "Low Drop Chance", - "color": "#FFAA00" + "text": "Interval = Swap With Mob", + "color": "#AA00AA" } ], [ @@ -29637,30 +31053,44 @@ ], [ { - "text": "The ", + "text": "Every ", "color": "#AAAAAA" }, { - "text": "drop chance", - "color": "#FFAA00" + "text": "few minutes", + "color": "#AA00AA" }, { - "text": " of each ", + "text": " you will be", "color": "#AAAAAA" + } + ], + [ + { + "text": "swapped", + "color": "#AA00AA" }, { - "text": "block", - "color": "#FFAA00" + "text": " with a ", + "color": "#AAAAAA" + }, + { + "text": "random entity", + "color": "#AA00AA" } ], [ { - "text": "will be set to the defined ", + "text": "in a ", "color": "#AAAAAA" }, { - "text": "percentage", - "color": "#FFAA00" + "text": "200 blocks", + "color": "#AA00AA" + }, + { + "text": " range", + "color": "#AAAAAA" } ] ] @@ -29668,40 +31098,49 @@ "de": { "name": [ { - "text": "Niedrige Dropchance", - "color": "#FFAA00" + "text": "Intervall = Tausch mit Mob", + "color": "#AA00AA" } ], "description": [ [ { - "text": "Die " + "text": "Alle " }, { - "text": "Dropchance", - "color": "#FFAA00" + "text": "paar Minuten", + "color": "#AA00AA" }, { - "text": " jedes " + "text": " wirst du" + } + ], + [ + { + "text": "mit einem " }, { - "text": "Blockes", - "color": "#FFAA00" + "text": "zufälligem Entity", + "color": "#AA00AA" }, { - "text": " wird auf die" + "text": " aus" } ], [ { - "text": "angegebene " + "text": "einem " }, { - "text": "Prozentzahl", - "color": "#FFAA00" + "text": "200 Block", + "color": "#AA00AA" }, { - "text": " gesetzt" + "text": " Radius " + }, + { + "text": "getauscht", + "color": "#AA00AA" } ] ], @@ -29715,8 +31154,8 @@ "text": " " }, { - "text": "Niedrige Dropchance", - "color": "#FFAA00" + "text": "Intervall = Tausch mit Mob", + "color": "#AA00AA" } ], [ @@ -29726,38 +31165,48 @@ ], [ { - "text": "Die ", + "text": "Alle ", "color": "#AAAAAA" }, { - "text": "Dropchance", - "color": "#FFAA00" + "text": "paar Minuten", + "color": "#AA00AA" }, { - "text": " jedes ", + "text": " wirst du", + "color": "#AAAAAA" + } + ], + [ + { + "text": "mit einem ", "color": "#AAAAAA" }, { - "text": "Blockes", - "color": "#FFAA00" + "text": "zufälligem Entity", + "color": "#AA00AA" }, { - "text": " wird auf die", + "text": " aus", "color": "#AAAAAA" } ], [ { - "text": "angegebene ", + "text": "einem ", "color": "#AAAAAA" }, { - "text": "Prozentzahl", - "color": "#FFAA00" + "text": "200 Block", + "color": "#AA00AA" }, { - "text": " gesetzt", + "text": " Radius ", "color": "#AAAAAA" + }, + { + "text": "getauscht", + "color": "#AA00AA" } ] ] @@ -29765,48 +31214,63 @@ } }, { - "id": "uncraftitems", + "id": "inverthealth", "category": "misc_challenge", "icon": { - "material": "CRAFTING_TABLE" + "material": "POPPY" }, "name": { - "en": "Interval = Items Uncraft", - "de": "Intervall = Items entcraften" + "en": "Interval = Hearts Flipped", + "de": "Intervall = Herzen umgedreht" }, "description": { "en": [ - "Items in your inventory are crafting back all few seconds" + "Every few minutes the hearts are inverted. If you have 8 hearts, you will have 2 hearts and the other way around" ], "de": [ - "Alle Items in deinem Inventar craften sich alle paar Sekunden zurück" + "Alle paar Minuten werden deine Herzen invertiert. Wenn du 8 Herzen hast, hast du danach 2 Herzen und umgekehrt." ] }, "styled": { "en": { "name": [ { - "text": "Interval = Items Uncraft", - "color": "#FFAA00" + "text": "Interval = Hearts Flipped", + "color": "#FF5555" } ], "description": [ [ { - "text": "Items", - "color": "#FFAA00" + "text": "Every few minutes the " }, { - "text": " in your inventory are" + "text": "hearts are inverted", + "color": "#FF5555" + }, + { + "text": "." } ], [ { - "text": "crafting", - "color": "#FFAA00" + "text": "If you have " }, { - "text": " back all few seconds" + "text": "8 hearts", + "color": "#FF5555" + }, + { + "text": ", you will have " + }, + { + "text": "2 hearts", + "color": "#FF5555" + } + ], + [ + { + "text": "and the other way around" } ] ], @@ -29820,8 +31284,8 @@ "text": " " }, { - "text": "Interval = Items Uncraft", - "color": "#FFAA00" + "text": "Interval = Hearts Flipped", + "color": "#FF5555" } ], [ @@ -29831,21 +31295,39 @@ ], [ { - "text": "Items", - "color": "#FFAA00" + "text": "Every few minutes the ", + "color": "#AAAAAA" }, { - "text": " in your inventory are", + "text": "hearts are inverted", + "color": "#FF5555" + }, + { + "text": ".", "color": "#AAAAAA" } ], [ { - "text": "crafting", - "color": "#FFAA00" + "text": "If you have ", + "color": "#AAAAAA" }, { - "text": " back all few seconds", + "text": "8 hearts", + "color": "#FF5555" + }, + { + "text": ", you will have ", + "color": "#AAAAAA" + }, + { + "text": "2 hearts", + "color": "#FF5555" + } + ], + [ + { + "text": "and the other way around", "color": "#AAAAAA" } ] @@ -29854,34 +31336,45 @@ "de": { "name": [ { - "text": "Intervall = Items entcraften", - "color": "#FFAA00" + "text": "Intervall = Herzen umgedreht", + "color": "#FF5555" } ], "description": [ [ { - "text": "Alle " + "text": "Alle paar Minuten werden deine " }, { - "text": "Items", - "color": "#FFAA00" + "text": "Herzen invertiert", + "color": "#FF5555" }, { - "text": " in deinem Inventar " + "text": "." + } + ], + [ + { + "text": "Wenn du " }, { - "text": "craften", - "color": "#FFAA00" + "text": "8 Herzen", + "color": "#FF5555" + }, + { + "text": " hast," } ], [ { - "text": "sich alle paar Sekunden " + "text": "hast du danach " }, { - "text": "zurück", - "color": "#FFAA00" + "text": "2 Herzen", + "color": "#FF5555" + }, + { + "text": " und umgekehrt." } ] ], @@ -29895,8 +31388,8 @@ "text": " " }, { - "text": "Intervall = Items entcraften", - "color": "#FFAA00" + "text": "Intervall = Herzen umgedreht", + "color": "#FF5555" } ], [ @@ -29906,60 +31399,78 @@ ], [ { - "text": "Alle ", + "text": "Alle paar Minuten werden deine ", "color": "#AAAAAA" }, { - "text": "Items", - "color": "#FFAA00" + "text": "Herzen invertiert", + "color": "#FF5555" }, { - "text": " in deinem Inventar ", + "text": ".", + "color": "#AAAAAA" + } + ], + [ + { + "text": "Wenn du ", "color": "#AAAAAA" }, { - "text": "craften", - "color": "#FFAA00" + "text": "8 Herzen", + "color": "#FF5555" + }, + { + "text": " hast,", + "color": "#AAAAAA" } ], [ { - "text": "sich alle paar Sekunden ", + "text": "hast du danach ", "color": "#AAAAAA" }, { - "text": "zurück", - "color": "#FFAA00" + "text": "2 Herzen", + "color": "#FF5555" + }, + { + "text": " und umgekehrt.", + "color": "#AAAAAA" } ] ] } + }, + "pairing": { + "trigger": "interval", + "action": "invert_health" } }, { - "id": "endergames", + "id": "quiz", "category": "misc_challenge", "icon": { - "material": "ENDER_PEARL" + "material": "WRITABLE_BOOK" }, "name": { - "en": "Interval = Swap With Mob", - "de": "Intervall = Tausch mit Mob" + "en": "Interval = Quiz Question", + "de": "Intervall = Quizfrage" }, "description": { "en": [ - "Every few minutes you will be swapped with a random entity in a 200 blocks range" + "Every few minutes a random player must answer a quiz question" ], "de": [ - "Alle paar Minuten wirst du mit einem zufälligem Entity aus einem 200 Block Radius getauscht" + "Alle paar Minuten muss ein zufälliger Spieler eine Quizfrage beantworten" ] }, "styled": { "en": { "name": [ { - "text": "Interval = Swap With Mob", - "color": "#AA00AA" + "text": "Interval = Quiz Question", + "color": "#FFAA00" } ], "description": [ @@ -29969,35 +31480,23 @@ }, { "text": "few minutes", - "color": "#AA00AA" - }, - { - "text": " you will be" - } - ], - [ - { - "text": "swapped", - "color": "#AA00AA" + "color": "#FFAA00" }, { - "text": " with a " + "text": " a " }, { - "text": "random entity", - "color": "#AA00AA" + "text": "random player", + "color": "#FFAA00" } ], [ { - "text": "in a " - }, - { - "text": "200 blocks", - "color": "#AA00AA" + "text": "must answer a " }, { - "text": " range" + "text": "quiz question", + "color": "#FFAA00" } ] ], @@ -30011,8 +31510,8 @@ "text": " " }, { - "text": "Interval = Swap With Mob", - "color": "#AA00AA" + "text": "Interval = Quiz Question", + "color": "#FFAA00" } ], [ @@ -30027,39 +31526,25 @@ }, { "text": "few minutes", - "color": "#AA00AA" - }, - { - "text": " you will be", - "color": "#AAAAAA" - } - ], - [ - { - "text": "swapped", - "color": "#AA00AA" + "color": "#FFAA00" }, { - "text": " with a ", + "text": " a ", "color": "#AAAAAA" }, { - "text": "random entity", - "color": "#AA00AA" + "text": "random player", + "color": "#FFAA00" } ], [ { - "text": "in a ", + "text": "must answer a ", "color": "#AAAAAA" }, { - "text": "200 blocks", - "color": "#AA00AA" - }, - { - "text": " range", - "color": "#AAAAAA" + "text": "quiz question", + "color": "#FFAA00" } ] ] @@ -30067,8 +31552,8 @@ "de": { "name": [ { - "text": "Intervall = Tausch mit Mob", - "color": "#AA00AA" + "text": "Intervall = Quizfrage", + "color": "#FFAA00" } ], "description": [ @@ -30078,38 +31563,30 @@ }, { "text": "paar Minuten", - "color": "#AA00AA" - }, - { - "text": " wirst du" - } - ], - [ - { - "text": "mit einem " + "color": "#FFAA00" }, { - "text": "zufälligem Entity", - "color": "#AA00AA" + "text": " muss ein " }, { - "text": " aus" + "text": "zufälliger", + "color": "#FFAA00" } ], [ { - "text": "einem " + "text": "Spieler", + "color": "#FFAA00" }, { - "text": "200 Block", - "color": "#AA00AA" + "text": " eine " }, { - "text": " Radius " + "text": "Quizfrage", + "color": "#FFAA00" }, { - "text": "getauscht", - "color": "#AA00AA" + "text": " beantworten" } ] ], @@ -30123,8 +31600,8 @@ "text": " " }, { - "text": "Intervall = Tausch mit Mob", - "color": "#AA00AA" + "text": "Intervall = Quizfrage", + "color": "#FFAA00" } ], [ @@ -30139,43 +31616,33 @@ }, { "text": "paar Minuten", - "color": "#AA00AA" + "color": "#FFAA00" }, { - "text": " wirst du", - "color": "#AAAAAA" - } - ], - [ - { - "text": "mit einem ", + "text": " muss ein ", "color": "#AAAAAA" }, { - "text": "zufälligem Entity", - "color": "#AA00AA" - }, - { - "text": " aus", - "color": "#AAAAAA" + "text": "zufälliger", + "color": "#FFAA00" } ], [ { - "text": "einem ", - "color": "#AAAAAA" + "text": "Spieler", + "color": "#FFAA00" }, { - "text": "200 Block", - "color": "#AA00AA" + "text": " eine ", + "color": "#AAAAAA" }, { - "text": " Radius ", - "color": "#AAAAAA" + "text": "Quizfrage", + "color": "#FFAA00" }, { - "text": "getauscht", - "color": "#AA00AA" + "text": " beantworten", + "color": "#AAAAAA" } ] ] @@ -30183,63 +31650,54 @@ } }, { - "id": "inverthealth", + "id": "neverfullhearts", "category": "misc_challenge", "icon": { - "material": "POPPY" + "material": "GLISTERING_MELON_SLICE" }, "name": { - "en": "Interval = Hearts Flipped", - "de": "Intervall = Herzen umgedreht" + "en": "Full Hearts = Death", + "de": "Volle Herzen = Tod" }, "description": { "en": [ - "Every few minutes the hearts are inverted. If you have 8 hearts, you will have 2 hearts and the other way around" + "Never heal back to full hearts, your hunger always stays full" ], "de": [ - "Alle paar Minuten werden deine Herzen invertiert. Wenn du 8 Herzen hast, hast du danach 2 Herzen und umgekehrt." + "Heil dich nie auf volle Herzen, dein Hunger bleibt immer voll" ] }, "styled": { "en": { "name": [ { - "text": "Interval = Hearts Flipped", + "text": "Full Hearts = Death", "color": "#FF5555" } ], "description": [ [ { - "text": "Every few minutes the " + "text": "Never heal back to " }, { - "text": "hearts are inverted", + "text": "full hearts", "color": "#FF5555" }, { - "text": "." + "text": "," } ], [ { - "text": "If you have " + "text": "your " }, { - "text": "8 hearts", + "text": "hunger", "color": "#FF5555" }, { - "text": ", you will have " - }, - { - "text": "2 hearts", - "color": "#FF5555" - } - ], - [ - { - "text": "and the other way around" + "text": " always stays full" } ] ], @@ -30253,7 +31711,7 @@ "text": " " }, { - "text": "Interval = Hearts Flipped", + "text": "Full Hearts = Death", "color": "#FF5555" } ], @@ -30264,39 +31722,29 @@ ], [ { - "text": "Every few minutes the ", + "text": "Never heal back to ", "color": "#AAAAAA" }, { - "text": "hearts are inverted", + "text": "full hearts", "color": "#FF5555" }, { - "text": ".", + "text": ",", "color": "#AAAAAA" } ], [ { - "text": "If you have ", + "text": "your ", "color": "#AAAAAA" }, { - "text": "8 hearts", + "text": "hunger", "color": "#FF5555" }, { - "text": ", you will have ", - "color": "#AAAAAA" - }, - { - "text": "2 hearts", - "color": "#FF5555" - } - ], - [ - { - "text": "and the other way around", + "text": " always stays full", "color": "#AAAAAA" } ] @@ -30305,45 +31753,33 @@ "de": { "name": [ { - "text": "Intervall = Herzen umgedreht", + "text": "Volle Herzen = Tod", "color": "#FF5555" } ], "description": [ [ { - "text": "Alle paar Minuten werden deine " - }, - { - "text": "Herzen invertiert", - "color": "#FF5555" - }, - { - "text": "." - } - ], - [ - { - "text": "Wenn du " + "text": "Heil dich nie auf " }, { - "text": "8 Herzen", + "text": "volle Herzen", "color": "#FF5555" }, { - "text": " hast," + "text": "," } ], [ { - "text": "hast du danach " + "text": "dein " }, { - "text": "2 Herzen", + "text": "Hunger", "color": "#FF5555" }, { - "text": " und umgekehrt." + "text": " bleibt immer voll" } ] ], @@ -30357,7 +31793,7 @@ "text": " " }, { - "text": "Intervall = Herzen umgedreht", + "text": "Volle Herzen = Tod", "color": "#FF5555" } ], @@ -30368,43 +31804,29 @@ ], [ { - "text": "Alle paar Minuten werden deine ", - "color": "#AAAAAA" - }, - { - "text": "Herzen invertiert", - "color": "#FF5555" - }, - { - "text": ".", - "color": "#AAAAAA" - } - ], - [ - { - "text": "Wenn du ", + "text": "Heil dich nie auf ", "color": "#AAAAAA" }, { - "text": "8 Herzen", + "text": "volle Herzen", "color": "#FF5555" }, { - "text": " hast,", + "text": ",", "color": "#AAAAAA" } ], [ { - "text": "hast du danach ", + "text": "dein ", "color": "#AAAAAA" }, { - "text": "2 Herzen", + "text": "Hunger", "color": "#FF5555" }, { - "text": " und umgekehrt.", + "text": " bleibt immer voll", "color": "#AAAAAA" } ] @@ -30413,55 +31835,44 @@ } }, { - "id": "quiz", + "id": "nosamehearts", "category": "misc_challenge", "icon": { - "material": "WRITABLE_BOOK" + "material": "BEETROOT" }, "name": { - "en": "Interval = Quiz Question", - "de": "Intervall = Quizfrage" + "en": "Same Hearts = Death", + "de": "Gleiche Herzen = Tod" }, "description": { "en": [ - "Every few minutes a random player must answer a quiz question" + "No two players may ever have the same number of hearts" ], "de": [ - "Alle paar Minuten muss ein zufälliger Spieler eine Quizfrage beantworten" + "Niemand darf gleich viele Herzen wie ein anderer haben" ] }, "styled": { "en": { "name": [ { - "text": "Interval = Quiz Question", - "color": "#FFAA00" + "text": "Same Hearts = Death", + "color": "#FF55FF" } ], "description": [ [ { - "text": "Every " - }, - { - "text": "few minutes", - "color": "#FFAA00" - }, - { - "text": " a " - }, - { - "text": "random player", - "color": "#FFAA00" + "text": "No two players may ever" } ], [ { - "text": "must answer a " + "text": "have the " }, { - "text": "quiz question", - "color": "#FFAA00" + "text": "same number of hearts", + "color": "#FF55FF" } ] ], @@ -30475,8 +31886,8 @@ "text": " " }, { - "text": "Interval = Quiz Question", - "color": "#FFAA00" + "text": "Same Hearts = Death", + "color": "#FF55FF" } ], [ @@ -30486,30 +31897,18 @@ ], [ { - "text": "Every ", - "color": "#AAAAAA" - }, - { - "text": "few minutes", - "color": "#FFAA00" - }, - { - "text": " a ", + "text": "No two players may ever", "color": "#AAAAAA" - }, - { - "text": "random player", - "color": "#FFAA00" } ], [ { - "text": "must answer a ", + "text": "have the ", "color": "#AAAAAA" }, { - "text": "quiz question", - "color": "#FFAA00" + "text": "same number of hearts", + "color": "#FF55FF" } ] ] @@ -30517,41 +31916,23 @@ "de": { "name": [ { - "text": "Intervall = Quizfrage", - "color": "#FFAA00" + "text": "Gleiche Herzen = Tod", + "color": "#FF55FF" } ], "description": [ [ { - "text": "Alle " - }, - { - "text": "paar Minuten", - "color": "#FFAA00" - }, - { - "text": " muss ein " - }, - { - "text": "zufälliger", - "color": "#FFAA00" + "text": "Niemand darf gleich viele" } ], [ { - "text": "Spieler", - "color": "#FFAA00" - }, - { - "text": " eine " - }, - { - "text": "Quizfrage", - "color": "#FFAA00" + "text": "Herzen", + "color": "#FF55FF" }, { - "text": " beantworten" + "text": " wie ein anderer haben" } ] ], @@ -30565,8 +31946,8 @@ "text": " " }, { - "text": "Intervall = Quizfrage", - "color": "#FFAA00" + "text": "Gleiche Herzen = Tod", + "color": "#FF55FF" } ], [ @@ -30576,37 +31957,17 @@ ], [ { - "text": "Alle ", - "color": "#AAAAAA" - }, - { - "text": "paar Minuten", - "color": "#FFAA00" - }, - { - "text": " muss ein ", + "text": "Niemand darf gleich viele", "color": "#AAAAAA" - }, - { - "text": "zufälliger", - "color": "#FFAA00" } ], [ { - "text": "Spieler", - "color": "#FFAA00" - }, - { - "text": " eine ", - "color": "#AAAAAA" - }, - { - "text": "Quizfrage", - "color": "#FFAA00" + "text": "Herzen", + "color": "#FF55FF" }, { - "text": " beantworten", + "text": " wie ein anderer haben", "color": "#AAAAAA" } ] diff --git a/catalog/src/main/java/net/cyperia/challenges/catalog/CatalogExport.java b/catalog/src/main/java/net/cyperia/challenges/catalog/CatalogExport.java index d5eec4b10..c09b612b8 100644 --- a/catalog/src/main/java/net/cyperia/challenges/catalog/CatalogExport.java +++ b/catalog/src/main/java/net/cyperia/challenges/catalog/CatalogExport.java @@ -77,6 +77,11 @@ public static String render(@NotNull ChallengeCatalog catalog) { if (!challenge.registered()) continue; JsonObject json = new JsonObject(); json.addProperty("id", challenge.id()); + if (!challenge.fallbackIds().isEmpty()) { + JsonArray fallbackIds = new JsonArray(); + challenge.fallbackIds().forEach(fallbackIds::add); + json.add("fallbackIds", fallbackIds); + } json.addProperty("category", challenge.category()); json.add("icon", icon(challenge.icon())); if (challenge.featured()) json.addProperty("featured", true); @@ -92,6 +97,12 @@ public static String render(@NotNull ChallengeCatalog catalog) { built.addProperty("action", preset.action()); json.add("preset", built); } + if (challenge.pairing() != null) { + JsonObject pairing = new JsonObject(); + pairing.addProperty("trigger", challenge.pairing().trigger()); + pairing.addProperty("action", challenge.pairing().action()); + json.add("pairing", pairing); + } challenges.add(json); } diff --git a/catalog/src/main/java/net/cyperia/challenges/catalog/Challenge.java b/catalog/src/main/java/net/cyperia/challenges/catalog/Challenge.java index 5dc7877e1..3639d5c19 100644 --- a/catalog/src/main/java/net/cyperia/challenges/catalog/Challenge.java +++ b/catalog/src/main/java/net/cyperia/challenges/catalog/Challenge.java @@ -1,12 +1,20 @@ package net.cyperia.challenges.catalog; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -// id is the key the plugin saves the challenge's settings under, so it must never change; an entry that is -// not registered keeps a challenge the plugin does not offer (yet), for example one that is still broken -public record Challenge(@NotNull String id, @NotNull String key, @NotNull String category, @NotNull Icon icon, - @NotNull Definition definition, boolean excludeFromRandom, boolean featured, boolean registered, - @NotNull Release release) { +import java.util.List; + +// id is the key the plugin saves the challenge's settings under, fallbackIds are ids it was saved under before; +// an entry that is not registered keeps a challenge the plugin does not offer (yet), for example one that is still broken +public record Challenge(@NotNull String id, @NotNull List fallbackIds, @NotNull String key, @NotNull String category, + @NotNull Icon icon, @NotNull Definition definition, @Nullable Pairing pairing, boolean excludeFromRandom, + boolean featured, boolean registered, @NotNull Release release) { + + // The trigger and action a challenge with a class of its own plays at heart, its extra rules on top, so a custom + // challenge builder outside the plugin can point a player who builds that pairing to it + public record Pairing(@NotNull String trigger, @NotNull String action) { + } @NotNull public String nameKey() { diff --git a/catalog/src/main/java/net/cyperia/challenges/catalog/ChallengeCatalog.java b/catalog/src/main/java/net/cyperia/challenges/catalog/ChallengeCatalog.java index 3eb3b3a8f..48ac085de 100644 --- a/catalog/src/main/java/net/cyperia/challenges/catalog/ChallengeCatalog.java +++ b/catalog/src/main/java/net/cyperia/challenges/catalog/ChallengeCatalog.java @@ -22,10 +22,10 @@ public final class ChallengeCatalog { public static final String DIRECTORY = "challenges-catalog/"; - private static final Set CHALLENGE_FIELDS = Set.of("id", "key", "category", "icon", "color", "since", - "updated", "beta", "excludeFromRandom", "featured", "registered", "class", "requires", "preset", "damageRule", "materialRule"); + private static final Set CHALLENGE_FIELDS = Set.of("id", "fallbackIds", "key", "category", "icon", "color", "since", + "updated", "beta", "excludeFromRandom", "featured", "registered", "class", "requires", "pairing", "preset", "damageRule", "materialRule"); private static final Set DEFINITIONS = Set.of("class", "preset", "damageRule", "materialRule"); - private static final Set CLASS_ONLY = Set.of("requires"); + private static final Set CLASS_ONLY = Set.of("requires", "pairing"); private static final Set CUSTOM_SETTING_FIELDS = Set.of("id", "class", "icon", "color", "since", "updated", "beta", "fallbackIds"); @@ -47,7 +47,7 @@ public ChallengeCatalog(@NotNull List categories, @NotNull List challenge.definition() instanceof Definition.Implementation).toList(), challenge -> ((Definition.Implementation) challenge.definition()).className(), "challenge class"); @@ -103,6 +103,14 @@ public ChallengeCatalog requireComplete() { problems.add(challenge.id() + " is built from a beta trigger or action, so it has to be beta too"); } } + if (challenge.pairing() != null) { + if (!triggersById.containsKey(challenge.pairing().trigger())) { + problems.add(challenge.id() + " pairs the unknown trigger " + challenge.pairing().trigger()); + } + if (!actionsById.containsKey(challenge.pairing().action())) { + problems.add(challenge.id() + " pairs the unknown action " + challenge.pairing().action()); + } + } } if (!problems.isEmpty()) throw new IllegalStateException("Inconsistent challenge catalog:\n " + String.join("\n ", problems)); return this; @@ -134,6 +142,7 @@ public Optional category(@NotNull String id) { return Optional.ofNullable(categoriesById.get(id)); } + // Also finds a challenge by an id it was saved under before @NotNull public Optional challenge(@NotNull String id) { return Optional.ofNullable(challengesById.get(id)); @@ -178,11 +187,19 @@ private static Challenge challenge(@NotNull JsonObject json, @Nullable String cl case "damageRule" -> new Definition.DamageRule(strings(json, "damageRule")); default -> new Definition.MaterialRule(strings(json, "materialRule")); }; - return new Challenge(id, string(json, "key"), string(json, "category"), icon(json), definition, + return new Challenge(id, strings(json, "fallbackIds"), string(json, "key"), string(json, "category"), icon(json), definition, pairing(json), flag(json, "excludeFromRandom"), flag(json, "featured"), !json.has("registered") || json.get("registered").getAsBoolean(), release(json)); } + @Nullable + private static Challenge.Pairing pairing(@NotNull JsonObject challenge) { + if (!challenge.has("pairing")) return null; + JsonObject json = challenge.getAsJsonObject("pairing"); + requireFields(json, Set.of("trigger", "action")); + return new Challenge.Pairing(string(json, "trigger"), string(json, "action")); + } + @NotNull private static Definition.Preset preset(@NotNull JsonObject json) { requireFields(json, Set.of("trigger", "triggerSettings", "action", "actionSettings", "value")); @@ -287,6 +304,19 @@ private static Map index(@NotNull List entries, @NotNull Funct }, LinkedHashMap::new)); } + @NotNull + private static Map indexChallenges(@NotNull List challenges) { + Map byId = new LinkedHashMap<>(); + for (Challenge challenge : challenges) { + for (String id : Stream.concat(Stream.of(challenge.id()), challenge.fallbackIds().stream()).toList()) { + if (byId.putIfAbsent(id, challenge) != null) { + throw new IllegalArgumentException("Two catalog entries for the challenge " + id); + } + } + } + return byId; + } + @NotNull private static List concat(@NotNull List first, @NotNull List second) { return Stream.concat(first.stream(), second.stream()).toList(); diff --git a/catalog/src/main/resources/challenges-catalog/challenges.json b/catalog/src/main/resources/challenges-catalog/challenges.json index 6a21778a6..b3897100b 100644 --- a/catalog/src/main/resources/challenges-catalog/challenges.json +++ b/catalog/src/main/resources/challenges-catalog/challenges.json @@ -357,10 +357,15 @@ "category": "randomizer", "icon": "BEACON", "class": "challenge.randomizer.RandomItemChallenge", + "pairing": { + "trigger": "interval", + "action": "random_item" + }, "since": "2.0" }, { - "id": "preset-damage-random-item", + "id": "damage-random-item", + "fallbackIds": ["preset-damage-random-item"], "key": "damage-random-item", "category": "randomizer", "icon": "BEACON", @@ -373,7 +378,8 @@ "since": "3.0" }, { - "id": "preset-level-random-item", + "id": "level-random-item", + "fallbackIds": ["preset-level-random-item"], "key": "level-random-item", "category": "randomizer", "icon": "EXPERIENCE_BOTTLE", @@ -386,7 +392,8 @@ "since": "3.0" }, { - "id": "preset-advancement-random-item", + "id": "advancement-random-item", + "fallbackIds": ["preset-advancement-random-item"], "key": "advancement-random-item", "category": "randomizer", "icon": "KNOWLEDGE_BOOK", @@ -404,6 +411,10 @@ "category": "randomizer", "icon": "HOPPER_MINECART", "class": "challenge.randomizer.HotBarRandomizerChallenge", + "pairing": { + "trigger": "interval", + "action": "random_hotbar" + }, "since": "2.1.2" }, { @@ -412,6 +423,10 @@ "category": "randomizer", "icon": "DISPENSER", "class": "challenge.randomizer.RandomItemDroppingChallenge", + "pairing": { + "trigger": "interval", + "action": "drop_random_item" + }, "since": "2.0" }, { @@ -420,6 +435,10 @@ "category": "randomizer", "icon": "DROPPER", "class": "challenge.randomizer.RandomItemRemovingChallenge", + "pairing": { + "trigger": "interval", + "action": "remove_random_item" + }, "since": "2.0" }, { @@ -428,6 +447,10 @@ "category": "randomizer", "icon": "HOPPER", "class": "challenge.randomizer.RandomItemSwappingChallenge", + "pairing": { + "trigger": "interval", + "action": "swap_random_item" + }, "since": "2.0" }, { @@ -491,7 +514,8 @@ "beta": true }, { - "id": "preset-chunk-random-mob", + "id": "chunk-random-mob", + "fallbackIds": ["preset-chunk-random-mob"], "key": "chunk-random-mob", "category": "entities", "icon": "SPAWNER", @@ -512,7 +536,8 @@ "since": "2.1.3" }, { - "id": "preset-break-random-mob", + "id": "break-random-mob", + "fallbackIds": ["preset-break-random-mob"], "key": "break-random-mob", "category": "entities", "icon": "IRON_PICKAXE", @@ -525,7 +550,8 @@ "since": "3.0" }, { - "id": "preset-place-random-mob", + "id": "place-random-mob", + "fallbackIds": ["preset-place-random-mob"], "key": "place-random-mob", "category": "entities", "icon": "BRICKS", @@ -538,7 +564,8 @@ "since": "3.0" }, { - "id": "preset-craft-random-mob", + "id": "craft-random-mob", + "fallbackIds": ["preset-craft-random-mob"], "key": "craft-random-mob", "category": "entities", "icon": "CRAFTING_TABLE", @@ -557,10 +584,15 @@ "icon": "LEATHER_BOOTS", "color": "#008000", "class": "challenge.entities.NewEntityOnJumpChallenge", + "pairing": { + "trigger": "jump", + "action": "random_mob" + }, "since": "2.0" }, { - "id": "preset-damage-random-mob", + "id": "damage-random-mob", + "fallbackIds": ["preset-damage-random-mob"], "key": "damage-random-mob", "category": "entities", "icon": "BLAZE_SPAWN_EGG", @@ -573,7 +605,8 @@ "since": "3.0" }, { - "id": "preset-interval-random-mob", + "id": "interval-random-mob", + "fallbackIds": ["preset-interval-random-mob"], "key": "interval-random-mob", "category": "entities", "icon": "ZOMBIE_SPAWN_EGG", @@ -672,7 +705,11 @@ "category": "damage", "icon": "LEATHER_BOOTS", "color": "#FF0000", - "class": "challenge.damage.DamagePerBlockChallenge" + "class": "challenge.damage.DamagePerBlockChallenge", + "pairing": { + "trigger": "move_block", + "action": "damage" + } }, { "id": "sneakdamage", @@ -680,7 +717,11 @@ "category": "damage", "icon": "LEATHER_BOOTS", "color": "#FFFF00", - "class": "challenge.damage.SneakDamageChallenge" + "class": "challenge.damage.SneakDamageChallenge", + "pairing": { + "trigger": "sneak", + "action": "damage" + } }, { "id": "jumpdamage", @@ -689,6 +730,10 @@ "icon": "LEATHER_BOOTS", "color": "#FFA500", "class": "challenge.damage.JumpDamageChallenge", + "pairing": { + "trigger": "jump", + "action": "damage" + }, "since": "2.0" }, { @@ -696,7 +741,11 @@ "key": "block-break-damage", "category": "damage", "icon": "GOLDEN_PICKAXE", - "class": "challenge.damage.BlockBreakDamageChallenge" + "class": "challenge.damage.BlockBreakDamageChallenge", + "pairing": { + "trigger": "block_break", + "action": "damage" + } }, { "id": "blockplacedamage", @@ -704,6 +753,10 @@ "category": "damage", "icon": "GOLD_BLOCK", "class": "challenge.damage.BlockPlaceDamageChallenge", + "pairing": { + "trigger": "block_place", + "action": "damage" + }, "since": "2.0" }, { @@ -711,14 +764,22 @@ "key": "damage-item", "category": "damage", "icon": "SHEARS", - "class": "challenge.damage.DamagePerItemChallenge" + "class": "challenge.damage.DamagePerItemChallenge", + "pairing": { + "trigger": "pickup_item", + "action": "damage" + } }, { "id": "advancementdamage", "key": "advancement-damage", "category": "damage", "icon": "BOOK", - "class": "challenge.damage.AdvancementDamageChallenge" + "class": "challenge.damage.AdvancementDamageChallenge", + "pairing": { + "trigger": "advancement", + "action": "damage" + } }, { "id": "waterallergy", @@ -749,6 +810,10 @@ "category": "damage", "icon": "BLUE_ICE", "class": "challenge.damage.FreezeChallenge", + "pairing": { + "trigger": "damage", + "action": "freeze" + }, "since": "2.0.2" }, { @@ -765,6 +830,10 @@ "category": "effect", "icon": "BREWING_STAND", "class": "challenge.effect.RandomPotionEffectChallenge", + "pairing": { + "trigger": "interval", + "action": "random_effect" + }, "since": "2.0" }, { @@ -773,8 +842,20 @@ "category": "effect", "icon": "CAULDRON", "class": "challenge.effect.ChunkRandomEffectChallenge", + "pairing": { + "trigger": "new_chunk", + "action": "random_effect" + }, "since": "2.1.1" }, + { + "id": "biomeeffect", + "key": "biome-effect", + "category": "effect", + "icon": "MOSS_BLOCK", + "class": "challenge.effect.BiomeEffectChallenge", + "since": "3.1" + }, { "id": "blockeffect", "key": "block-effect", @@ -789,8 +870,20 @@ "category": "effect", "icon": "MAGMA_CREAM", "class": "challenge.effect.PermanentEffectOnDamageChallenge", + "pairing": { + "trigger": "damage", + "action": "permanent_effect" + }, "since": "2.0" }, + { + "id": "killeffect", + "key": "kill-effect", + "category": "effect", + "icon": "DRAGON_BREATH", + "class": "challenge.effect.KillEffectChallenge", + "since": "3.1" + }, { "id": "entityrandomeffect", "key": "entity-effect", @@ -812,6 +905,10 @@ "category": "world", "icon": "ENCHANTING_TABLE", "class": "challenge.world.LevelBorderChallenge", + "pairing": { + "trigger": "level_up", + "action": "modify_border" + }, "excludeFromRandom": true, "since": "2.2.3" }, @@ -832,6 +929,10 @@ "category": "world", "icon": "MAGENTA_GLAZED_TERRACOTTA", "class": "challenge.world.DamageBorderChallenge", + "pairing": { + "trigger": "damage", + "action": "modify_border" + }, "excludeFromRandom": true, "beta": true }, @@ -842,6 +943,10 @@ "category": "world", "icon": "PURPUR_BLOCK", "class": "challenge.world.ChunkRandomBlockChallenge", + "pairing": { + "trigger": "new_chunk", + "action": "chunk_to_block" + }, "beta": true }, { @@ -918,7 +1023,8 @@ "since": "2.0" }, { - "id": "preset-interval-border", + "id": "interval-border", + "fallbackIds": ["preset-interval-border"], "key": "interval-border", "category": "world", "icon": "PURPLE_GLAZED_TERRACOTTA", @@ -1096,6 +1202,10 @@ "category": "inventory", "icon": "DETECTOR_RAIL", "class": "challenge.inventory.MovementItemRemovingChallenge", + "pairing": { + "trigger": "move_block", + "action": "remove_random_item" + }, "since": "2.0" }, { @@ -1103,10 +1213,15 @@ "key": "damage-inv-clear", "category": "inventory", "icon": "CHEST", - "class": "challenge.inventory.DamageInventoryClearChallenge" + "class": "challenge.inventory.DamageInventoryClearChallenge", + "pairing": { + "trigger": "damage", + "action": "clear_inventory" + } }, { - "id": "preset-interval-clear-inventory", + "id": "interval-clear-inventory", + "fallbackIds": ["preset-interval-clear-inventory"], "key": "interval-clear-inventory", "category": "inventory", "icon": "TRAPPED_CHEST", @@ -1125,6 +1240,10 @@ "category": "inventory", "icon": "BOW", "class": "challenge.inventory.PickupItemLaunchChallenge", + "pairing": { + "trigger": "pickup_item", + "action": "boost_in_air" + }, "since": "2.0" }, { @@ -1157,8 +1276,40 @@ "category": "movement", "icon": "ACACIA_SLAB", "class": "challenge.movement.OnlyDownChallenge", + "pairing": { + "trigger": "move_up", + "action": "kill" + }, "since": "2.0" }, + { + "id": "onlyup", + "key": "only-up", + "category": "movement", + "icon": "LADDER", + "class": "challenge.movement.OnlyUpChallenge", + "pairing": { + "trigger": "move_down", + "action": "kill" + }, + "since": "3.1" + }, + { + "id": "levelteleport", + "key": "level-teleport", + "category": "movement", + "icon": "ENDER_PEARL", + "class": "challenge.movement.LevelTeleportChallenge", + "since": "3.1" + }, + { + "id": "onlyminecart", + "key": "only-minecart", + "category": "movement", + "icon": "MINECART", + "class": "challenge.movement.OnlyMinecartChallenge", + "since": "3.1" + }, { "id": "onlydirt", "key": "only-dirt", @@ -1180,6 +1331,10 @@ "category": "movement", "icon": "ROTTEN_FLESH", "class": "challenge.movement.HungerPerBlockChallenge", + "pairing": { + "trigger": "move_block", + "action": "hunger" + }, "since": "2.0" }, { @@ -1196,6 +1351,10 @@ "category": "movement", "icon": "COMPASS", "class": "challenge.movement.MoveMouseDamage", + "pairing": { + "trigger": "move_camera", + "action": "damage" + }, "since": "2.0" }, { @@ -1219,17 +1378,26 @@ "key": "water-mlg", "category": "extra_world", "icon": "WATER_BUCKET", - "class": "challenge.extraworld.WaterMLGChallenge" + "class": "challenge.extraworld.WaterMLGChallenge", + "pairing": { + "trigger": "interval", + "action": "water_mlg" + } }, { "id": "jumpandrun", "key": "jump-and-run", "category": "extra_world", "icon": "ACACIA_STAIRS", - "class": "challenge.extraworld.JumpAndRunChallenge" + "class": "challenge.extraworld.JumpAndRunChallenge", + "pairing": { + "trigger": "interval", + "action": "jnr" + } }, { - "id": "preset-no-eating", + "id": "no-eating", + "fallbackIds": ["preset-no-eating"], "key": "no-eating", "category": "misc_challenge", "icon": "COOKED_BEEF", @@ -1254,6 +1422,10 @@ "category": "misc_challenge", "icon": "CAKE", "class": "challenge.miscellaneous.FoodLaunchChallenge", + "pairing": { + "trigger": "consume_item", + "action": "boost_in_air" + }, "since": "2.0.2" }, { @@ -1268,7 +1440,11 @@ "key": "no-exp", "category": "misc_challenge", "icon": "EXPERIENCE_BOTTLE", - "class": "challenge.miscellaneous.NoExpChallenge" + "class": "challenge.miscellaneous.NoExpChallenge", + "pairing": { + "trigger": "gain_xp", + "action": "kill" + } }, { "id": "nosharedadvancements", @@ -1299,6 +1475,10 @@ "category": "misc_challenge", "icon": "CRAFTING_TABLE", "class": "challenge.inventory.UncraftItemsChallenge", + "pairing": { + "trigger": "interval", + "action": "uncraft_inventory" + }, "since": "2.0.2" }, { @@ -1315,6 +1495,10 @@ "category": "misc_challenge", "icon": "POPPY", "class": "challenge.miscellaneous.InvertHealthChallenge", + "pairing": { + "trigger": "interval", + "action": "invert_health" + }, "excludeFromRandom": true, "since": "2.0" }, @@ -1344,6 +1528,22 @@ "since": "2.0", "registered": false }, + { + "id": "neverfullhearts", + "key": "never-full-hearts", + "category": "misc_challenge", + "icon": "GLISTERING_MELON_SLICE", + "class": "challenge.miscellaneous.NeverFullHeartsChallenge", + "since": "3.1" + }, + { + "id": "nosamehearts", + "key": "no-same-hearts", + "category": "misc_challenge", + "icon": "BEETROOT", + "class": "challenge.miscellaneous.NoSameHeartsChallenge", + "since": "3.1" + }, { "id": "killenderdragon", "key": "goal-ender-dragon", diff --git a/catalog/src/test/java/net/cyperia/challenges/catalog/ChallengeCatalogTest.java b/catalog/src/test/java/net/cyperia/challenges/catalog/ChallengeCatalogTest.java index aa2ce2b7c..47e4856b6 100644 --- a/catalog/src/test/java/net/cyperia/challenges/catalog/ChallengeCatalogTest.java +++ b/catalog/src/test/java/net/cyperia/challenges/catalog/ChallengeCatalogTest.java @@ -54,12 +54,26 @@ void worldGeneratorsAreNeverPickedAtRandom() { @Test void readsAPresetWithItsValue() { - Definition.Preset preset = (Definition.Preset) bundled.challenge("preset-interval-border").orElseThrow().definition(); + Definition.Preset preset = (Definition.Preset) bundled.challenge("interval-border").orElseThrow().definition(); assertEquals("interval", preset.trigger()); assertEquals(Map.of("change", List.of("-1")), preset.actionSettings()); assertEquals(new Definition.Preset.Value("INTERVAL_MINUTES", 1, 10, 1), preset.value()); } + @Test + void readsThePairingAChallengePlays() { + assertEquals(new Challenge.Pairing("new_chunk", "chunk_to_block"), bundled.challenge("chunkrandomblock").orElseThrow().pairing()); + assertNull(bundled.challenge("cutclean").orElseThrow().pairing()); + } + + @Test + void rejectsAPairingOnAPreset(@TempDir Path dir) throws IOException { + assertRejected(dir, """ + {"challenges": [{"id": "a", "key": "a", "category": "c", "icon": "STONE", "pairing": {"trigger": "t", "action": "x"}, + "preset": {"trigger": "t", "triggerSettings": {}, "action": "x", "actionSettings": {}}}]} + """, "only apply to an entry with a class"); + } + @Test void readsRulesAndTintedIcons() { assertEquals(new Definition.DamageRule(List.of(Definition.DamageRule.EVERY_CAUSE)), @@ -67,6 +81,25 @@ void readsRulesAndTintedIcons() { assertEquals(new Icon("POTION", 0x0000FF), bundled.challenge("damageruledrowning").orElseThrow().icon()); } + @Test + void findsAChallengeByAnIdItHadBefore() { + assertEquals("interval-border", bundled.challenge("preset-interval-border").orElseThrow().id()); + } + + // A preset's id is how the plugin wires it, not something a player or a link should see + @Test + void noIdCarriesThePresetPrefix() { + bundled.challenges().forEach(challenge -> assertFalse(challenge.id().startsWith("preset-"), challenge.id())); + } + + @Test + void aModuleCannotReuseAFallbackId(@TempDir Path dir) throws IOException { + ChallengeCatalog module = load(dir, """ + {"package": "x", "challenges": [{"id": "preset-interval-border", "key": "a", "category": "utility", "icon": "STONE", "class": "A"}]} + """); + assertThrows(IllegalArgumentException.class, () -> bundled.merge(module)); + } + @Test void readsFallbackIdsOfTriggers() { assertEquals(List.of("intervall"), bundled.trigger("interval").orElseThrow().fallbackIds()); @@ -117,12 +150,14 @@ void completenessNamesEveryMissingReference(@TempDir Path dir) throws IOExceptio {"challenges": [ {"id": "a", "key": "a", "category": "nowhere", "icon": "STONE", "class": "A"}, {"id": "b", "key": "b", "category": "utility", "icon": "STONE", - "preset": {"trigger": "interval", "triggerSettings": {}, "action": "chunk_to_block", "actionSettings": {}}} + "preset": {"trigger": "interval", "triggerSettings": {}, "action": "chunk_to_block", "actionSettings": {}}}, + {"id": "c", "key": "c", "category": "utility", "icon": "STONE", "class": "C", "pairing": {"trigger": "nothing", "action": "kill"}} ]} """); IllegalStateException error = assertThrows(IllegalStateException.class, () -> bundled.merge(module).requireComplete()); assertTrue(error.getMessage().contains("a names the unknown category nowhere"), error.getMessage()); assertTrue(error.getMessage().contains("b is built from a beta trigger or action"), error.getMessage()); + assertTrue(error.getMessage().contains("c pairs the unknown trigger nothing"), error.getMessage()); } private static void assertRejected(Path dir, String challenges, String message) throws IOException { diff --git a/gradle.properties b/gradle.properties index 6cb49187f..efa0e14cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group=net.cyperia.challenges # Challenges' own release: plugin.yml, which drives the "new" badge, the SpigotMC update check and the # public builds -pluginVersion=3.0 +pluginVersion=3.1 # These sources leave out the beta challenges their catalog names publicRelease=true diff --git a/language/locales/de.json b/language/locales/de.json index 253f9d25f..3424bfdc4 100644 --- a/language/locales/de.json +++ b/language/locales/de.json @@ -1363,6 +1363,13 @@ "einen *zufälligen Effekt*" ] }, + "biome-effect": { + "name": "*Biom = Effekt*", + "desc": [ + "Jedes *Biom* gibt dir", + "einen *eigenen Effekt*" + ] + }, "block-effect": { "name": "*Neuer Block = Zufallseffekt*", "desc": [ @@ -2801,6 +2808,57 @@ "points": "{0} Punkte", "bossbar-height": "{@bossbar.format-arg('Ziel', 'Y: {0}')}", "leaderboard-entry": "{0} » {1} ┃ {2}" + }, + "kill-effect": { + "name": "*Kill = Effekt*", + "desc": [ + "Jeder *Kill* und jeder *Treffer* von", + "einem Mob gibt dir einen *Dauereffekt*" + ], + "new-effect": "Effekt {0} ➔ {1}", + "settings-desc": { + "everyone": "Alle erhalten den Effekt", + "player": "Nur der aktive Spieler erhält den Effekt" + } + }, + "only-up": { + "name": "*Nach unten = Tod*", + "desc": [ + "Du darfst nie *tiefer stehen*", + "als an deinem *höchsten Punkt*" + ], + "failed": "{0} ist zu tief gekommen", + "bossbar": "{@bossbar.format-arg('Mindesthöhe', 'Y: {0}')}" + }, + "level-teleport": { + "name": "*Level = Teleport*", + "desc": [ + "Du *kannst nicht laufen*, aber jedes", + "*Level* gibt dir eine *Enderperle*" + ] + }, + "never-full-hearts": { + "name": "*Volle Herzen = Tod*", + "desc": [ + "Heil dich nie auf *volle Herzen*,", + "dein *Hunger* bleibt immer voll" + ], + "failed": "{0} hatte volle Herzen" + }, + "no-same-hearts": { + "name": "*Gleiche Herzen = Tod*", + "desc": [ + "Niemand darf gleich viele", + "*Herzen* wie ein anderer haben" + ], + "failed": "{0} hat gleich viele Herzen wie {1}" + }, + "only-minecart": { + "name": "*Nur mit Minecart*", + "desc": [ + "Du sitzt die ganze Zeit in einer", + "*Lore* und *kommst nicht raus*" + ] } }, "custom": { @@ -3462,7 +3520,7 @@ ], "custom-challenges": "Die lokalen Challenges wurden erfolgreich zurückgesetzt", "config": "Die lokalen Einstellungen wurden erfolgreich zurückgesetzt", - "desc": "Setzt die Welt zurück, oder nur die Einstellungen oder die eigenen Challenges." + "description": "Setzt die Welt zurück, oder nur die Einstellungen oder die eigenen Challenges." }, "feature-disabled": "Diese Funktion ist derzeit deaktiviert", "database": { @@ -3473,39 +3531,39 @@ "customs-loaded": "Deine Challenges wurden erfolgreich geladen", "customs-saved": "Deine Challenges wurden erfolgreich gespeichert", "customs-reset": "Deine Challenges wurden erfolgreich zurückgesetzt", - "desc": "Speichert, lädt oder löscht deine Einstellungen und Challenges in der Datenbank." + "description": "Speichert, lädt oder löscht deine Einstellungen und Challenges in der Datenbank." }, "search": { "open": "Das Suchmenü wurde geöffnet", "query": "Das Suchmenü für {0} wird geöffnet..", - "desc": "Durchsucht die Einstellungen, Challenges und Ziele." + "description": "Durchsucht die Einstellungen, Challenges und Ziele." }, "no-target": "Es wurde kein Spieler gefunden", "heal": { "done": "Du wurdest geheilt", "done-others": "Du hast {0} Spieler geheilt", - "desc": "Heilt dich oder andere Spieler." + "description": "Heilt dich oder andere Spieler." }, "gamemode": { "done": "Du wurdest in den Gamemode {0} gesetzt", "done-others": "Du hast {1} Spieler in den Gamemode {0} gesetzt", - "desc": "Ändert deinen Spielmodus oder den anderer Spieler." + "description": "Ändert deinen Spielmodus oder den anderer Spieler." }, "village": { "searching": "Es wird nach einem Dorf gesucht..", "done": "Du wurdest in ein Dorf teleportiert", "none": "Es wurde kein neues Dorf gefunden", - "desc": "Teleportiert dich zu einem Dorf in der Nähe." + "description": "Teleportiert dich zu einem Dorf in der Nähe." }, "weather": { "clear": "Wetter zu klar geändert", "rain": "Wetter zu regnerisch geändert", "thunder": "Wetter zu stürmisch geändert", - "desc": "Ändert das Wetter." + "description": "Ändert das Wetter." }, "invsee": { "open": "Inventar von {0} geöffnet", - "desc": "Öffnet das Inventar eines anderen Spielers." + "description": "Öffnet das Inventar eines anderen Spielers." }, "time": { "done": "Die Zeit wurde auf {0} Ticks (ca. {1}) geändert", @@ -3519,38 +3577,38 @@ "night": "Nacht", "midnight": "Mitternacht", "day": "Tag", - "desc": "Stellt, ändert oder zeigt die Tageszeit." + "description": "Stellt, ändert oder zeigt die Tageszeit." }, "fly": { "enabled": "Du kannst nun fliegen", "disabled": "Du kannst nun nicht mehr fliegen", "done-others": "Du hast Fly für {0} Spieler verändert", - "desc": "Schaltet den Flugmodus für dich oder andere Spieler um." + "description": "Schaltet den Flugmodus für dich oder andere Spieler um." }, "feed": { "done": "Dein Hunger wurde gestillt", "done-others": "Du hast den Hunger von {0} Spieler *gestillt*", - "desc": "Füllt deinen Hunger oder den anderer Spieler auf." + "description": "Füllt deinen Hunger oder den anderer Spieler auf." }, "gamestate": { "reloaded": "Der Gamestate wurde neu geladen", "reset": "Der Gamestate wurde zurückgesetzt", - "desc": "Setzt den gespeicherten Fortschritt der Challenges zurück oder lädt ihn neu." + "description": "Setzt den gespeicherten Fortschritt der Challenges zurück oder lädt ihn neu." }, "world": { "done": "Du wirst in die Welt {0} teleportiert", "not-loaded": "Diese Welt ist nicht geladen", - "desc": "Teleportiert dich in die Oberwelt, den Nether oder das End." + "description": "Teleportiert dich in die Oberwelt, den Nether oder das End." }, "back": { "none": "Du hast dich noch nicht teleportiert", "done": "Du wurdest {0} Position zurück teleportiert", "done-multiple": "Du wurdest {0} Positionen zurück teleportiert", - "desc": "Teleportiert dich dorthin zurück, wo du vor einem Teleport warst." + "description": "Teleportiert dich dorthin zurück, wo du vor einem Teleport warst." }, "result": { "none": "Es ist aktuell kein Force-Battle aktiviert", - "desc": "Zeigt das Ergebnis des aktuellen Force Battles." + "description": "Zeigt das Ergebnis des aktuellen Force Battles." }, "god-mode": { "enabled": "Du bist nun im God-Mode", @@ -3560,7 +3618,7 @@ "goal": { "none": "Es ist kein Ziel aktiviert", "no-checklist": "Das Ziel {0} hat keine weiteren Informationen", - "desc": "Zeigt, was das aktuelle Ziel noch braucht und wer was gefunden hat." + "description": "Zeigt, was das aktuelle Ziel noch braucht und wer was gefunden hat." }, "randomizer": { "none": "Es ist kein Randomizer aktiviert", @@ -3576,100 +3634,100 @@ "shown": "{0}{1}{2} (siehe oben)", "none": "Es gibt keinen bekannten Weg zu {0}" }, - "desc": "Zeigt, wozu die aktiven Randomizer Blöcke, Rezepte und Mobs machen." + "description": "Zeigt, wozu die aktiven Randomizer Blöcke, Rezepte und Mobs machen." }, "help": { - "desc": "Zeigt, wer dieses Plugin entwickelt hat und wo du es bekommst." + "description": "Zeigt, wer dieses Plugin entwickelt hat und wo du es bekommst." }, "challenges": { - "desc": "Öffnet das Einstellungsmenü oder eines seiner Menüs." + "description": "Öffnet das Einstellungsmenü oder eines seiner Menüs." }, "timer": { - "desc": "Öffnet das Timer-Menü oder startet, pausiert und stellt den Timer." + "description": "Öffnet das Timer-Menü oder startet, pausiert und stellt den Timer." }, "start": { - "desc": "Startet den Timer." + "description": "Startet den Timer." }, "pause": { - "desc": "Pausiert den Timer." + "description": "Pausiert den Timer." }, "gms": { - "desc": "Wechselt in den Überlebensmodus." + "description": "Wechselt in den Überlebensmodus." }, "gmc": { - "desc": "Wechselt in den Kreativmodus." + "description": "Wechselt in den Kreativmodus." }, "gma": { - "desc": "Wechselt in den Abenteuermodus." + "description": "Wechselt in den Abenteuermodus." }, "gmsp": { - "desc": "Wechselt in den Zuschauermodus." + "description": "Wechselt in den Zuschauermodus." }, "sun": { - "desc": "Macht das Wetter klar." + "description": "Macht das Wetter klar." }, "rain": { - "desc": "Lässt es regnen." + "description": "Lässt es regnen." }, "thunder": { - "desc": "Startet ein Gewitter." + "description": "Startet ein Gewitter." }, "day": { - "desc": "Stellt die Zeit auf Tag." + "description": "Stellt die Zeit auf Tag." }, "night": { - "desc": "Stellt die Zeit auf Nacht." + "description": "Stellt die Zeit auf Nacht." }, "noon": { - "desc": "Stellt die Zeit auf Mittag." + "description": "Stellt die Zeit auf Mittag." }, "midnight": { - "desc": "Stellt die Zeit auf Mitternacht." + "description": "Stellt die Zeit auf Mitternacht." }, "skiptimer": { - "desc": "Überspringt die Timer der aktiven Challenges oder einer davon." + "description": "Überspringt die Timer der aktiven Challenges oder einer davon." }, "cancelinput": { - "desc": "Bricht die aktuelle Chateingabe ab." + "description": "Bricht die aktuelle Chateingabe ab." }, "teams": { - "desc": "Öffnet die Teamauswahl." + "description": "Öffnet die Teamauswahl." }, "godmode": { - "desc": "Macht dich oder andere Spieler unverwundbar." + "description": "Macht dich oder andere Spieler unverwundbar." }, "position": { - "desc": "Zeigt die gespeicherten Positionen oder speichert eine neue." + "description": "Zeigt die gespeicherten Positionen oder speichert eine neue." }, "delposition": { - "desc": "Löscht eine gespeicherte Position." + "description": "Löscht eine gespeicherte Position." }, "setposition": { - "desc": "Speichert eine Position an den angegebenen Koordinaten." + "description": "Speichert eine Position an den angegebenen Koordinaten." }, "top": { - "desc": "Teleportiert dich an die Oberfläche oder zurück in die Oberwelt." + "description": "Teleportiert dich an die Oberfläche oder zurück in die Oberwelt." }, "backpack": { - "desc": "Öffnet den Rucksack." + "description": "Öffnet den Rucksack." }, "enderchest": { - "desc": "Öffnet deine Enderkiste." + "description": "Öffnet deine Enderkiste." }, "setlanguage": { - "desc": "Ändert die Sprache des Plugins." + "description": "Ändert die Sprache des Plugins." }, "difficulty": { - "desc": "Zeigt oder ändert den Schwierigkeitsgrad." + "description": "Zeigt oder ändert den Schwierigkeitsgrad." }, "skipitem": { - "desc": "Überspringt das gesuchte Item." + "description": "Überspringt das gesuchte Item." }, "openmissingitems": { - "desc": "Öffnet das Menü der fehlenden Items erneut." + "description": "Öffnet das Menü der fehlenden Items erneut." }, "guess": { - "desc": "Beantwortet die Quizfrage." + "description": "Beantwortet die Quizfrage." } }, "server": { diff --git a/language/locales/en.json b/language/locales/en.json index f9a63d80a..e1bbd21ef 100644 --- a/language/locales/en.json +++ b/language/locales/en.json @@ -1361,6 +1361,13 @@ "a random *potion effect*" ] }, + "biome-effect": { + "name": "*Biome = Effect*", + "desc": [ + "Every *biome* gives you", + "its own *potion effect*" + ] + }, "block-effect": { "name": "*New Block = Random Effect*", "desc": [ @@ -2782,6 +2789,57 @@ "points": "{0} Points", "bossbar-height": "{@bossbar.format-arg('Goal', 'Y: {0}')}", "leaderboard-entry": "{0} » {1} ┃ {2}" + }, + "kill-effect": { + "name": "*Kill = Effect*", + "desc": [ + "Every *kill* and every *hit* from", + "a mob gives you a *permanent effect*" + ], + "new-effect": "Effect {0} ➔ {1}", + "settings-desc": { + "everyone": "All players are getting the effect", + "player": "Only the active player gets the effect" + } + }, + "only-up": { + "name": "*Go Down = Death*", + "desc": [ + "You may never *stand lower*", + "than the *highest* you have stood" + ], + "failed": "{0} went below their height", + "bossbar": "{@bossbar.format-arg('Lowest', 'Y: {0}')}" + }, + "level-teleport": { + "name": "*Level = Teleport*", + "desc": [ + "You *can't walk*, but every", + "*level* gives you an *ender pearl*" + ] + }, + "never-full-hearts": { + "name": "*Full Hearts = Death*", + "desc": [ + "Never heal back to *full hearts*,", + "your *hunger* always stays full" + ], + "failed": "{0} had full hearts" + }, + "no-same-hearts": { + "name": "*Same Hearts = Death*", + "desc": [ + "No two players may ever", + "have the *same number of hearts*" + ], + "failed": "{0} has as many hearts as {1}" + }, + "only-minecart": { + "name": "*Only Minecart*", + "desc": [ + "You sit in a *minecart* the", + "whole time and *can't get out*" + ] } }, "custom": { @@ -3443,7 +3501,7 @@ ], "custom-challenges": "The local custom challenges were reset successfully", "config": "The local settings were reset successfully", - "desc": "Resets the world, or only the settings or the custom challenges." + "description": "Resets the world, or only the settings or the custom challenges." }, "feature-disabled": "This function is currently deactivated", "database": { @@ -3454,39 +3512,39 @@ "customs-loaded": "Your challenges have been loaded successfully", "customs-saved": "Your challenges have been saved successfully", "customs-reset": "Your challenges were successfully reset", - "desc": "Saves, loads or deletes your settings and challenges in the database." + "description": "Saves, loads or deletes your settings and challenges in the database." }, "search": { "open": "You opened the search menu..", "query": "The search menu for {0} was opened..", - "desc": "Searches the settings, challenges and goals." + "description": "Searches the settings, challenges and goals." }, "no-target": "No players has been found", "heal": { "done": "You have been healed", "done-others": "You healed {0} player/s", - "desc": "Heals you or other players." + "description": "Heals you or other players." }, "gamemode": { "done": "Your gamemode has been changed to {0}", "done-others": "The gamemode of {1} player/s has been changed to {0}", - "desc": "Changes your game mode or that of other players." + "description": "Changes your game mode or that of other players." }, "village": { "searching": "A village is being searched..", "done": "You have been teleported to a village", "none": "No new village was found", - "desc": "Teleports you to a village nearby." + "description": "Teleports you to a village nearby." }, "weather": { "clear": "Weather was changed to clear", "rain": "Weather was changed to rainy", "thunder": "Weather was changed to thundery", - "desc": "Changes the weather." + "description": "Changes the weather." }, "invsee": { "open": "Inventory of {0} opened", - "desc": "Opens another player's inventory." + "description": "Opens another player's inventory." }, "time": { "done": "Time was changed to {0} Ticks (ca. {1})", @@ -3500,38 +3558,38 @@ "night": "Night", "midnight": "Midnight", "day": "Day", - "desc": "Sets, changes or shows the time of day." + "description": "Sets, changes or shows the time of day." }, "fly": { "enabled": "You can fly now", "disabled": "You can no longer fly", "done-others": "You toggled fly for {0} player/s", - "desc": "Toggles flight for you or other players." + "description": "Toggles flight for you or other players." }, "feed": { "done": "Your appetite was sated", "done-others": "You satiated the appetite of {0} player/s", - "desc": "Fills up your hunger or that of other players." + "description": "Fills up your hunger or that of other players." }, "gamestate": { "reloaded": "The gamestate was reloaded", "reset": "The gamestate was reset", - "desc": "Resets or reloads the saved progress of the challenges." + "description": "Resets or reloads the saved progress of the challenges." }, "world": { "done": "You'll be teleported into the {0}", "not-loaded": "This world is not loaded", - "desc": "Teleports you to the overworld, the nether or the end." + "description": "Teleports you to the overworld, the nether or the end." }, "back": { "none": "You weren't teleported yet", "done": "You were teleported {0} location back", "done-multiple": "You were teleported {0} locations back", - "desc": "Teleports you back to where you were before a teleport." + "description": "Teleports you back to where you were before a teleport." }, "result": { "none": "There is currently no Force Battle enabled", - "desc": "Shows the result of the current force battle." + "description": "Shows the result of the current force battle." }, "god-mode": { "enabled": "You are now in God mode", @@ -3541,7 +3599,7 @@ "goal": { "none": "No goal is enabled", "no-checklist": "The goal {0} has no additional information", - "desc": "Shows what the current goal still needs and who found what." + "description": "Shows what the current goal still needs and who found what." }, "randomizer": { "none": "No randomizer is enabled", @@ -3557,100 +3615,100 @@ "shown": "{0}{1}{2} (see above)", "none": "There is no known way to get {0}" }, - "desc": "Shows what the active randomizers turn blocks, recipes and mobs into." + "description": "Shows what the active randomizers turn blocks, recipes and mobs into." }, "help": { - "desc": "Shows who made this plugin and where to get it." + "description": "Shows who made this plugin and where to get it." }, "challenges": { - "desc": "Opens the settings menu, or one of its menus by name." + "description": "Opens the settings menu, or one of its menus by name." }, "timer": { - "desc": "Opens the timer menu, or starts, pauses and sets the timer." + "description": "Opens the timer menu, or starts, pauses and sets the timer." }, "start": { - "desc": "Starts the timer." + "description": "Starts the timer." }, "pause": { - "desc": "Pauses the timer." + "description": "Pauses the timer." }, "gms": { - "desc": "Switches to survival mode." + "description": "Switches to survival mode." }, "gmc": { - "desc": "Switches to creative mode." + "description": "Switches to creative mode." }, "gma": { - "desc": "Switches to adventure mode." + "description": "Switches to adventure mode." }, "gmsp": { - "desc": "Switches to spectator mode." + "description": "Switches to spectator mode." }, "sun": { - "desc": "Makes the weather clear." + "description": "Makes the weather clear." }, "rain": { - "desc": "Makes it rain." + "description": "Makes it rain." }, "thunder": { - "desc": "Starts a thunderstorm." + "description": "Starts a thunderstorm." }, "day": { - "desc": "Sets the time to day." + "description": "Sets the time to day." }, "night": { - "desc": "Sets the time to night." + "description": "Sets the time to night." }, "noon": { - "desc": "Sets the time to noon." + "description": "Sets the time to noon." }, "midnight": { - "desc": "Sets the time to midnight." + "description": "Sets the time to midnight." }, "skiptimer": { - "desc": "Skips the timers of the active challenges, or of one." + "description": "Skips the timers of the active challenges, or of one." }, "cancelinput": { - "desc": "Cancels the current chat input." + "description": "Cancels the current chat input." }, "teams": { - "desc": "Opens the team selection." + "description": "Opens the team selection." }, "godmode": { - "desc": "Makes you or other players invulnerable." + "description": "Makes you or other players invulnerable." }, "position": { - "desc": "Shows the saved positions or saves a new one." + "description": "Shows the saved positions or saves a new one." }, "delposition": { - "desc": "Deletes a saved position." + "description": "Deletes a saved position." }, "setposition": { - "desc": "Saves a position at the given coordinates." + "description": "Saves a position at the given coordinates." }, "top": { - "desc": "Teleports you to the surface or back to the overworld." + "description": "Teleports you to the surface or back to the overworld." }, "backpack": { - "desc": "Opens the backpack." + "description": "Opens the backpack." }, "enderchest": { - "desc": "Opens your ender chest." + "description": "Opens your ender chest." }, "setlanguage": { - "desc": "Changes the language of the plugin." + "description": "Changes the language of the plugin." }, "difficulty": { - "desc": "Shows or changes the difficulty." + "description": "Shows or changes the difficulty." }, "skipitem": { - "desc": "Skips the item you are looking for." + "description": "Skips the item you are looking for." }, "openmissingitems": { - "desc": "Opens the missing items menu again." + "description": "Opens the missing items menu again." }, "guess": { - "desc": "Answers the quiz question." + "description": "Answers the quiz question." } }, "server": { diff --git a/language/locales/global.json b/language/locales/global.json index 1d3c9e711..f2f735c0e 100644 --- a/language/locales/global.json +++ b/language/locales/global.json @@ -669,6 +669,9 @@ "chunk-effect": { "*colorize*": "{0}" }, + "biome-effect": { + "*colorize*": "{0}" + }, "block-effect": { "*colorize*": "{0}" }, @@ -1216,7 +1219,25 @@ "settings-modifier-strength": "{@generic.strength}: {0}", "settings-modifier-radius": "{@generic.radius}: {0}", "settings-modifier-damage": "{@generic.damage}: {0}", - "settings-modifier-max-health": "{@generic.max-health}: {0}" + "settings-modifier-max-health": "{@generic.max-health}: {0}", + "kill-effect": { + "*colorize*": "{0}" + }, + "only-up": { + "*colorize*": "{0}" + }, + "level-teleport": { + "*colorize*": "{0}" + }, + "never-full-hearts": { + "*colorize*": "{0}" + }, + "no-same-hearts": { + "*colorize*": "{0}" + }, + "only-minecart": { + "*colorize*": "{0}" + } }, "custom": { "trigger": { diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/Challenges.java b/plugin/src/main/java/net/cyperia/challenges/plugin/Challenges.java index 27d8c75c7..c29185664 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/Challenges.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/Challenges.java @@ -19,6 +19,7 @@ import net.cyperia.challenges.plugin.management.command.CommandManager; import net.cyperia.challenges.plugin.management.database.DatabaseManager; import net.cyperia.challenges.plugin.management.files.ConfigManager; +import net.cyperia.challenges.plugin.management.files.CreatorBuild; import net.cyperia.challenges.plugin.management.inventory.HotbarManager; import net.cyperia.challenges.plugin.management.menu.MenuManager; import net.cyperia.challenges.plugin.management.menu.search.SearchRegistry; @@ -96,6 +97,11 @@ private void checkConfig() { @Override protected void handleEnable() { + CreatorBuild creatorBuild = CreatorBuild.read(getClassLoader()); + if (creatorBuild != null) { + getLogger().info("Beta build " + creatorBuild.build() + " licensed to " + creatorBuild.creator() + ", not to be shared"); + } + enableManagers(); registerCommands(); diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/custom/settings/trigger/impl/NewChunkTrigger.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/custom/settings/trigger/impl/NewChunkTrigger.java index 323ed62c4..1ed848402 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/custom/settings/trigger/impl/NewChunkTrigger.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/custom/settings/trigger/impl/NewChunkTrigger.java @@ -1,5 +1,6 @@ package net.cyperia.challenges.plugin.challenges.custom.settings.trigger.impl; +import net.cyperia.challenges.catalog.Challenge; import net.cyperia.challenges.plugin.ChallengeAPI; import net.cyperia.challenges.plugin.Challenges; import net.cyperia.challenges.plugin.challenges.custom.TriggerActionChallenge; @@ -276,8 +277,9 @@ public void writeGameState(@NotNull Document document) { public void loadGameState(@NotNull Document document) { memories.clear(); - for (String uniqueName : document.keys()) { - Document challengeDocument = document.getDocument(uniqueName); + for (String savedName : document.keys()) { + Document challengeDocument = document.getDocument(savedName); + String uniqueName = Challenges.getInstance().getCatalog().challenge(savedName).map(Challenge::id).orElse(savedName); Memory memory = new Memory(new ChunkSet(), new HashMap<>()); memory.entered.loadGameState(challengeDocument, "entered-chunks"); diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallenge.java new file mode 100644 index 000000000..d40853fe8 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallenge.java @@ -0,0 +1,51 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.effect; + +import net.cyperia.challenges.plugin.challenges.type.abstraction.LocationEffectChallenge; +import net.cyperia.commons.common.collection.IRandom; +import net.cyperia.commons.common.collection.SeededRandomWrapper; +import org.bukkit.Location; +import org.bukkit.block.Biome; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.NotNull; + +import java.util.Arrays; + +public class BiomeEffectChallenge extends LocationEffectChallenge { + + // Biomes are large and slow to leave, so the effect stays at level I or II + static final int LEVELS = 2; + + // Read on first use: the effect registry only exists once a server runs + private PotionEffectType[] types; + + @Override + protected Biome regionAt(@NotNull Location location) { + return location.getBlock().getBiome(); + } + + @NotNull + @Override + protected PotionEffect effectFor(@NotNull Biome biome) { + if (types == null) { + types = Arrays.stream(PotionEffectType.values()).filter(BiomeEffectChallenge::fitsABiome).toArray(PotionEffectType[]::new); + } + Roll roll = roll(biome.getKey().toString(), worldSeed(), types.length); + return types[roll.type()].createEffect(PotionEffect.INFINITE_DURATION, roll.level()); + } + + // Instant effects would fire again every second for as long as a player stays in the biome, and an omen that never + // runs out either never resolves or starts a raid in the first village + private static boolean fitsABiome(@NotNull PotionEffectType type) { + return !type.isInstant() && !type.getKey().getKey().endsWith("_omen"); + } + + // Seeded by world and biome alone, so a restart keeps every biome's effect + static Roll roll(@NotNull String biomeKey, long worldSeed, int typeCount) { + IRandom random = new SeededRandomWrapper(worldSeed * 31 + biomeKey.hashCode()); + return new Roll(random.nextInt(typeCount), random.nextInt(LEVELS)); + } + + record Roll(int type, int level) {} + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/ChunkRandomEffectChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/ChunkRandomEffectChallenge.java index 4203a50ad..485520457 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/ChunkRandomEffectChallenge.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/ChunkRandomEffectChallenge.java @@ -1,126 +1,25 @@ package net.cyperia.challenges.plugin.challenges.implementation.challenge.effect; -import net.cyperia.challenges.plugin.ChallengeAPI; -import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; -import net.cyperia.challenges.plugin.management.scheduler.task.ScheduledTask; -import net.cyperia.challenges.plugin.management.scheduler.task.TimerTask; -import net.cyperia.challenges.plugin.management.scheduler.timer.TimerStatus; -import net.cyperia.challenges.plugin.spigot.events.PlayerIgnoreStatusChangeEvent; +import net.cyperia.challenges.plugin.challenges.type.abstraction.LocationEffectChallenge; import net.cyperia.commons.common.collection.IRandom; import net.cyperia.commons.common.collection.SeededRandomWrapper; import org.bukkit.Chunk; import org.bukkit.Location; -import org.bukkit.World.Environment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.NotNull; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class ChunkRandomEffectChallenge extends Setting { - - /* - * Saving potion effect to prevent the possibility that an effect remove was somehow skipped - */ - private Map currentPotionEffects = new HashMap<>(); - - private long worldSeed; +public class ChunkRandomEffectChallenge extends LocationEffectChallenge { @Override - protected void onEnable() { - currentPotionEffects = new HashMap<>(); - worldSeed = ChallengeAPI.getGameWorld(Environment.NORMAL).getSeed(); - broadcastFiltered(player -> { - addEffect(player, player.getLocation()); - }); + protected Chunk regionAt(@NotNull Location location) { + return location.getChunk(); } + @NotNull @Override - protected void onDisable() { - broadcastFiltered(player -> { - removeEffect(player, player.getLocation()); - }); - worldSeed = 0; - currentPotionEffects = null; - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void onGameModeChange(PlayerIgnoreStatusChangeEvent event) { - if (!shouldExecuteEffect()) return; - if (event.isIgnored()) { - removeEffect(event.getPlayer(), event.getPlayer().getLocation()); - } else { - addEffect(event.getPlayer(), event.getPlayer().getLocation()); - } - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void onMove(PlayerMoveEvent event) { - if (event.getTo() == null) return; - if (!shouldExecuteEffect(event.getPlayer())) return; - if (event.getTo().getChunk() == event.getFrom().getChunk()) return; - removeEffect(event.getPlayer(), event.getFrom()); - addEffect(event.getPlayer(), event.getTo()); - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void onTeleport(PlayerTeleportEvent event) { - if (event.getTo() == null) return; - if (!shouldExecuteEffect(event.getPlayer())) return; - if (event.getTo().getChunk() == event.getFrom().getChunk()) return; - removeEffect(event.getPlayer(), event.getFrom()); - addEffect(event.getPlayer(), event.getTo()); - } - - @ScheduledTask(ticks = 20, async = false) - public void onSecond() { - broadcastFiltered(player -> addEffect(player, player.getLocation())); - } - - @TimerTask(status = TimerStatus.PAUSED, async = false) - public void onTimerPause() { - broadcastFiltered(player -> removeEffect(player, player.getLocation())); - } - - @TimerTask(status = TimerStatus.RUNNING, async = false) - public void onTimerStart() { - broadcastFiltered(player -> addEffect(player, player.getLocation())); - } - - public void removeEffect(Player player, Location location) { - PotionEffectType type = getEffect(location.getChunk()).getType(); - player.removePotionEffect(type); - - removeEffectInCache(player); - } - - public void addEffect(Player player, Location location) { - Chunk chunk = location.getChunk(); - PotionEffect effect = getEffect(chunk); - - removeEffectInCache(player); - - if (player.hasPotionEffect(effect.getType())) return; - player.addPotionEffect(effect); - currentPotionEffects.put(player.getUniqueId(), effect); - } - - public void removeEffectInCache(Player player) { - PotionEffect currentEffect = currentPotionEffects.remove(player.getUniqueId()); - if (currentEffect != null) { - player.removePotionEffect(currentEffect.getType()); - } - } - - public PotionEffect getEffect(Chunk chunk) { - - IRandom random = new SeededRandomWrapper(worldSeed * ( + protected PotionEffect effectFor(@NotNull Chunk chunk) { + IRandom random = new SeededRandomWrapper(worldSeed() * ( (long) (chunk.getX() == 0 ? Integer.MAX_VALUE : chunk.getX()) * (chunk.getZ() == 0 ? Integer.MAX_VALUE : chunk.getZ()))); PotionEffectType[] types = PotionEffectType.values(); diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/KillEffectChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/KillEffectChallenge.java new file mode 100644 index 000000000..df053777a --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/KillEffectChallenge.java @@ -0,0 +1,34 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.effect; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDeathEvent; +import org.jetbrains.annotations.NotNull; + +public class KillEffectChallenge extends PermanentEffectOnDamageChallenge { + + @Override + protected boolean givesEffect(@NotNull EntityDamageEvent event) { + if (!(event instanceof EntityDamageByEntityEvent byEntity)) return false; + Entity damager = byEntity.getDamager(); + if (damager instanceof Projectile projectile && projectile.getShooter() instanceof Entity shooter) damager = shooter; + return damager instanceof LivingEntity && !(damager instanceof Player); + } + + @EventHandler(priority = EventPriority.HIGH) + public void onKill(@NotNull EntityDeathEvent event) { + Player killer = event.getEntity().getKiller(); + if (killer == null || killer == event.getEntity()) return; + if (!shouldExecuteEffect(killer)) return; + + addRandomEffect(killer); + updateEffects(); + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/PermanentEffectOnDamageChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/PermanentEffectOnDamageChallenge.java index 1bb47f454..3788193fc 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/PermanentEffectOnDamageChallenge.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/PermanentEffectOnDamageChallenge.java @@ -109,13 +109,17 @@ public void onPlayerDamage(@NotNull EntityDamageEvent event) { if (event.getFinalDamage() <= 0 && event.getDamage(DamageModifier.ABSORPTION) >= 0) return; if (!(event.getEntity() instanceof Player player)) return; if (!shouldExecuteEffect(player)) return; - DamageCause cause = event.getCause(); - if (cause == DamageCause.POISON || cause == DamageCause.WITHER) return; + if (!givesEffect(event)) return; addRandomEffect(player); updateEffects(); } + protected boolean givesEffect(@NotNull EntityDamageEvent event) { + DamageCause cause = event.getCause(); + return cause != DamageCause.POISON && cause != DamageCause.WITHER; + } + public void addRandomEffect(@NotNull Player eventPlayer) { PotionEffectType randomEffect = getNewRandomEffect(); if (randomEffect == null) return; diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallenge.java new file mode 100644 index 000000000..4c8f4fdea --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallenge.java @@ -0,0 +1,73 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.miscellaneous; + +import net.cyperia.challenges.plugin.ChallengeAPI; +import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; +import net.cyperia.challenges.plugin.challenges.type.helper.ChallengeHelper; +import net.cyperia.challenges.plugin.content.i18n.Prefix; +import net.cyperia.challenges.plugin.management.scheduler.task.ScheduledTask; +import net.cyperia.challenges.plugin.management.scheduler.task.TimerTask; +import net.cyperia.challenges.plugin.management.scheduler.timer.TimerStatus; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.jetbrains.annotations.NotNull; + +public class NeverFullHeartsChallenge extends Setting { + + // One heart below full, where the original starts + private static final double START_BELOW_FULL = 2; + + public NeverFullHeartsChallenge() { + setUsesGlobalPunish(true); + } + + static boolean isFull(double health, double maxHealth) { + return health >= maxHealth; + } + + @Override + protected void onEnable() { + if (ChallengeAPI.isStarted()) leaveFullHealth(); + } + + @TimerTask(status = TimerStatus.RUNNING, async = false) + public void onTimerStart() { + if (!isEnabled()) return; + leaveFullHealth(); + } + + // A full hunger bar keeps natural regeneration going; without saturation it heals at the slow rate + @ScheduledTask(ticks = 20, async = false) + public void onSecond() { + if (!shouldExecuteEffect()) return; + broadcastFiltered(player -> { + player.setFoodLevel(20); + player.setSaturation(0); + }); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onRegain(@NotNull EntityRegainHealthEvent event) { + if (!(event.getEntity() instanceof Player player)) return; + if (!shouldExecuteEffect(player)) return; + // The new health is only set once the event has passed + Bukkit.getScheduler().runTask(plugin, () -> check(player)); + } + + private void check(@NotNull Player player) { + if (!player.isOnline() || player.isDead() || !shouldExecuteEffect(player)) return; + if (!isFull(player.getHealth(), player.getMaxHealth())) return; + getChallengeMessageKey("failed").broadcast(Prefix.CHALLENGES, player); + ChallengeHelper.punish(player); + } + + private void leaveFullHealth() { + broadcastFiltered(player -> { + player.setSaturation(0); + if (isFull(player.getHealth(), player.getMaxHealth())) player.setHealth(player.getMaxHealth() - START_BELOW_FULL); + }); + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallenge.java new file mode 100644 index 000000000..32cbc8a5d --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallenge.java @@ -0,0 +1,95 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.miscellaneous; + +import net.cyperia.challenges.plugin.ChallengeAPI; +import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; +import net.cyperia.challenges.plugin.challenges.type.helper.ChallengeHelper; +import net.cyperia.challenges.plugin.content.i18n.Prefix; +import net.cyperia.challenges.plugin.management.scheduler.task.TimerTask; +import net.cyperia.challenges.plugin.management.scheduler.timer.TimerStatus; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class NoSameHeartsChallenge extends Setting { + + public NoSameHeartsChallenge() { + setUsesGlobalPunish(true); + } + + // What the health bar shows: a heart that is not empty counts as half + static int halfHearts(double health) { + return (int) Math.ceil(health); + } + + // Players start two hearts apart, since everyone joins with full health + static double startHealth(double maxHealth, int index) { + return Math.max(1, maxHealth - 4 * index); + } + + @Override + protected void onEnable() { + if (ChallengeAPI.isStarted()) spreadHealth(); + } + + @TimerTask(status = TimerStatus.RUNNING, async = false) + public void onTimerStart() { + if (!isEnabled()) return; + spreadHealth(); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onDamage(@NotNull EntityDamageEvent event) { + checkLater(event); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onRegain(@NotNull EntityRegainHealthEvent event) { + checkLater(event); + } + + private void checkLater(@NotNull EntityEvent event) { + if (!(event.getEntity() instanceof Player player)) return; + if (!shouldExecuteEffect(player)) return; + // The new health is only set once the event has passed + Bukkit.getScheduler().runTask(plugin, () -> check(player)); + } + + private void check(@NotNull Player player) { + if (!player.isOnline() || player.isDead() || !shouldExecuteEffect(player)) return; + int hearts = halfHearts(player.getHealth()); + for (Player other : alivePlayers()) { + if (other == player || halfHearts(other.getHealth()) != hearts) continue; + getChallengeMessageKey("failed").broadcast(Prefix.CHALLENGES, player, other); + ChallengeHelper.punish(player); + return; + } + } + + private void spreadHealth() { + List players = alivePlayers(); + for (int i = 0; i < players.size(); i++) { + Player player = players.get(i); + // Without saturation the first heals come slowly, so nobody catches up within the first seconds + player.setSaturation(0); + player.setHealth(Math.min(player.getHealth(), startHealth(player.getMaxHealth(), i))); + } + } + + @NotNull + private List alivePlayers() { + List players = new ArrayList<>(); + broadcastFiltered(player -> { + if (!player.isDead()) players.add(player); + }); + return players; + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallenge.java new file mode 100644 index 000000000..3c70d83ae --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallenge.java @@ -0,0 +1,91 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.movement; + +import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; +import net.cyperia.challenges.plugin.utils.misc.BlockUtils; +import net.cyperia.challenges.plugin.utils.misc.InventoryUtils; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityMountEvent; +import org.bukkit.event.entity.PiglinBarterEvent; +import org.bukkit.event.entity.VillagerAcquireTradeEvent; +import org.bukkit.event.player.PlayerLevelChangeEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.vehicle.VehicleEnterEvent; +import org.bukkit.event.world.LootGenerateEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class LevelTeleportChallenge extends Setting { + + static int pearlsFor(int oldLevel, int newLevel) { + return Math.max(0, newLevel - oldLevel); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onMove(@NotNull PlayerMoveEvent event) { + if (!shouldExecuteEffect(event.getPlayer())) return; + Location to = event.getTo(); + if (BlockUtils.isSameLocationIgnoreHeight(event.getFrom(), to)) return; + + // Falling and jumping stay possible, only the step to the side is taken back + Location target = event.getFrom().clone(); + target.setY(to.getY()); + target.setYaw(to.getYaw()); + target.setPitch(to.getPitch()); + event.setTo(target); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onLevelUp(@NotNull PlayerLevelChangeEvent event) { + if (!shouldExecuteEffect(event.getPlayer())) return; + int pearls = pearlsFor(event.getOldLevel(), event.getNewLevel()); + if (pearls == 0) return; + InventoryUtils.giveItem(event.getPlayer(), new ItemStack(Material.ENDER_PEARL, pearls)); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onVehicleEnter(@NotNull VehicleEnterEvent event) { + if (!(event.getEntered() instanceof Player player) || !shouldExecuteEffect(player)) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onMount(@NotNull EntityMountEvent event) { + if (!(event.getEntity() instanceof Player player) || !shouldExecuteEffect(player)) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGH) + public void onDeath(@NotNull EntityDeathEvent event) { + if (!shouldExecuteEffect()) return; + event.getDrops().removeIf(item -> item.getType() == Material.ENDER_PEARL); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onLoot(@NotNull LootGenerateEvent event) { + if (!shouldExecuteEffect()) return; + List loot = new ArrayList<>(event.getLoot()); + loot.removeIf(item -> item.getType() == Material.ENDER_PEARL); + event.setLoot(loot); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onBarter(@NotNull PiglinBarterEvent event) { + if (!shouldExecuteEffect()) return; + event.getOutcome().removeIf(item -> item.getType() == Material.ENDER_PEARL); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onTrade(@NotNull VillagerAcquireTradeEvent event) { + if (!shouldExecuteEffect()) return; + if (event.getRecipe().getResult().getType() == Material.ENDER_PEARL) event.setCancelled(true); + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyMinecartChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyMinecartChallenge.java new file mode 100644 index 000000000..e2d027045 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyMinecartChallenge.java @@ -0,0 +1,55 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.movement; + +import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; +import net.cyperia.challenges.plugin.management.scheduler.task.ScheduledTask; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Minecart; +import org.bukkit.entity.Player; +import org.bukkit.entity.Vehicle; +import org.bukkit.entity.minecart.RideableMinecart; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.vehicle.VehicleDamageEvent; +import org.bukkit.event.vehicle.VehicleDestroyEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; +import org.jetbrains.annotations.NotNull; + +public class OnlyMinecartChallenge extends Setting { + + // Puts back everyone who lost their cart: on start, after a respawn, after an ender pearl + @ScheduledTask(ticks = 20, async = false) + public void onSecond() { + if (!shouldExecuteEffect()) return; + broadcastFiltered(player -> { + if (player.isDead() || player.getVehicle() instanceof Minecart) return; + player.leaveVehicle(); + player.getWorld().spawn(player.getLocation(), RideableMinecart.class, cart -> cart.addPassenger(player)); + }); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onExit(@NotNull VehicleExitEvent event) { + if (!(event.getVehicle() instanceof Minecart)) return; + if (!(event.getExited() instanceof Player player) || !shouldExecuteEffect(player)) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onDamage(@NotNull VehicleDamageEvent event) { + if (carriesPlayer(event.getVehicle())) event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onDestroy(@NotNull VehicleDestroyEvent event) { + if (carriesPlayer(event.getVehicle())) event.setCancelled(true); + } + + private boolean carriesPlayer(@NotNull Vehicle vehicle) { + if (!(vehicle instanceof Minecart)) return false; + for (Entity passenger : vehicle.getPassengers()) { + if (passenger instanceof Player player && shouldExecuteEffect(player)) return true; + } + return false; + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallenge.java new file mode 100644 index 000000000..2e667dc15 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallenge.java @@ -0,0 +1,157 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.movement; + +import net.cyperia.challenges.plugin.ChallengeAPI; +import net.cyperia.challenges.plugin.challenges.type.abstraction.Setting; +import net.cyperia.challenges.plugin.challenges.type.helper.ChallengeHelper; +import net.cyperia.challenges.plugin.content.i18n.Prefix; +import net.cyperia.challenges.plugin.management.scheduler.task.TimerTask; +import net.cyperia.challenges.plugin.management.scheduler.timer.TimerStatus; +import net.cyperia.commons.common.config.Document; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.World.Environment; +import org.bukkit.block.Block; +import org.bukkit.block.Chest; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class OnlyUpChallenge extends Setting { + + enum Verdict { KEEP, RAISE, FAIL } + + // The room sits on the first layer that is never bedrock + private static final int FLOOR_ABOVE_MIN_HEIGHT = 5; + private static final int START_LOGS = 8; + + public OnlyUpChallenge() { + setUsesGlobalPunish(true); + } + + static Verdict check(@Nullable Integer lowest, int y) { + if (lowest == null || y > lowest) return Verdict.RAISE; + return y < lowest ? Verdict.FAIL : Verdict.KEEP; + } + + @Override + protected void onEnable() { + bossbar.setContent((bar, player) -> { + Integer lowest = lowest(player, player.getWorld()); + bar.setTitle(getChallengeMessageKey("bossbar"), lowest == null ? "-" : lowest); + }); + bossbar.show(); + if (ChallengeAPI.isStarted()) sendToStart(); + } + + @Override + protected void onDisable() { + bossbar.hide(); + } + + @TimerTask(status = TimerStatus.RUNNING, async = false) + public void onTimerStart() { + if (!isEnabled()) return; + sendToStart(); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onJoin(@NotNull PlayerJoinEvent event) { + if (!shouldExecuteEffect(event.getPlayer())) return; + if (!getGameStateData().getBoolean("started") || !heights(event.getPlayer()).keys().isEmpty()) return; + Location start = startRoom(); + if (start == null) return; + event.getPlayer().teleport(start); + setLowest(event.getPlayer(), start.getWorld(), start.getBlockY()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onRespawn(@NotNull PlayerRespawnEvent event) { + if (!isEnabled()) return; + heights(event.getPlayer()).remove(event.getRespawnLocation().getWorld().getName()); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onMove(@NotNull PlayerMoveEvent event) { + Player player = event.getPlayer(); + if (!shouldExecuteEffect(player)) return; + // Jumps and falls only count where they end, standing, swimming or climbing + if (!player.isOnGround() && !player.isInWater() && !player.isClimbing()) return; + + World world = event.getTo().getWorld(); + int y = event.getTo().getBlockY(); + Verdict verdict = check(lowest(player, world), y); + if (verdict == Verdict.KEEP) return; + if (verdict == Verdict.FAIL) { + getChallengeMessageKey("failed").broadcast(Prefix.CHALLENGES, player); + ChallengeHelper.punish(player); + } + setLowest(player, world, y); + } + + // Every player starts in the same small room at the bottom of the overworld, as in the original + private void sendToStart() { + if (getGameStateData().getBoolean("started")) return; + Location start = startRoom(); + if (start == null) return; + getGameStateData().set("started", true); + broadcastFiltered(player -> { + player.teleport(start); + setLowest(player, start.getWorld(), start.getBlockY()); + }); + } + + @Nullable + private Location startRoom() { + World world = ChallengeAPI.getGameWorld(Environment.NORMAL); + if (world == null) return null; + Location spawn = world.getSpawnLocation(); + int floor = world.getMinHeight() + FLOOR_ABOVE_MIN_HEIGHT; + Block center = world.getBlockAt(spawn.getBlockX(), floor + 1, spawn.getBlockZ()); + + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + for (int y = -1; y <= 3; y++) { + Block block = center.getRelative(x, y, z); + boolean inside = Math.abs(x) <= 1 && Math.abs(z) <= 1 && y >= 0 && y <= 2; + if (inside) { + if (block.getType() != Material.CHEST) block.setType(Material.AIR); + } else if (block.isPassable() || block.isLiquid()) { + block.setType(Material.DEEPSLATE); + } + } + } + } + + Block chestBlock = center.getRelative(1, 0, 1); + if (chestBlock.getType() != Material.CHEST) { + chestBlock.setType(Material.CHEST); + if (chestBlock.getState() instanceof Chest chest) chest.getBlockInventory().addItem(new ItemStack(Material.OAK_LOG, START_LOGS)); + } + + return center.getLocation().add(0.5, 0, 0.5); + } + + @Nullable + private Integer lowest(@NotNull Player player, @NotNull World world) { + Document heights = heights(player); + return heights.contains(world.getName()) ? heights.getInt(world.getName()) : null; + } + + private void setLowest(@NotNull Player player, @NotNull World world, int y) { + heights(player).set(world.getName(), y); + bossbar.update(player); + } + + @NotNull + private Document heights(@NotNull Player player) { + return getPlayerData(player.getUniqueId()); + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/AbstractChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/AbstractChallenge.java index 9297ae0ee..086ccb27d 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/AbstractChallenge.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/AbstractChallenge.java @@ -253,6 +253,12 @@ public String getUniqueName() { return getCatalogEntry().id(); } + @NotNull + @Override + public List getFallbackNames() { + return getCatalogEntry().fallbackIds(); + } + @Override public void handleShutdown() { } diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/LocationEffectChallenge.java b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/LocationEffectChallenge.java new file mode 100644 index 000000000..c72e09036 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/challenges/type/abstraction/LocationEffectChallenge.java @@ -0,0 +1,115 @@ +package net.cyperia.challenges.plugin.challenges.type.abstraction; + +import net.cyperia.challenges.plugin.ChallengeAPI; +import net.cyperia.challenges.plugin.management.scheduler.task.ScheduledTask; +import net.cyperia.challenges.plugin.management.scheduler.task.TimerTask; +import net.cyperia.challenges.plugin.management.scheduler.timer.TimerStatus; +import net.cyperia.challenges.plugin.spigot.events.PlayerIgnoreStatusChangeEvent; +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.potion.PotionEffect; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public abstract class LocationEffectChallenge extends Setting { + + // Only effects this challenge gave are taken away again, never a potion the player drank themselves + private Map givenEffects = new HashMap<>(); + private long worldSeed; + + @NotNull + protected abstract R regionAt(@NotNull Location location); + + @NotNull + protected abstract PotionEffect effectFor(@NotNull R region); + + protected long worldSeed() { + return worldSeed; + } + + @Override + protected void onEnable() { + givenEffects = new HashMap<>(); + worldSeed = ChallengeAPI.getGameWorld(Environment.NORMAL).getSeed(); + broadcastFiltered(player -> update(player, player.getLocation())); + } + + @Override + protected void onDisable() { + broadcastFiltered(this::clear); + givenEffects = null; + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onIgnoreStatusChange(PlayerIgnoreStatusChangeEvent event) { + if (!shouldExecuteEffect()) return; + if (event.isIgnored()) clear(event.getPlayer()); + else update(event.getPlayer(), event.getPlayer().getLocation()); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onMove(PlayerMoveEvent event) { + moved(event.getPlayer(), event.getFrom(), event.getTo()); + } + + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onTeleport(PlayerTeleportEvent event) { + moved(event.getPlayer(), event.getFrom(), event.getTo()); + } + + @EventHandler(priority = EventPriority.LOW) + public void onQuit(PlayerQuitEvent event) { + // An infinite effect is saved with the player, so one left on would come back untracked after a rejoin + if (givenEffects != null) clear(event.getPlayer()); + } + + // Puts back an effect the player lost another way, by milk or death + @ScheduledTask(ticks = 20, async = false) + public void onSecond() { + broadcastFiltered(player -> update(player, player.getLocation())); + } + + @TimerTask(status = TimerStatus.PAUSED, async = false) + public void onTimerPause() { + broadcastFiltered(this::clear); + } + + @TimerTask(status = TimerStatus.RUNNING, async = false) + public void onTimerStart() { + broadcastFiltered(player -> update(player, player.getLocation())); + } + + private void moved(@NotNull Player player, @NotNull Location from, Location to) { + if (to == null || !shouldExecuteEffect(player)) return; + if (regionAt(from).equals(regionAt(to))) return; + update(player, to); + } + + private void update(@NotNull Player player, @NotNull Location location) { + PotionEffect effect = effectFor(regionAt(location)); + PotionEffect given = givenEffects.get(player.getUniqueId()); + // Also when only the level differs, which a neighbouring region with the same effect type can roll + if (given != null && !given.equals(effect)) { + player.removePotionEffect(given.getType()); + givenEffects.remove(player.getUniqueId()); + } + if (player.hasPotionEffect(effect.getType())) return; + player.addPotionEffect(effect); + givenEffects.put(player.getUniqueId(), effect); + } + + private void clear(@NotNull Player player) { + PotionEffect given = givenEffects.remove(player.getUniqueId()); + if (given != null) player.removePotionEffect(given.getType()); + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManager.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManager.java index 6442a2b6d..d1eb3be28 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManager.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManager.java @@ -134,8 +134,8 @@ public synchronized void loadSettings(@NotNull Document config) { for (IChallenge challenge : challenges) { if (challenge instanceof CustomChallenge) continue; - String name = challenge.getUniqueName(); - if (!config.contains(name)) continue; + String name = savedName(config, challenge.getUniqueName(), challenge.getFallbackNames()); + if (name == null) continue; try { Document document = config.getDocument(name); challenge.loadSettings(document); @@ -150,8 +150,8 @@ public synchronized void loadGamestate(@NotNull Document config) { LinkedList list = new LinkedList<>(additionalSaver); list.addAll(challenges); for (GamestateSaveable challenge : list) { - String name = challenge.getUniqueGamestateName(); - if (!config.contains(name)) continue; + String name = savedName(config, challenge.getUniqueGamestateName(), challenge.getFallbackNames()); + if (name == null) continue; try { Document document = config.getDocument(name); challenge.loadGameState(document); @@ -204,6 +204,7 @@ public void saveGameStateInto(@NotNull Document config) { try { Document document = config.getDocument(challenge.getUniqueGamestateName()); challenge.writeGameState(document); + challenge.getFallbackNames().forEach(config::remove); } catch (Exception ex) { Logger.error("Could not write gamestate of {}", challenge.getClass().getSimpleName(), ex); } @@ -222,6 +223,7 @@ public void saveSettingsInto(@NotNull Document config) { try { Document document = config.getDocument(challenge.getUniqueGamestateName()); challenge.writeSettings(document); + challenge.getFallbackNames().forEach(config::remove); } catch (Exception ex) { Logger.error("Could not write settings of {}", challenge.getClass().getSimpleName(), ex); } @@ -256,6 +258,13 @@ public synchronized void saveLocalCustomChallenges(boolean async) { } + // The key something was saved under in config: its name, else an id it had before + @Nullable + static String savedName(@NotNull Document config, @NotNull String name, @NotNull List fallbackIds) { + if (config.contains(name)) return name; + return fallbackIds.stream().filter(config::contains).findFirst().orElse(null); + } + @Nullable public IGoal getCurrentGoal() { return currentGoal; diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/entities/GamestateSaveable.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/entities/GamestateSaveable.java index cd5184e1a..db59db637 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/entities/GamestateSaveable.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/challenges/entities/GamestateSaveable.java @@ -3,10 +3,18 @@ import net.cyperia.commons.common.config.Document; import org.jetbrains.annotations.NotNull; +import java.util.List; + public interface GamestateSaveable { String getUniqueGamestateName(); + // Names its settings and game state were saved under before a rename, read when the current one is missing + @NotNull + default List getFallbackNames() { + return List.of(); + } + void writeGameState(@NotNull Document document); void loadGameState(@NotNull Document document); diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandCaseListener.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandCaseListener.java new file mode 100644 index 000000000..a61f51324 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandCaseListener.java @@ -0,0 +1,48 @@ +package net.cyperia.challenges.plugin.management.command; + +import com.mojang.brigadier.tree.CommandNode; +import org.bukkit.command.CommandSender; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.server.ServerCommandEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Supplier; + +final class CommandCaseListener implements Listener { + + private static final String NAMESPACE = "challenges:"; + + private final Supplier> tree; + + CommandCaseListener(@NotNull Supplier> tree) { + this.tree = tree; + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerCommand(@NotNull PlayerCommandPreprocessEvent event) { + String normalized = normalize(event.getMessage().substring(1)); + if (normalized != null) event.setMessage("/" + normalized); + } + + @EventHandler(priority = EventPriority.LOWEST) + public void onServerCommand(@NotNull ServerCommandEvent event) { + String normalized = normalize(event.getCommand()); + if (normalized != null) event.setCommand(normalized); + } + + @Nullable + private String normalize(@NotNull String command) { + CommandNode root = tree.get(); + if (root == null) return null; + boolean namespaced = command.regionMatches(true, 0, NAMESPACE, 0, NAMESPACE.length()); + String body = namespaced ? command.substring(NAMESPACE.length()) : command; + String normalized = LiteralCase.normalize(root, body); + if (normalized.equals(body)) return null; + return namespaced ? NAMESPACE + normalized : normalized; + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandInfo.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandInfo.java index d1e34da7a..a33e0a70b 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandInfo.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandInfo.java @@ -41,7 +41,7 @@ public CommandInfo asGeneric() { @NotNull public String getDescriptionKey() { - return "command." + literal + ".desc"; + return "command." + literal + ".description"; } } diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandManager.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandManager.java index 60dff1e53..048b9da23 100644 --- a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandManager.java +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/CommandManager.java @@ -1,5 +1,7 @@ package net.cyperia.challenges.plugin.management.command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.tree.CommandNode; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; @@ -20,6 +22,8 @@ public final class CommandManager { private final List commands = new ArrayList<>(); private CommandRegistrar registrar; private boolean registeredWithPaper; + // Only set while the commands are registered with Paper; through a registrar its handler matches case + private CommandNode literalTree; /** * Paper builds its dispatcher once every plugin is enabled, so a registrar set by another plugin's @@ -28,15 +32,19 @@ public final class CommandManager { public void enable(@NotNull Plugin plugin) { plugin.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, event -> { if (registrar != null) return; + CommandDispatcher literals = new CommandDispatcher<>(); for (ChallengeCommand command : commands) { try { registerWithPaper(event.registrar(), command); + registerLiterals(literals, command); } catch (RuntimeException ex) { Logger.error("Could not register the command /{}", command.info().getLiteral(), ex); } } + literalTree = literals.getRoot(); registeredWithPaper = true; }); + plugin.getServer().getPluginManager().registerEvents(new CommandCaseListener(() -> registrar == null ? literalTree : null), plugin); } public void register(@NotNull ChallengeCommand command) { @@ -69,6 +77,18 @@ private static void registerWithPaper(@NotNull Commands registrar, @NotNull Chal registrar.register(root.build(), description, info.getAliases()); } + // The same tree on Bukkit's sender, only read for the spelling of the literals + static void registerLiterals(@NotNull CommandDispatcher dispatcher, @NotNull ChallengeCommand command) { + CommandNodes nodes = new CommandNodes<>(sender -> sender); + List names = new ArrayList<>(List.of(command.info().getLiteral())); + names.addAll(command.info().getAliases()); + for (String name : names) { + var root = nodes.literal(name); + nodes.define(command, root); + dispatcher.register(root); + } + } + // /execute as run ... acts for the player, as the commands did when they were Bukkit commands @NotNull static CommandSender senderOf(@NotNull CommandSourceStack source) { diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/LiteralCase.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/LiteralCase.java new file mode 100644 index 000000000..4443f15e1 --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/command/LiteralCase.java @@ -0,0 +1,50 @@ +package net.cyperia.challenges.plugin.management.command; + +import com.mojang.brigadier.tree.CommandNode; +import com.mojang.brigadier.tree.LiteralCommandNode; +import org.jetbrains.annotations.NotNull; + +/** + * Brigadier matches literals by exact string, so {@code /Timer START} would be unknown. This turns + * the leading literals of an input into the spelling of the tree and stops at the first token that + * is not one, so argument values like player names keep their case. + */ +final class LiteralCase { + + private LiteralCase() { + } + + @NotNull + static String normalize(@NotNull CommandNode root, @NotNull String input) { + CommandNode node = root; + StringBuilder result = new StringBuilder(input.length()); + int cursor = 0; + while (cursor < input.length()) { + while (cursor < input.length() && input.charAt(cursor) == ' ') { + result.append(' '); + cursor++; + } + int start = cursor; + while (cursor < input.length() && input.charAt(cursor) != ' ') { + cursor++; + } + if (start == cursor) break; + + CommandNode match = literal(node, input.substring(start, cursor)); + if (match == null) { + return result.append(input, start, input.length()).toString(); + } + result.append(match.getName()); + node = match; + } + return result.toString(); + } + + private static CommandNode literal(@NotNull CommandNode node, @NotNull String token) { + for (CommandNode child : node.getChildren()) { + if (child instanceof LiteralCommandNode && child.getName().equalsIgnoreCase(token)) return child; + } + return null; + } + +} diff --git a/plugin/src/main/java/net/cyperia/challenges/plugin/management/files/CreatorBuild.java b/plugin/src/main/java/net/cyperia/challenges/plugin/management/files/CreatorBuild.java new file mode 100644 index 000000000..dfdc566bb --- /dev/null +++ b/plugin/src/main/java/net/cyperia/challenges/plugin/management/files/CreatorBuild.java @@ -0,0 +1,33 @@ +package net.cyperia.challenges.plugin.management.files; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +// Only a beta build handed to one content creator carries this resource +public record CreatorBuild(@NotNull String creator, @NotNull String build) { + + public static final String RESOURCE = "creator-build.properties"; + + @Nullable + public static CreatorBuild read(@NotNull ClassLoader loader) { + try (InputStream in = loader.getResourceAsStream(RESOURCE)) { + return in == null ? null : parse(in); + } catch (IOException ex) { + return null; + } + } + + @Nullable + static CreatorBuild parse(@NotNull InputStream in) throws IOException { + Properties properties = new Properties(); + properties.load(in); + String creator = properties.getProperty("creator"); + String build = properties.getProperty("build"); + return creator == null || build == null ? null : new CreatorBuild(creator, build); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallengeTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallengeTest.java new file mode 100644 index 000000000..4a5f16bef --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/effect/BiomeEffectChallengeTest.java @@ -0,0 +1,50 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.effect; + +import org.junit.jupiter.api.Test; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class BiomeEffectChallengeTest { + + private static final List BIOMES = List.of( + "minecraft:plains", "minecraft:desert", "minecraft:forest", "minecraft:taiga", "minecraft:swamp", + "minecraft:jungle", "minecraft:savanna", "minecraft:badlands", "minecraft:ocean", "minecraft:river", + "minecraft:snowy_plains", "minecraft:mushroom_fields", "minecraft:cherry_grove", "minecraft:dark_forest"); + private static final int TYPES = 33; + + @Test + void aBiomeRollsTheSameEffectEveryTime() { + assertEquals(BiomeEffectChallenge.roll("minecraft:plains", 42, TYPES), BiomeEffectChallenge.roll("minecraft:plains", 42, TYPES)); + } + + @Test + void anotherWorldRollsAnotherSet() { + assertNotEquals(rolls(42), rolls(1337)); + } + + @Test + void biomesGetDifferentEffects() { + Set types = BIOMES.stream().map(biome -> BiomeEffectChallenge.roll(biome, 42, TYPES).type()).collect(Collectors.toSet()); + assertTrue(types.size() > BIOMES.size() / 2, "effects spread over the biomes: " + types); + } + + @Test + void rollsStayInsideTheEffectsAndLevels() { + for (String biome : BIOMES) { + BiomeEffectChallenge.Roll roll = BiomeEffectChallenge.roll(biome, -7_000_000_000L, TYPES); + assertTrue(roll.type() >= 0 && roll.type() < TYPES); + assertTrue(roll.level() >= 0 && roll.level() < BiomeEffectChallenge.LEVELS); + } + } + + private static List rolls(long seed) { + return BIOMES.stream().map(biome -> BiomeEffectChallenge.roll(biome, seed, TYPES)).toList(); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallengeTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallengeTest.java new file mode 100644 index 000000000..f26c54ae4 --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NeverFullHeartsChallengeTest.java @@ -0,0 +1,22 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.miscellaneous; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class NeverFullHeartsChallengeTest { + + @Test + void fullHealthIsFull() { + assertTrue(NeverFullHeartsChallenge.isFull(20, 20)); + assertTrue(NeverFullHeartsChallenge.isFull(40, 40)); + } + + @Test + void halfAHeartShortIsNotFull() { + assertFalse(NeverFullHeartsChallenge.isFull(19, 20)); + assertFalse(NeverFullHeartsChallenge.isFull(19.9, 20)); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallengeTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallengeTest.java new file mode 100644 index 000000000..5eb6e7bf5 --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/miscellaneous/NoSameHeartsChallengeTest.java @@ -0,0 +1,33 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.miscellaneous; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +class NoSameHeartsChallengeTest { + + @Test + void aStartedHalfHeartCountsAsOne() { + assertEquals(7, NoSameHeartsChallenge.halfHearts(6.3)); + assertEquals(NoSameHeartsChallenge.halfHearts(6.1), NoSameHeartsChallenge.halfHearts(6.9)); + } + + @Test + void wholeHalfHeartsStayApart() { + assertNotEquals(NoSameHeartsChallenge.halfHearts(6), NoSameHeartsChallenge.halfHearts(7)); + } + + @Test + void playersStartTwoHeartsApart() { + assertEquals(20, NoSameHeartsChallenge.startHealth(20, 0)); + assertEquals(16, NoSameHeartsChallenge.startHealth(20, 1)); + assertEquals(12, NoSameHeartsChallenge.startHealth(20, 2)); + } + + @Test + void theStartNeverKills() { + assertEquals(1, NoSameHeartsChallenge.startHealth(20, 8)); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallengeTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallengeTest.java new file mode 100644 index 000000000..892cc0634 --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/LevelTeleportChallengeTest.java @@ -0,0 +1,21 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.movement; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class LevelTeleportChallengeTest { + + @Test + void everyLevelGainedIsOnePearl() { + assertEquals(1, LevelTeleportChallenge.pearlsFor(0, 1)); + assertEquals(3, LevelTeleportChallenge.pearlsFor(4, 7)); + } + + @Test + void losingLevelsGivesNothing() { + assertEquals(0, LevelTeleportChallenge.pearlsFor(30, 27)); + assertEquals(0, LevelTeleportChallenge.pearlsFor(5, 0)); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallengeTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallengeTest.java new file mode 100644 index 000000000..827d7c684 --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/challenges/implementation/challenge/movement/OnlyUpChallengeTest.java @@ -0,0 +1,30 @@ +package net.cyperia.challenges.plugin.challenges.implementation.challenge.movement; + +import net.cyperia.challenges.plugin.challenges.implementation.challenge.movement.OnlyUpChallenge.Verdict; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class OnlyUpChallengeTest { + + @Test + void theFirstHeightIsTheStart() { + assertEquals(Verdict.RAISE, OnlyUpChallenge.check(null, -58)); + } + + @Test + void standingHigherRaisesTheHeight() { + assertEquals(Verdict.RAISE, OnlyUpChallenge.check(-58, -57)); + } + + @Test + void standingOnTheSameHeightIsFine() { + assertEquals(Verdict.KEEP, OnlyUpChallenge.check(12, 12)); + } + + @Test + void standingLowerFails() { + assertEquals(Verdict.FAIL, OnlyUpChallenge.check(12, 11)); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManagerTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManagerTest.java new file mode 100644 index 000000000..96b4b77ad --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/management/challenges/ChallengeManagerTest.java @@ -0,0 +1,33 @@ +package net.cyperia.challenges.plugin.management.challenges; + +import net.cyperia.commons.common.config.Document; +import net.cyperia.commons.common.config.document.GsonDocument; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +class ChallengeManagerTest { + + @Test + void findsSettingsSavedUnderAFallbackId() { + Document config = new GsonDocument().set("preset-no-eating", new GsonDocument().set("enabled", true)); + assertEquals("preset-no-eating", ChallengeManager.savedName(config, "no-eating", List.of("preset-no-eating"))); + } + + @Test + void prefersTheCurrentId() { + Document config = new GsonDocument() + .set("preset-no-eating", new GsonDocument().set("enabled", true)) + .set("no-eating", new GsonDocument().set("enabled", false)); + assertEquals("no-eating", ChallengeManager.savedName(config, "no-eating", List.of("preset-no-eating"))); + } + + @Test + void nothingSaved() { + assertNull(ChallengeManager.savedName(new GsonDocument(), "no-eating", List.of("preset-no-eating"))); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/management/command/LiteralCaseTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/management/command/LiteralCaseTest.java new file mode 100644 index 000000000..6101a5d0a --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/management/command/LiteralCaseTest.java @@ -0,0 +1,52 @@ +package net.cyperia.challenges.plugin.management.command; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.tree.CommandNode; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class LiteralCaseTest { + + private static final ChallengeCommand TIMER = new ChallengeCommand() { + @NotNull + @Override + public CommandInfo info() { + return CommandInfo.command("timer", "timer").withAliases("t"); + } + + @Override + public void define(@NotNull LiteralArgumentBuilder root, @NotNull CommandNodes nodes) { + root.then(nodes.literal("start")) + .then(nodes.literal("set").then(nodes.argument("time", StringArgumentType.greedyString()))); + } + }; + + private static CommandNode tree() { + CommandDispatcher dispatcher = new CommandDispatcher<>(); + CommandManager.registerLiterals(dispatcher, TIMER); + return dispatcher.getRoot(); + } + + @Test + void literalsTakeTheSpellingOfTheTree() { + assertEquals("timer start", LiteralCase.normalize(tree(), "Timer START")); + assertEquals("t start", LiteralCase.normalize(tree(), "T Start")); + } + + @Test + void argumentsKeepTheirCase() { + assertEquals("timer set 1H 30Min", LiteralCase.normalize(tree(), "TIMER Set 1H 30Min")); + } + + @Test + void unknownInputIsLeftAlone() { + assertEquals("Weather Clear", LiteralCase.normalize(tree(), "Weather Clear")); + assertEquals("timer start ", LiteralCase.normalize(tree(), "timer START ")); + } + +} diff --git a/plugin/src/test/java/net/cyperia/challenges/plugin/management/files/CreatorBuildTest.java b/plugin/src/test/java/net/cyperia/challenges/plugin/management/files/CreatorBuildTest.java new file mode 100644 index 000000000..00d1e29d5 --- /dev/null +++ b/plugin/src/test/java/net/cyperia/challenges/plugin/management/files/CreatorBuildTest.java @@ -0,0 +1,35 @@ +package net.cyperia.challenges.plugin.management.files; + +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +class CreatorBuildTest { + + private static InputStream text(String text) { + return new ByteArrayInputStream(text.getBytes(StandardCharsets.ISO_8859_1)); + } + + @Test + void readsTheCreatorAndTheBuild() throws IOException { + assertEquals(new CreatorBuild("SouFake", "0a1b2c3d4e5f"), CreatorBuild.parse(text("creator=SouFake\nbuild=0a1b2c3d4e5f\nissued=2026-10-21\n"))); + } + + @Test + void ignoresIncompleteMarks() throws IOException { + assertNull(CreatorBuild.parse(text("creator=SouFake\n"))); + assertNull(CreatorBuild.parse(text(""))); + } + + @Test + void aRegularBuildHasNoMarks() { + assertNull(CreatorBuild.read(new ClassLoader(null) {})); + } + +}