package ee.ellytr.autoclick.tps;

import ee.ellytr.autoclick.EllyCheat;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

public class TPSRunnable implements Runnable {

    @Override
    public void run() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            double tps = Math.round(TPSTracker.getTPS() * 100.0) / 100.0;
            if (tps <= EllyCheat.getInstance().getConfig().getInt("tps-warning")) {
                for (Player player2 : Bukkit.getOnlinePlayers()) {
                    if (player2.hasPermission("ellycheat.cps.warning")) {
                        player2.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "!" + ChatColor.GRAY + "] The server is currently running at " + ChatColor.GOLD + tps + ChatColor.GRAY + " TPS!");
                    }
                }
                if (EllyCheat.getInstance().getConfig().getBoolean("log-warnings")) {
                    Bukkit.getConsoleSender().sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "!" + ChatColor.GRAY + "] The server is currently running at " + ChatColor.GOLD + tps + ChatColor.GRAY + " TPS!");
                }
            }
        }
        Bukkit.getScheduler().runTaskLaterAsynchronously(EllyCheat.getInstance(), this, 20);
    }
}

@@ -460,79 +460,8 @@
 ) %7B%0A
-                for (Player player2 : Bukkit.getOnlinePlayers()) %7B%0A    
     
@@ -482,17 +482,16 @@
  (player
-2
 .hasPerm
@@ -549,19 +549,14 @@
     
-    
 player
-2
 .sen
@@ -722,30 +722,8 @@
 %22);%0A
-                    %7D%0A
     

Fix TPS warning messages being sent too many times