Skip to content

Requirements

broken1arrow edited this page Jun 19, 2022 · 15 revisions

Requirement setup

# Open_requirement:
# View_requirement:
# Right_click_requirement:
# Shift_left_click_requirement:
# Shift_right_click_requirement:
# Click_requirement:
# Middle_click_requirement:
Left_click_requirement:
  Requirement:
    # you can set several requirements but every one
    # need to be unique named.
    require_name:
      # what type you want to check (look lower down on the site for options)
      # for example "has permission" or "has item".
      type: type of requirement.
      # set it to true if it optional requirement.
      optional_requirement: true
      # if you set it success_commands and/or deny_commands every requirement it will get executed
      # for all requirements you have set.
      # Don´t confuse this with the different click commands
      # this get executed if requirement return true.
      success_commands:
        "[ACTION] your command or message here"
      # This will be executed if this requirement return false.
      deny_commands:
        "[ACTION] your command or message here"
    # stop on first requirement some return true.
    stop_at_success: true
    # number of requirement some need return true.
    # only works if optional_requirement is set to true.
    minimum_requirement: 1
    # only works with click requirement and open.
    deny_commands:
      - "[ACTION] your command or message here"
# This is all types of clicks corresponding to the requirement
Click_commands:
  - '[message] &6Anny button trigger this'
Left_click_commands:
  - '[message] &7Left click'
Right_click_commands:
  - '[message] &4Right click'
Left_shift_click_commands:
  - '[message] &4Left and shift click'
Right_shift_click_commands:
  - '[message] &4Right and shift click '
# Is not working in newer minecraft versions (1.18+)
Middle_click_commands:
  - '[message] &7Middle click'

Requirements info

Type Description
Open requirement Requirements for open menu
View requirement Requirements for view the item
Click requirement Requirements shift,right and left click the item

Requirements options

When inverting requirements you need most use quotes, because ! is a special symbol in yaml. Like this: type: "!has item"

Check if player has permission

if you want to check if player not have permission, set it up like this "!has permission".

type: has permission
permission: type your permission here

Check if player has item

If you want to check if player not have the item, set it up like this "!has item".

type: has item
item:
  # the item type you can also use placeholders.
  Icon: STONE
  # amount player need to have.
  Amount: 1
  # old method to set modeldata or color (like for wool).
  Data: 1
  # new method to set modeldata.
  Modeldata: 1
  # Instead of use data for set colors, you can use this option.
  # Is made for old minecraft versions. Only needed if you set 
  # STAINED_GLASS in Icon instead of GREEN_STAINED_GLASS.
  Material_color: GREEN
  #Set rbg color for some items (like potions and fireworks), is in this order red;green,blue.
  Rpg: 38,192,21
  # when you use portions.
  Potion_effects:
    #Effect on the potion.
    Fast_digging:
      # time before effect get removed.
      duration: 5
      # how strong the effect shall be.
      amplifier: 5
  # enchants the item shall have.
  Enchantments:
    # the enchantment name (can be small or big letters).
    SILK_TOUCH:
    level: 1
    # If it shall bypass level restriction (like for example silk touch only have level 1,
    # but you can override that to any level you want).
    level_restriction: true
  # Use this if you want set more complex data on fireworks (more an colors).
  FireWork_effect:
    #List of colors you want to set on item, use this format #,#,#. Is in this order red;green,blue.
    Colors:
      - "38,10,21"
      - "150,58,0"
    #List of fade colors on this item. 
    Fade_colors:
      - "38,10,21"
      - "150,58,0"
    # type of effect like BALL or CREEPER.
    Type: ball
    # if the item shall have flicker or not.
    Flicker: false
    # if the item shall have trail or not.
    Trail: true
  # For banners, to set patterns on the banner. 
  # Support several patterns on same item.
  Banner_pattern:
    CIRCLE_MIDDLE: RED
  # Hide enchants on a item.
  Hide_item_flags:
    - HIDE_ENCHANTS
  # Compare agist material only. If player have same item
  # but have lore, display name or modeldata. It will not 
  # considered as same item you set here.  
  Strict: true
  # Check offhand for items
  Off_hand: false
  # Check armor slots for items
  Armor_slots: false
  # Check if display name contains text you have set.
  Name_contains: true
  # Check if display name equals text you have set.
  Name_equals: false
  # Check if display name equals text you have set, but not care about case.
  Name_ignorecase: false
  # Check if lore contains text you have set.
  Lore_contains: true
  # Check if lore equals text you have set.
  Lore_equals: false
  # Check if lore equals text you have set, but not care about case.
  Lore_ignorecase: false

Check if player has experiences

If you want to check if player not have enough experiences, set it up like this "!has item".

type: has experience
# numbers of levels or experience player needed.
amount: 5
# set it to true if you want to check levels instead of experiences.
level: false

Javascript

You can use javascript also. You can only use code some return boolean. For this to work you need ether set libraries: [org.openjdk.nashorn:nashorn-core:15.4] in plugin.yml or download the javascript plugin here https://github.com/broken1arrow/NashornPlusAPI/releases

type: javascript
expression: '%vault_eco_balance% >= 400'

Check if player has money

Check if player has money, only works if you have vault installed.

type: has money
amount: 50

Comparators

Compare two values. Support placeholders.

type: (==, >=, <=, !=, >, <)
input: number
output: number
Comparator Description
== input: equals to output
>= input: greater than or equals to output
<= input: less than or equals to output
!= input: not equals to output
> input: input: greater than output
< input: less than output

String contains

Check if String contains the text in output. To invert it type: "!string contains"

type: string contains
input: "some text"
output: "text you compare against"

Example like this:

type: string contains
input: %player_name%
output: "broken"

String equals ignorecase

Check if String equals the text in output, but ignore case. To invert it type: "!string equals ignorecase"

type: string equals ignorecase
input: "some text"
output: "text you compare against"

Example like this:

type: string equals ignorecase
input: %player_name%
output: "Broken_ArroW"

String equals

Check if String equals the text in output. To invert it type: "!string equals"

type: string equals
input: "some text"
output: "text you compare against"

Example like this:

type: string equals
input: %player_name%
output: "broken_arrow"

Clone this wiki locally