Збірка усіх плаґінів для WhoMine розроблених [MinersStudios](https://minersstudios.github.io).
package ua.com.minersstudios.whomine.util.misc;
import lombok.*;
import lombok.experimental.UtilityClass;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import ua.com.minersstudios.whomine.util.misc.WorldDark;
import ua.com.minersstudios.whomine.util.MSUtil;

@UtilityClass
public class IngameChatManager
{
	/**
	 * Sends message globally, to all players, avoiding those in World Dark.
	 * @param message message to send
	 */
	public void sendGlobalMessage(@NonNull final Component message)
	{
		Bukkit.getOnlinePlayers().stream()
			.filter(p -> MSUtil.getInstance().isInWorldDark(p))
			.forEach(p -> p.sendMessage(message));
	}

	/**
	 * Sends message to all players within the specified radius.
	 * @param message message to send
	 * @param location sender's location
	 * @param radius radius of its location
	 */
	public void sendLocalMessage(
		@NonNull final Component message,
		@NonNull final Location location,
		final double radius)
	{
		Bukkit.getScheduler().runTask(MSUtil.getInstance(),
			() -> location.getWorld().getNearbyPlayers(location, radius)
				.forEach(p -> p.sendMessage(message)));
	}
}