Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.RDev.ParticlesEffects;
- import java.util.HashMap;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import me.RDev.CosmeticsTreasure;
- import me.RDev.PlayerSettings;
- import me.RDev.TreasureChest.GadgetsType;
- import me.RDev.nmsClasses.Effects.ParticleEffect;
- import me.RDev.nmsClasses.Effects.ParticleEffect.ParticleType;
- public class FrostLord {
- final public static HashMap<Player, Integer> countdown = new HashMap<Player, Integer>();
- public static GadgetsType playfrostlord(final Player p) {
- int r = Bukkit.getScheduler()
- .runTaskTimer(
- CosmeticsTreasure.getPlugin(),
- new Runnable() {
- double t = 0;
- double pi = Math.PI;
- public void run(){
- if(!p.isOnline()) cancel(p);
- t += pi / 13;
- Location loc = p.getLocation();
- for(double phi = 0; phi <= 2 * pi; phi += pi / 3){
- double x = 0.2 * (4 * pi - t) * Math.cos(t + phi);
- double y = 0.2 * t;
- double z = 0.2 * (4 * pi - t) * Math.sin(t + phi);
- loc.add(x,y,z);
- new ParticleEffect(ParticleType.SNOW_SHOVEL,loc, 0.0f, 1, 0.0f);
- loc.subtract(x,y,z);
- if(t >= 4 * pi){
- t = 0; phi = 0;
- loc.add(x,y,z);
- new ParticleEffect(ParticleType.SNOW_SHOVEL,loc, 1, 60, 0.1f);
- loc.subtract(x,y,z);
- }
- }
- }
- }, 0, 1).getTaskId();
- countdown.put(p, r);
- PlayerSettings.getPlayersParticlesEffects().put(p.getName(), GadgetsType.FrostLord);
- return GadgetsType.FrostLord;
- }
- public static void cancel(Player p)
- {
- if (countdown.containsKey(p))
- {
- Bukkit.getServer().getScheduler().cancelTask(((Integer)countdown.get(p)).intValue());
- countdown.remove(p);
- PlayerSettings.getPlayersParticlesEffects().put(p.getName(), null);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement