0

I'm making a minigame with a water system. Is there a command to test if a player has drunk a water bottle, and activate a command off of that?

  • I had no idea what to try, I'm not so good with commands. -_- – rappatic Apr 27 '16 at 12:05
5

First run this command once:

/scoreboard objectives add HasDrunk stat.useItem.minecraft.potion

This makes a scoreboard value that will increase by one for anyone who drinks a potion (which, by the game code, includes water bottles).

Next, in a repeating command block set to always active (number one in the below picture), write whatever command you want to activate, using @a[score_HasDrunk_min=1] instead of the player's name. Run another command if you want from the number 2 command block. Add as many as necessary all facing the same direction. Finally, in the last command block, write:

/scoreboard players set @a[score_HasDrunk_min=1] HasDrunk 0

Disclaimer:

You cannot use this with conjunction with drinkable potions. As a workaround, you could only give people splash potions

  • command one raises error Usage: Invalid Object Criteria Type – rappatic Apr 27 '16 at 19:43
  • @hyperviper11 Whoops, I misread the wiki. Instead of potion, it's minecraft.potion. – ash4fun Apr 27 '16 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.