MAIN/src/main/java/com/trafalcraft/anti_redstone_clock/commands/CheckList.java aktualisiert

This commit is contained in:
2025-08-17 14:54:38 +00:00
parent 905a21787a
commit 3c48a2b5e8

View File

@@ -16,6 +16,7 @@ import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text; import net.md_5.bungee.api.chat.hover.content.Text;
public class CheckList { public class CheckList {
private static final CheckList ourInstance = new CheckList(); private static final CheckList ourInstance = new CheckList();
public static CheckList getInstance() { public static CheckList getInstance() {
@@ -37,23 +38,26 @@ public class CheckList {
return; return;
} }
} }
Collection<Location> allLocation = RedstoneClockController.getAllLoc(); Collection<Location> allLocation = RedstoneClockController.getAllLoc();
int totalPage = (int) Math.ceil(allLocation.size() / 5.0); int totalPage = (int) Math.ceil(allLocation.size() / 5.0);
sender.sendMessage(Msg.RED_STONE_CLOCK_LIST_HEADER.toString().replace("$page", sender.sendMessage(Msg.RED_STONE_CLOCK_LIST_HEADER.toString().replace("$page",
"(" + page + "/" + totalPage + ")")); "(" + page + "/" + totalPage + ")"));
int i = 1; int i = 1;
int minElements = 5 * (page - 1); int minElements = 5 * (page - 1);
int maxElements = 5 * page; int maxElements = 5 * page;
String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "tp $x $y $z"); String teleportCMD = Main.getInstance().getConfig().getString("teleportCMD", "teleport $x $y $z");
int maxPulses = Main.getInstance().getConfig().getInt("MaxPulses"); int maxPulses = Main.getInstance().getConfig().getInt("MaxPulses");
for (Location loc : allLocation) { for (Location loc : allLocation) {
if (i > minElements && i <= maxElements) { if (i > minElements && i <= maxElements) {
int clock = RedstoneClockController.getRedstoneClock(loc).getNumberOfClock(); int clock = RedstoneClockController.getRedstoneClock(loc).getNumberOfClock();
String color = "§2"; //Dark_Green String color = "§2"; // Dark_Green
if (clock > maxPulses * 0.75) { if (clock > maxPulses * 0.75) {
color = "§4"; //Dark_Red color = "§4"; // Dark_Red
} else if (clock > maxPulses * 0.5) { } else if (clock > maxPulses * 0.5) {
color = "§e"; //yellow color = "§e"; // yellow
} else if (clock > maxPulses * 0.250) { } else if (clock > maxPulses * 0.250) {
color = "§a"; // green color = "§a"; // green
} }