Customized Discoveries Tutorial

In this section I will explain you how to use my plugin ConditionalEvents with Codex. ConditionalEvents allows you to assign multiple conditions to a certain event and execute different actions. For example, if a player pickups an item or clicks on a button, something configurable will happen.

So, with my plugin ConditionalEvents you can create as many Codex discoveries you want. Let's suppose you want players to unlock a discovery when they consume an item, for example eat an apple. We create the category first:

name: "&c&lFood"
discover_title:
  title: "&c&lCODEX UPDATED"
  subtitle: "&7Food: %name%"
  fade_in: 20
  stay: 60
  fade_out: 20
discover_message:
- "{centered}&f&m00                                                 00"
- " "
- "{centered}&c&lCODEX UPDATED"
- "{centered}&7Food: %name%"
- " "
- "{centered}&7Check it now by using &e/codex"
- " "
- "{centered}&f&m00                                                 00"
discover_sound:
  name: BLOCK_GILDED_BLACKSTONE_STEP
  volume: 10
  pitch: 0.1
discoveries:
  1:
    name: "&a&lMystery Apple"
    lore:
    - "&7A mysterious apple found in the cave of"
    - "&7Gashmii. It will give you Strength II for"
    - "&730 seconds."

As you can see we have created just one discovery in the category of "Food" (the name of the file could be food.yml). Now we proceed to create an event with ConditionalEvents:

mystery_apple_eat:
    type: item_consume
    conditions:
    - '%item% equals APPLE'
    - '%item_name% equals Mystery Apple'
    actions:
      default:
      - 'give_potion_effect: INCREASE_DAMAGE;600;2'
      - 'console_command: codex unlock %player% food 1'

This event will check if a player tries to eat an Apple called "Mystery Apple". If so, the Strength potion effect will be given to the player for 600 ticks (30 seconds) and the /codex unlock %player% food 1 command will be executed from the console. This will unlock the discovery we have created for the player. If the player eats a Mystery Apple again, the same command will be executed but nothing will happen since the player has already unlocked the discovery.

The same you can do with multiple events you want. If you are interested on my plugin ConditionalEvents you can check the wiki: CLICK HERE

Last updated