package net.mc_pandacraft.java.plugin.pandacraftutils.modules.fun;

import java.util.Collection;

import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
import net.mc_pandacraft.java.util.bukkit.protocol.ParticleEffect;

import org.bukkit.scheduler.BukkitRunnable;

public class HeartThrowManager extends BukkitRunnable {
	private final PandacraftUtils plugin = PandacraftUtils.getInstance();
	
	public HeartThrowManager() {
        plugin.getServer().getScheduler().runTaskTimer(plugin, this, 1L, 10L);
	}

	@Override
	public void run() {
		
		Collection<OnlinePlayer> players = OnlinePlayerManager.getAll();
		
		for(OnlinePlayer op : players) {
			if (!op.getHeartThrowEnabled()) continue;
			
			ParticleEffect.HEART.display(0.1F, 0, 0.1F, 0, 1, op.getPlayer().getLocation().add(0, 2, 0), 20);
		}
		
	}

}
