1

I want to know if there is a way of only allowing particular players to use specific items in Minecraft Adventure mode?

My idea is to create an adventure mode Map, and I want to have classes. So only an Archer can use a bow, and only a Knight can use a sword and so on. This is for a Minehut server, using Minecraft Java 1.20.1.

2
  • One hack solution might be to make it so only [class] players can hold the item. I'd do that by checking to see if illegal player/item pairs exist, then wiping the item from their inventory and spawning an equivalent one. Jul 11, 2023 at 19:10
  • You can add a tag to the players, like: <Player> tag: Ranger. Then you check that the player holding the item has the correct tag. Jul 12, 2023 at 16:35

1 Answer 1

1

One way to do this is with tags. For instance, you can use /tag [selector] add Archer.

For each class, place a repeating, always active command block and enter this command:

clear @a[tag=!Archer] bow

Replace 'Archer' with each class (keep the '!'), and change the item to whichever item is specific to that class.

You can assign each player a class using /tag [selector] add [class]. To remove a class from a player, use /tag [selector] remove Archer. If a player doesn't have a class, but has the class's specific item, then it will be cleared from their inventory.

1
  • 1
    This would work but ideally the items would still exist and be unusable, not vanish entirely.
    – pppery
    Oct 21, 2023 at 0:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .