Closed ClarkHalf closed 5 years ago
@ustc-zzzz
just use nucleus for kits.
I used the kits as an example, but I want to use it in other menus =/
In fact there is a best practice based on the features provided by VirtualChest and LuckPerms since LP could set a temporary permission which will expire several hours later. The explanation is a bit long, let me explain it in several parts.
For example, if you want to give one diamond to the player per hour while you do not give more than one in 1h, what you can do is:
false
for players (the permission string we use here is virtualchest.temp.diamond
as an example).player.hasPermission('virtualchest.temp.diamond')
) by setting the value of the Requirements
option.
false
, show the item you want and then set the PrimaryAction
as you want and append a command executed by console (starting with lp
), which sets the temp permission (for example, console: lp user %player_name% permission settemp virtualchest.temp.diamond true 1h
) in the value of Command
option.true
, show an item which tells the player the PrimaryAction
is not available.Here is an example:
Slot1 = [{
Requirements = "player.hasPermission('virtualchest.temp.diamond')"
Item {
Count = 1
UnsafeDamage = 0
ItemType = "minecraft:barrier"
DisplayName = "You cannot take more than one diamond in 1h"
}
PrimaryAction {
KeepInventoryOpen = false
Command = "tell: You cannot take more than one diamond in 1h!"
}
}, {
Item {
Count = 1
UnsafeDamage = 0
ItemType = "minecraft:diamond"
DisplayName = "Give you a diamond (take one at most in 1h)"
}
PrimaryAction {
KeepInventoryOpen = false
Command = """console: give %player_name% minecraft:diamond;
console: lp user %player_name% permission settemp virtualchest.temp.diamond true 1h"""
}
}]
Can I put cooldown for when I click on a chest item? Example if I want to make a daily kit menu. Every 24 hours he can pick up the kit