Tutorial: (Method) On Off Switch - ssomar1607/ExecutableItems GitHub Wiki

Tutorial to how to make an on/off system on your ei item

REQUIREMENTS

  • Placeholder API
    • Luckperms Expansion
  • Luckperms
  • ExecutableItems Premium

1) Decide what dummy permission are you going to use

  • If it's just a casual on/off switch method, I recommend thinking of a permission that does nothing to make sure it doesn't trigger any installed plugin's features. Let's say, we will use the permission zt.e.

2) Create what type of activator you are going to use

  • Let's use the PLAYER_ALL_CLICK activator for an example.

3) Add the command

  • The important part of this is the command to give the player the permission.

4) Add the placeholder condition

  • This is needed to control what activator is going to run. Why not ifHasPermission condition? So I can use it properly even if I am opped.
  • Don't forget to set the type to PLAYER_STRING for it to work properly.
  • What this placeholder does is it checks if you have the permission or not. It does not matter if it's set to true or false. As long as you have the permission, it will print an output of yes.
  • Why no? Because in the first place, you don't have the permission actually. So if you run the activator, the permission command runs, giving you the said permission making the activator unable to run the activator again because when you run the %luckperms_has_permission_zt.e% placeholder, it will print the output of yes instead of the value of what we need which is no.

5) Add the 2nd activator

  • Let's use the PLAYER_ALL_CLICK activator for an example again.

6) Add the command

  • The important part of this is the command to remove the permission from the player. This will be explained later.

7) Add the placeholder condition

  • Don't forget to set the type to PLAYER_STRING for it to work properly.
  • Why yes? Since you have the permission because you activated the first activator once, when the placeholder %luckperms_has_permission_zt.e% runs, it will return the value of yes, which is what we are trying to accomplish, this activator may run now since you have the permission given from the first activator. If this 2nd activator runs, it will run the command from this. When the command runs, it will remove the permission from you and when the placeholder %luckperms_has_permission_zt.e% runs, it will return the value of no instead of the value that the placeholder needs to run the activator which is yes.

8) Save the ei item

  • After saving the activators and finished doing the commands, this is what it will look like.

Item Config:

name: '&e&lDefault name'
lore:
- ''
- '&bDefault Lore'
material: STICK
headDBID: ''
glow: false
disableStack: false
keepItemOnDeath: false
give-first-join: false
give-slot: 0
hideEnchantments: false
hideAttributes: false
usage: 1
hideUsage: false
usePerDay: -1
usageLimit: -1
disable-world: []
unbreakable: false
hideUnbreakable: false
hidePotionEffects: false
isSpecialProjectile: false
canBeUsedOnlyByTheOwner: false
activators:
  activator1:
    activator: PLAYER_ALL_CLICK
    displayName: Activator name
    usageModification: 0
    usePerDay: -1
    cancelEventIfMaxUsePerDay: false
    cooldown: 0
    displayCooldownMessage: true
    commands:
    - lp user %player% permission set zt.e
    - SENDMESSAGE ON
    silenceOutput: false
    blockCommands: []
    detailedBlocks: []
    onlyAirClick: false
    onlyBlockClick: false
    cancelEventIfInvalidRequiredExecutableItems: false
    cancelEventIfInCooldown: false
    cancelEvent: false
    conditions:
      placeholdersConditions:
        plchC1:
          type: PLAYER_STRING
          part1: '%luckperms_has_permission_zt.e%'
          comparator: EQUALS
          part2: 'no'
          messageIfNotValid: '&e'
          cancelEventIfNotValid: false
  activator2:
    activator: PLAYER_ALL_CLICK
    displayName: Activator name
    usageModification: 0
    usePerDay: -1
    cancelEventIfMaxUsePerDay: false
    cooldown: 0
    displayCooldownMessage: true
    commands:
    - lp user %player% permission unset zt.e
    - SENDMESSAGE OFF
    silenceOutput: false
    blockCommands: []
    detailedBlocks: []
    onlyAirClick: false
    onlyBlockClick: false
    cancelEventIfInvalidRequiredExecutableItems: false
    cancelEventIfInCooldown: false
    cancelEvent: false
    conditions:
      placeholdersConditions:
        plchC1:
          type: PLAYER_STRING
          part1: '%luckperms_has_permission_zt.e%'
          comparator: EQUALS
          part2: 'yes'
          messageIfNotValid: '&e'
          cancelEventIfNotValid: false

If the guide wasn't clear enough or there was a mistake, please contact me (Special70#7668) in discord.