The problem is that your command is looking for a player within a radius of 10 of the command block, standing inside a dropper with specific items in it. That won't do.
In fact, it is quite difficult to detect the presence of a single, arbitrary block in the vicinity of the player. Luckily for you, your dropper is not arbitrary, but is created at the position of an entity (your villager)!
What you want to do is keep this villager alive. Let me back up a little. You want to use an armor stand instead, they are the gold standard for use as entity markers for commands, due to the Marker
, NoGravity
and Invisible
tags.
Now that you are using an armorstand, don't kill it, and use the following command to detect the dropper:
execute @e[type=ArmorStand,name=Test] ~ ~ ~ testforblock ...
The armorstand serves to save arbitrary coordinates and execute from there, similar to how you create the dropper at an arbitrary place.
It doesn't really matter if the player is within 10 blocks, but if you really want to, you can daisy-chain execute commands
execute @a ~ ~ ~ execute @e[type=ArmorStand,name=Test,r=10] ~ ~ ~ testforblock ...
This will run the second execute (and everything beyond) only if the armorstand is within 10 blocks of any player.
Power a repeat command block with this command:
/testfor @a[x=X,y=Y,z=Z,r=R]
Where X
, Y
, Z
are the middle coordinates of the arena, R is the radius of the arena. Now, put this command in a repeating command block:
/testforblock X2 Y2 Z2 minecraft:command_block -1 {SuccessCount:SC}
Where X2
, Y2
, Z2
are the coordinates of the 1st command block and SC
is the amount of players you want to be left to award them.
Next to the 2nd command block place a chain command block with this command (or another if you don't want to give items, but be sure to use the @a[x=X,y=Y,z=Z,r=R]
):
/give @a[x=X,y=Y,z=Z,r=R] minecraft:THE_AWARD_YOU_WANT
Where X
, Y
, Z
are the middle coordinates of the arena.
Best Answer
This can be done via the /fill command within /execute.
You don't have to use a pumpkin, any unused block will do. Put these two commands separately on a fill clock and run a comparator out from either of the two command blocks with the commands in them. Whenever any player is within 10 blocks (including diagonals, unfortunately) of a dropper with the data value of 1 (was that facing down? I can't remember), the comparator will turn on. Whenever they move out of range, it will turn off. That's currently the closest you can get to what you asked.