Refactor vanish handling by moving logic to FrameSpawnerPlayer and improving debug logging
This commit is contained in:
@@ -8,6 +8,7 @@ import com.alttd.storage.PlayerSettings;
|
||||
import com.alttd.util.Logger;
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@@ -19,6 +20,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class ParticleSet {
|
||||
|
||||
private final List<Frame> frames;
|
||||
@@ -53,7 +55,7 @@ public class ParticleSet {
|
||||
}
|
||||
|
||||
public void run(Location location, Player player) {
|
||||
if (tooSoon(player.getUniqueId()) || isVanished(player))
|
||||
if (tooSoon(player.getUniqueId()))
|
||||
return;
|
||||
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, frames, frameDelay, location, player.getLocation().getYaw());
|
||||
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
|
||||
@@ -68,10 +70,6 @@ public class ParticleSet {
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
|
||||
}
|
||||
|
||||
private boolean isVanished(Player player) {
|
||||
return VanishAPI.isInvisible(player) || player.getGameMode().equals(GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
private boolean tooSoon(UUID uuid) {
|
||||
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
||||
if (ps.canRun(aPartType))
|
||||
|
||||
Reference in New Issue
Block a user