Skip to content

#5 Supported Plugins

zThana edited this page Oct 29, 2024 · 2 revisions

Thank you to Venion for the example below.

# The following is a brief tutorial/example of how to set up a racial trait through ConditionalEvents using
# Races of Thana and PlaceholderAPI. This specific example is one that allows the Goblin race to go invisible for a while after they
# have been sneaking in the dark.
# First we give our event a name, this must be unique from other event names listed in our CE config.yml
GoblinSneak:
  # The type is repetitive, which means it will constantly check if the given conditions are true
  type: repetitive
  # If we use the repetitive type event we must also specify a repetitive time. This is in ticks, so for example in this event
  # the conditions are checked every 40 ticks, equal to every 2 seconds.
  repetitive_time: 40
  # Now we list our conditions
  conditions:
    # First we're going to check that the player is, in fact, a member of the Goblin race. Make sure to put the race in all-caps.
    - '%racesofthana_player_race% equals GOBLIN'
    # Next we'll check that the light level where the player is located is under a certain amount.
    - '%player_light_level% < 5'
    # Finally we check that the player is sneaking.
    - '%player_is_sneaking% equals true'
  # If all of these conditions are met, our actions will be carried out, defined below
  actions:
    default:
      - 'give_potion_effect: INVISIBILITY;200;1'

# For more information on the different conditions and actions you can use, check out the CE wiki:
# https://ajneb97.gitbook.io/conditionalevents
# Also you can check that your placeholders give the output you expect by using the parse commands listed on the PlaceholderAPI page

You can also perform actions when a player changes their race. Thank you to Cosilla for providing this example:

  race_change_event:
    type: custom
    custom_event_data:
      event: com.zthana.racesofthana.events.RaceChangeEvent  
      player_variable: getPlayer()  
      variables_to_capture:
      - '%old_race%;getOldRace()'
      - '%new_race%;getNewRace()'
    actions:
      default:
      - 'message: &eThis is a test message for you.' 

Note that if you'll only be running commands, you could also use the built-in commands section for each race:

commands:
  enabled: true
  change:
    - bc %player_name% became a(n) %player_race_displayname%!
Clone this wiki locally