Put commands in items

minecraft-commandsminecraft-java-editionminecraft-java-edition-server

I added crates and I wrote in the commands /lp user %player% parent set and the rank that he wins, but I realised and then tested. The problem with that is when I have higher rank it will make it lower like if I have rank 1 and I get rank 2 it will rank up me to 2, but if I have rank 3 it will also put me to 2 so I lose rank.

Is there a way to put the lp user command in a item, so the players don't lose the rank? And if with a plugin, can you suggest me one? Also something common happens with the kits, if it automaticly gives the player the kit, but everything in the inventory disappears, so I want to put that command in a item too.

I also thought about making a spot that they can get automatically teleported and get the rank and automaticaly leave, but they can tp other players so everyone can get the rank by just one guy.

Best Answer

You can use the command /lp user %player% parent add <group> and LuckPerms will add the group on top of the player's existing groups. For example, if the player has rank 1, when the command is run they will be given rank 2, which means they will have both rank 1 and 2.

I'm not sure what you mean by putting a command in an item - do you mean running a command when a player right clicks the item in their hand? If that is what you wish to do, I suggest using the MyCommand plugin. You can run commands through items, blocks and more.

What plugin are you using to give the player a kit? Most plugins like EssentialsX don't clear the player's inventory, that is unusual behavior.