CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
403 stars 126 forks source link

Add support for playing a sound for multiple entities in a single task #208

Closed DavidTheExplorer closed 1 year ago

DavidTheExplorer commented 1 year ago

I'm developing a plugin where a sound should be sent to all online players, which currently can be done using:

for(Player online : Bukkit.getOnlinePlayers())
    XSound.WHATEVER.playRepeatedly(Main.getInstance(), online, 1, 1, 5, 5);

But this is really bad because it creates a task per player, instead of 1 task for all players.

DavidTheExplorer commented 1 year ago

Will you merge this? or are you waiting for me to do anything? 😅

portlek commented 1 year ago

you should make it backward compatible by adding one more method for the old single entity method that uses the new one like; playRepeatedly(plugin, Collections.singleton(entity), volume, pitch, repeat, delay);

DavidTheExplorer commented 1 year ago

Done. I fixed the original commit so now there are 2 versions of the method.

DavidTheExplorer commented 1 year ago

@CryptoMorin Any updates?

CryptoMorin commented 1 year ago

I'm busy right now. I can merge it if you want, but I won't be able to publish a new version.