Has Sections

These are different sections within an item with requirements, to determine which item should be displayed and used.

How to use a section

Sections can be added to items easily by using one of the sections at the bottom of the page. For an example check the script below that has an item.

'20':
  material: RED_WOOL
  name: "Your username is not RockyHawk"
  has0:
    value0: RockyHawk
    compare0: '%cp-player-name%'
    material: LIME_WOOL
    name: "Your username is RockyHawk"
    has0:
      value0: '%cp-player-name% HASPERM'
      compare0: gamemode.creative
      material: BLACK_WOOL
      name: "Your username is RockyHawk AND you can do /gamemode"
    has1:
      value0: '%cp-player-name% HASPERM'
      compare0: essentials.fly
      material: BLACK_WOOL
      name: "Your username is RockyHawk AND you can do /fly"

Different Sections

The above item has a default section (fallback item), which is a Red Wool, the main section with two inner sections inside of the other main section. As you can see, the first section will only be displayed if the player's name is RockyHawk, otherwise, it will show the Red Wool. The has section inside of the main section will therefore only be checked if the player's name is RockyHawk. You will need to use the regular item settings like 'material' in a section because if the section is deemed to be the one that is used, there needs to be an item that can be created.

Multiple Sections in one location

As you may have noticed, inside of the first section above, there are two inner sections. They cannot have identical names if they are in the same section, so you will need to designate different numbers to them, eg, has0 and has1. If both sections can be used, the plugin will prioritise the section with the smallest number.

Any items only containing an item section without anything outside it will not work. There always needs to be a default fallback material outside of any sections.

Section Arguments

OR

You can use the OR operator if you wish to compare two different values. The output will be true if only one of the two values is equal to the compare word. As you can see below the Gold Block will show up if the player's name is RockyHawk OR if the player's name is TinyTank800.

The OR operator can also go in the place of where the AND operator goes, after the end of one condition and the next.

has0:
  value0: 'RockyHawk OR TinyTank800 OR Notch'
  compare0: '%cp-player-name%'
  material: GOLD_BLOCK

NOT

The NOT operator can be used when you simply want the reverse effect to happen. Take the below example, if the player's name is NOT RockyHawk it will show the Gold Block.

has0:
  value0: 'NOT RockyHawk'
  compare0: '%cp-player-name%'
  material: GOLD_BLOCK

AND

This is used if you want to check and make sure multiple arguments are true. This is the reason why value0 and compare0 have zero's at the end. If you wish to have another argument, you can use value1 and compare1 too. It will always read the lowest number first. The example below will only be true if the player has at least 500 dollars AND that the player's name is RockyHawk.

has0:
  value0: '%cp-player-balance% ISGREATER'
  compare0: '500 AND'
  value1: '%cp-player-name%'
  compare1: 'RockyHawk'

Permissions

This will be used to check if a player has a certain permission. You can change the player's name to anything if you don't want to check permission for the player using the panel.

has0:
  value0: '%cp-player-name% HASPERM'
  compare0: essentials.gamemode

Compare Values

Will show the section if one value equals another. It will compare the value inside ofvalue0and the value inside ofcompare0to check if they are identical. It will not parse colours.

has0:
  value0: RockyHawk
  compare0: '%cp-player-name%'

Is Greater

This is used to check if a number is equal or higher. The example below will become true if the player's balance is 500 or higher.

has0:
  value0: '%cp-player-balance% ISGREATER'
  compare0: 500

Last updated