Question Get player who activate a mob spawner

N4TH4NOT

New member
Oct 8, 2022
3
0
1
Hi,
I has created a plugin to prevent unknown the players to modify the world so I already cancel a bunch of event and I try to prevent mob spawner activation now.

Did you have any idea to prevent a CreatureSpawner activation when the player don't has the permission, like the spectator mode ??
 

cam

New member
Aug 28, 2022
2
0
1
Melbourne, Australia
There isn't really any association between Creature Spawns at a Spawner and the player that 'activates' it as that's not really how the game works. What you can do is get the spawned entity's location and check if there is someone with a certain permission within a defined radius of the entity, cancelling the event if you don't find any players with the permission.

Players don't necessarily "activate" spawners as you described, the spawners just do their thing whenever players are around.