Moved more artifact math to separate thread

This commit is contained in:
Auxilor 2021-09-16 20:07:39 +01:00
parent 9cda787d0c
commit 172157c3fc

View File

@ -108,18 +108,20 @@ public abstract class Artifact extends EcoEnchant {
return;
}
Vector point1 = player.getLocation().getDirection().clone();
point1.rotateAroundY(Math.toRadians(90));
point1.multiply(1.2);
Location location1 = player.getLocation().clone().add(point1);
this.getPlugin().getScheduler().runAsync(() -> {
Vector point1 = player.getLocation().getDirection().clone();
point1.rotateAroundY(Math.toRadians(90));
point1.multiply(1.2);
Location location1 = player.getLocation().clone().add(point1);
Vector point2 = player.getLocation().getDirection().clone();
point2.rotateAroundY(Math.toRadians(-90));
point2.multiply(1.2);
Location location2 = player.getLocation().clone().add(point2);
Vector point2 = player.getLocation().getDirection().clone();
point2.rotateAroundY(Math.toRadians(-90));
point2.multiply(1.2);
Location location2 = player.getLocation().clone().add(point2);
player.getWorld().spawnParticle(particle, location1, 1, 0, 0, 0, 0, extra, true);
player.getWorld().spawnParticle(particle, location2, 1, 0, 0, 0, 0, extra, true);
player.getWorld().spawnParticle(particle, location1, 1, 0, 0, 0, 0, extra, true);
player.getWorld().spawnParticle(particle, location2, 1, 0, 0, 0, 0, extra, true);
});
}
@Override
@ -178,6 +180,6 @@ public abstract class Artifact extends EcoEnchant {
bukkitRunnable.cancel();
}
projectile.getLocation().getWorld().spawnParticle(particle, projectile.getLocation(), 1, 0, 0, 0, finalColor, extra, true);
}).runTaskTimer(4, ticks);
}).runTaskTimerAsynchronously(4, ticks);
}
}