#cannot execute command when player clicks on item

1 messages · Page 1 of 1 (latest)

grim cedar
#

why not?

vale musk
#

I don't understand how to do it

grim cedar
#

you can use Bukkit.dispatchCommand I think

vale musk
#

how does it work?

grim cedar
#

Bukkit.dispatchCommand(player, "/gamemode creative")

vale musk
#

Its equals to p.performCommand?

grim cedar
#

yes

#

you can use that too if you want

vale musk
#

i don't mean this, i mean i want to execute a command when the player is holding the object i configured from the.yml file but i don't know how to do it

grim cedar
#

oh I see

vale musk
#

Slot1:
Name: "ciao"
Material: WOOD
Lore:

  • "test"
    until now i managed to do this
grim cedar
#

essentially you need to tag your item with some kind of id that you can check in the playerItemheldEvent to see if its the correct item

vale musk
grim cedar
#

oh

#

well then idk how to help you

#

something with nbt probably