I'd like to create a quest where a user can activate a command block that will spawn one ocelot, but limit it so that each player can activate said command only once.

I've got the command to spawn one ocelot, which is:

/summon ocelot ~ ~1 ~ {PersistenceRequired:1}

but I don't know how to limit it so that each player can only do it only once. I found the solution to something similar, but I don't know how to integrate that into spawning animals rather than giving items.

TL;DR: How would I use a command block to allow each player to summon an ocelot only once?

  • Without reviewing the research you've done, what I can say is you want to tag players that have spawned an animal, and then use that tag to prevent them from doing the same in the future. Note that this can be bypassed by ops.
    – MBraedley
    Feb 15, 2019 at 21:05
  • 1
    Hey, look, an XY problem! Try asking about why ocelots don't spawn instead and give more details for that (in a new question). Feb 15, 2019 at 21:51
  • What exactly is your question here? How to replace /give with /summon? Just… do it. Just replace it. I don't understand the problem. Feb 15, 2019 at 21:53
  • @FabianRöling that won't work because you don't /summon a player. The player argument is no longer included in the /summon command, but it needs to be included in order for it to only allow one command per player. Unless I'm looking at it wrong.
    – Takaia
    Feb 16, 2019 at 23:57
  • "The player argument is no longer included in the /summon command" What? What would that even do? Summoning a player? Feb 17, 2019 at 1:28

1 Answer 1



You can track a user with scoreboards. The main gist is:

If a user has an hasOcelot score of 1 presses the button, do nothing.
If a user has an hasOcelot score of 0 presses the button, spawn an Ocelot. Give the current player who pressed the button a score for hasOcelot of 1.

Where hasOcelot is a score of type 'dummy' that you use to keep tabs on who has spawned an Ocelot and who hasn't.

You can use the /testfor command with the radius and score selectors to see if the player fits into the criteria.


Chain command blocks like this:

/testfor @p[r=2,score_hasOcelot_max=0] (Check if user hasn't spawned)
/summon ~ ~1 ~ minecraft:Ocelot (Summon if the previous /testfor was true)
/scoreboards players set @p[r=2,score_hasOcelot_max=0] hasOcelot 1 (mark him as having an ocelot spawned, continuation of chain)

Note: I might've messed up some selectors due to changes between 1.9 and now.

  • 1
    testfor was removed in 1.13. Also, this probably won't work in a function file because it relies on conditional execution. Not a deal breaker, but generally makes life easier. And the selectors are wrong for 1.13.
    – MBraedley
    Feb 24, 2019 at 16:44
  • @MBraedley I haven't used commands in 1.13 yet, so if you have a better answer, by all means change it... Or post your own.
    – aytimothy
    Feb 25, 2019 at 9:33

You must log in to answer this question.

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