Dynamic Kit Cooldown Menu
-
Today I'll show you how to make a kit menu that shows users when a kit is on cooldown (Using essentials).
Before we start, remember that placeholderAPI uses "yes/no" by default instead of "true/false" unless you've changed it in the configuration. If you don't know what I'm talking about...you probably should not worry about it.
I will only be doing one item, and it will use the essentials kit "starter". The kit has a 24 hour cooldown. Let's start with the menu name and commands.
Code (YAML):menu_title: '&c&lKits &7[&8Click To Select&7]'
open_command:
- kits
- kit
- ekits
- ekit
size: 9
update_interval: 1
Code (YAML):menu_title: '&c&lKits &7[&8Click To Select&7]'
open_command: kits
size: 9
update_interval: 1
items:
'starteron':
material: iron_sword
slot: 0
priority: 1
update: true
hide_attributes: true
view_requirement:
requirements:
starter_available:
type: string equals ignorecase
input: '%essentials_kit_is_available_starter%'
output: 'yes'
display_name: '&c&lStarter Kit'
lore:
- '&8+---------------------+'
- '&7Starter kit with basic items.'
left_click_commands:
- '[player] kit starter'
- '[console] playsound mob.horse.armor %player_name% ~ ~ ~ 1 1.2 1'
- '[close]'
right_click_commands:
- '[player] kit starter'
- '[console] playsound mob.horse.armor %player_name% ~ ~ ~ 1 1.2 1'
- '[close]'
'starteroff':
material: barrier
slot: 0
priority: 2
update: true
hide_enchantments: true
enchantments:
- 'DURABILITY;1'
display_name: '&8[&7Unavailable&8] &c&lStarter Kit'
lore:
- '&8+---------------------+'
- '&7This kit is on cooldown!'
- '&7You must wait &c%essentials_kit_time_until_available_starter%'
- '&7Before using this kit again.'
left_click_commands:
- '[console] playsound mob.bat.takeoff %player_name% ~ ~ ~ 1 1.5 1'
- '[console] playsound mob.horse.armor %player_name% ~ ~ ~ 1 1.5 1'
right_click_commands:
- '[console] playsound mob.bat.takeoff %player_name% ~ ~ ~ 1 1.5 1'
- '[console] playsound mob.horse.armor %player_name% ~ ~ ~ 1 1.5 1'
Starteron has priority 1 so it will show OVER the starteroff item. However, It has a view requirement. If the requirement is not met...it will not show and instead the Starteroff item will show. The starteroff item has this placeholder in the lore "%essentials_kit_time_until_available_starter%" which shows the time until that kit is available.
Let's look at the view_requirment on the starteron item:
Code (YAML):view_requirement:
requirements:
has_kit:
type: string equals ignorecase
input: '%essentials_kit_is_available_starter%'
output: 'yes'
This requirement checks to ensure that the kit is available using the placeholder "%essentials_kit_is_available_starter%". If it is available it returns "yes"...so we check to see if it is returning yes. If it is, we show the starteron item which executes the command as a player.
Now we have a dynamic menu that only shows kits available, and shows a barrier for when it is not available. A great way to visually tell players what is and is not available to them. - Loading...
- Loading...
XenCarta PRO
© Jason Axelrod from 8WAYRUN.COM