Added repeat delay

This commit is contained in:
Teriuihi 2022-01-13 23:18:07 +01:00
parent 77df8b1e6d
commit 062a1a0f18

View File

@ -1,8 +1,11 @@
package com.alttd.objects; package com.alttd.objects;
import com.alttd.AltitudeParticles; import com.alttd.AltitudeParticles;
import com.alttd.config.Config;
import com.alttd.frameSpawners.FrameSpawnerLocation; import com.alttd.frameSpawners.FrameSpawnerLocation;
import com.alttd.frameSpawners.FrameSpawnerPlayer; import com.alttd.frameSpawners.FrameSpawnerPlayer;
import com.alttd.storage.PlayerSettings;
import com.alttd.util.Logger;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -12,16 +15,17 @@ import java.util.List;
public class ParticleSet { public class ParticleSet {
private final List<Frame> frames; private final List<Frame> frames;
private final int delay, repeat; private final int frameDelay, repeat, repeatDelay;
private final APartType aPartType; private final APartType aPartType;
private final String uniqueId; private final String uniqueId;
private final String permission; private final String permission;
private final ItemStack itemStack; private final ItemStack itemStack;
public ParticleSet(List<Frame> frames, int delay, int repeat, APartType aPartType, String uniqueId, String permission, ItemStack itemStack) { public ParticleSet(List<Frame> frames, int frameDelay, int repeat, int repeatDelay, APartType aPartType, String uniqueId, String permission, ItemStack itemStack) {
this.frames = frames; this.frames = frames;
this.delay = delay; this.frameDelay = frameDelay;
this.repeat = repeat; this.repeat = repeat;
this.repeatDelay = repeatDelay;
this.aPartType = aPartType; this.aPartType = aPartType;
this.uniqueId = uniqueId; this.uniqueId = uniqueId;
this.permission = permission; this.permission = permission;
@ -29,13 +33,15 @@ public class ParticleSet {
} }
public void run(Location location) { public void run(Location location) {
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, location); FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, repeatDelay, frames, location);
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, delay); frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
} }
public void run(Player player) { public void run(Player player, PlayerSettings playerSettings) {
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, player); if (Config.DEBUG)
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, delay); 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);
} }
public APartType getAPartType() { public APartType getAPartType() {