A variable needs to be created so we can have an identifier if the switch is on/off
Create your item, and add an activator
In this case it will be a PLAYER_ALL_CLICK
Commands
Type what commands you want to type
Variables Modification
Placeholder Condition
This is needed to control what activator is going to run
Add the other item cooldown to the item itself
For example, the id of the ei item is onoff-demo. You would then have to go to this icon then follow the pictures.
For example, the id of the on/off switch is "faker", so select "faker".
Ever since 5.0 dropped, activator ids start from "activator0" instead of "activator1". Anyway, you would want to select the second activator as activators run from top to bottom.
This option is important because if there's no cooldown, it will ram through the the 2nd activator that's supposed to turn off the activator
This is suggested to be set to true if you want the item to be spammable. One tick is enough to prevent the ramming mentioned above.
Second activator
We will use again PLAYER_ALL_CLICK
Commands
Type what commands you want to type
Variables Modification
Placeholder Condition
This is needed to control what activator is going to run
Add the other item cooldown to the item itself
For example, the id of the ei item is onoff-demo. You would then have to go to this icon then follow the pictures.
For example, the id of the on/off switch is "faker", so select "faker".
Ever since 5.0 dropped, activator ids start from "activator0" instead of "activator1". Anyway, you would want to select the second activator as activators run from top to bottom.
This option is important because if there's no cooldown, it will ram through the the 2nd activator that's supposed to turn off the activator
This is suggested to be set to true if you want the item to be spammable. One tick is enough to prevent the ramming mentioned above.
Save the EI Item
It should look like this (We added on commands to say ON (activator1) and OFF (activator2) to show you how it is working :p
Item config
name:'&e&lOn/Off Demo'lore: []material:LEVERglow:truedisableStack:falsekeepItemOnDeath:falsecanBeUsedOnlyByTheOwner:falsestoreItemInfo:falseunbreakable:falseusage:1usageLimit:-1cancelEventIfNoPerm:falsecancelEventIfNotOwner:falsedisabledWorlds: []recognitions: []config_5:trueconfig_update:truedropOptions:glowDrop:falseglowDropColor:WHITEdisplayNameDrop:falsehiders:hideEnchantments:falsehideUnbreakable:falsehideAttributes:falsehidePotionEffects:falsehideUsage:truehideDye:falseenchantments: {}giveFirstJoin:giveFirstJoin:falsegiveFirstJoinAmount:1giveFirstJoinSlot:0restrictions:cancel-item-place:falsevariables:x:variableName:xtype:NUMBERdefault:0.0attributes: {}activators:activator0:name:'&eToggle-On'option:PLAYER_ALL_CLICKtypeTarget:NO_TYPE_TARGETusageModification:0cancelEvent:truesilenceOutput:falseautoUpdateItem:falsecooldownOptions:cooldown:0isCooldownInTicks:falsecooldownMsg:'&cYou are in cooldown ! &7(&e%time_H%&6H &e%time_M%&6M &e%time_S%&6S&7)'displayCooldownMessage:falsecancelEventIfInCooldown:falseglobalCooldownOptions:cooldown:0isCooldownInTicks:falsecooldownMsg:'&cYou are in cooldown ! &7(&e%time_H%&6H &e%time_M%&6M &e%time_S%&6S&7)'displayCooldownMessage:truecancelEventIfInCooldown:falseotherEICooldowns:cd0:executableItem:onoff-demoactivators: - activator1cooldown:1isCooldownInTicks:truerequiredItems:errorMessage:''requiredExecutableItems:errorMessage:''detailedSlots: - -1commands: - SENDMESSAGE Toggled OnplayerConditions: {}worldConditions: {}itemConditions: {}customConditions: {}placeholdersConditions:plchC1:type:PLAYER_NUMBERcomparator:EQUALSpart1:'%var_x%'part2:'0.0'cancelEventIfNotValid:truemessageIfNotValid:'&e'variablesModification:varModif0:variableName:xtype:SETmodification:1.0activator1:name:'&eToggle-Off'option:PLAYER_ALL_CLICKtypeTarget:NO_TYPE_TARGETusageModification:0cancelEvent:truesilenceOutput:falseautoUpdateItem:falsecooldownOptions:cooldown:0isCooldownInTicks:falsecooldownMsg:'&cYou are in cooldown ! &7(&e%time_H%&6H &e%time_M%&6M &e%time_S%&6S&7)'displayCooldownMessage:falsecancelEventIfInCooldown:falseglobalCooldownOptions:cooldown:0isCooldownInTicks:falsecooldownMsg:'&cYou are in cooldown ! &7(&e%time_H%&6H &e%time_M%&6M &e%time_S%&6S&7)'displayCooldownMessage:truecancelEventIfInCooldown:falseotherEICooldowns:cd0:executableItem:onoff-demoactivators: - activator0cooldown:1isCooldownInTicks:truerequiredItems:errorMessage:''requiredExecutableItems:errorMessage:''detailedSlots: - -1commands: - SENDMESSAGE Toggled OffplayerConditions: {}worldConditions: {}itemConditions: {}customConditions: {}placeholdersConditions:plchC1:type:PLAYER_NUMBERcomparator:EQUALSpart1:'%var_x%'part2:'1.0'cancelEventIfNotValid:truemessageIfNotValid:'&e'variablesModification:varModif0:variableName:xtype:SETmodification:0.0
Last comment
If you have any question or you think the guide wasn't clear enough, feel free to ask in Discord.
We will help you ! 😁😁