Update: I solved it by moving the whole code into the player event "Player Damage Entity Event". Now I can just use %victim for the entity and %default for the player.
I want to get the player who hits an entity so that I can find out which item the player used to hit the entity. For testing purposes, I have a SendMessage block immediately after the event, which is set to all players. In there are two books. One named "%victim" and the other one named...
That's right, I'll add more to this funktion. Thanks to everyone, because the "no targets" worked! Of course, it stops when there are no players on the plot, but that doesn't matter.
Is there a way to make a variable public, i.e. the same for everyone?
For example, I have code that generates something and I don't want to make it player based. That means if there is at least 1 player on my plot, the generator is still working.