I'm trying to add player trails, which are just particles that follow around players as they walk. Which would be better speedwise for the server? 1. Creating a new task for each player on the server when they join, which would add a particle every x ticks and cancel the task when they leave. 2. Creating a task when the server starts which goes through a foreach loop on an array of players I made, which I can unset and set players to?
Load due to inserting and removing players less than once per tick is obviously negligible. Handling many tasks in the ServerScheduler actually uses pretty much load as a lot of PocketMine-MP internals are related .