2

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?

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

2 Answers 2

6

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

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

Since this has already been answered, I want to help update those who are looking at this from 2017+.

stat.useItem.minecraft has since 1.13 become minecraft.used:minecraft.

You must log in to answer this question.

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