Fixed frame delay
This commit is contained in:
parent
0a7b583424
commit
33d95226a7
|
|
@ -12,14 +12,12 @@ import java.util.List;
|
|||
public class FrameSpawnerLocation extends BukkitRunnable {
|
||||
|
||||
private int amount;
|
||||
private final long repeatDelay;
|
||||
private final List<Frame> frames;
|
||||
private Iterator<Frame> iterator;
|
||||
private final Location location;
|
||||
private final float rotation;
|
||||
public FrameSpawnerLocation(int amount, int repeatDelay, List<Frame> frames, Location location, float rotation) {
|
||||
public FrameSpawnerLocation(int amount, List<Frame> frames, Location location, float rotation) {
|
||||
this.amount = amount;
|
||||
this.repeatDelay = (repeatDelay * 1000L) / 20;
|
||||
this.frames = frames;
|
||||
this.iterator = frames.iterator();
|
||||
this.location = location;
|
||||
|
|
|
|||
|
|
@ -15,16 +15,14 @@ import java.util.List;
|
|||
public class FrameSpawnerPlayer extends BukkitRunnable {
|
||||
|
||||
private int amount;
|
||||
private final long repeatDelay;
|
||||
private final List<Frame> frames;
|
||||
private Iterator<Frame> iterator;
|
||||
private final Player player;
|
||||
private final PlayerSettings playerSettings;
|
||||
private final APartType aPartType;
|
||||
private final String uniqueId;
|
||||
public FrameSpawnerPlayer(int amount, int repeatDelay, List<Frame> frames, Player player, PlayerSettings playerSettings, APartType aPartType, String uniqueId) {
|
||||
public FrameSpawnerPlayer(int amount, List<Frame> frames, Player player, PlayerSettings playerSettings, APartType aPartType, String uniqueId) {
|
||||
this.amount = amount;
|
||||
this.repeatDelay = (repeatDelay * 1000L) / 20;
|
||||
this.frames = frames;
|
||||
this.iterator = frames.iterator();
|
||||
this.player = player;
|
||||
|
|
@ -53,13 +51,6 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
|
|||
else if (amount != 0) {
|
||||
iterator = frames.iterator();
|
||||
amount--;
|
||||
if (repeatDelay <= 0)
|
||||
return;
|
||||
try { //Wait before repeating the frames
|
||||
Thread.sleep(repeatDelay); //TODO figure out why this doesn't work and fix it
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
this.cancel();
|
||||
if (Config.DEBUG)
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ public class ParticleSet {
|
|||
public void run(Location location, Player player) {
|
||||
if (tooSoon(player.getUniqueId()) || isVanished(player))
|
||||
return;
|
||||
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, repeatDelay, frames, location, player.getLocation().getYaw());
|
||||
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, location, player.getLocation().getYaw());
|
||||
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), frameDelay, repeatDelay);
|
||||
}
|
||||
|
||||
public void run(Player player, PlayerSettings playerSettings) {
|
||||
|
|
@ -57,8 +57,8 @@ public class ParticleSet {
|
|||
return;
|
||||
if (Config.DEBUG)
|
||||
Logger.info("Starting particle set % for %.", uniqueId, player.getName());
|
||||
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, repeatDelay, frames, player, playerSettings, aPartType, uniqueId);
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, player, playerSettings, aPartType, uniqueId);
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), frameDelay, repeatDelay);
|
||||
}
|
||||
|
||||
private boolean isVanished(Player player) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user