MAIN/src/main/java/com/trafalcraft/anti_redstone_clock/commands/CheckList.java aktualisiert
This commit is contained in:
@@ -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() {
|
||||||
@@ -32,30 +33,33 @@ public class CheckList {
|
|||||||
page = Integer.parseInt(args[1]);
|
page = Integer.parseInt(args[1]);
|
||||||
if (page == -1) {
|
if (page == -1) {
|
||||||
sender.sendMessage("§2TPS is " + CheckTPS.isTpsOK() + " §4TPS:" + CheckTPS.getTPS()
|
sender.sendMessage("§2TPS is " + CheckTPS.isTpsOK() + " §4TPS:" + CheckTPS.getTPS()
|
||||||
+ " §emin" + Main.getInstance().getConfig().getInt("checkTPS.minimumTPS")
|
+ " §emin" + Main.getInstance().getConfig().getInt("checkTPS.minimumTPS")
|
||||||
+ " §amax" + Main.getInstance().getConfig().getInt("checkTPS.maximumTPS"));
|
+ " §amax" + Main.getInstance().getConfig().getInt("checkTPS.maximumTPS"));
|
||||||
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
|
||||||
}
|
}
|
||||||
TextComponent textComponent = new TextComponent(color + "RedStoneClock> §fWorld:" + loc.getWorld().getName()
|
TextComponent textComponent = new TextComponent(color + "RedStoneClock> §fWorld:" + loc.getWorld().getName()
|
||||||
+ ",X:" + loc.getX()
|
+ ",X:" + loc.getX()
|
||||||
@@ -63,11 +67,11 @@ public class CheckList {
|
|||||||
+ ",Z:" + loc.getZ()
|
+ ",Z:" + loc.getZ()
|
||||||
+ " b:" + clock + "/" + maxPulses);
|
+ " b:" + clock + "/" + maxPulses);
|
||||||
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + teleportCMD
|
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + teleportCMD
|
||||||
.replace("$x", String.format("%.0f", loc.getX()))
|
.replace("$x", String.format("%.0f", loc.getX()))
|
||||||
.replace("$y", String.format("%.0f", loc.getY()))
|
.replace("$y", String.format("%.0f", loc.getY()))
|
||||||
.replace("$z", String.format("%.0f", loc.getZ()))
|
.replace("$z", String.format("%.0f", loc.getZ()))
|
||||||
.replace("$world", loc.getWorld().getName())
|
.replace("$world", loc.getWorld().getName())
|
||||||
.replace("$player", sender.getName())));
|
.replace("$player", sender.getName())));
|
||||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||||
new Text("Click to teleport you to the redstoneclock")));
|
new Text("Click to teleport you to the redstoneclock")));
|
||||||
sendFormatedMessageToPlayer(sender, textComponent);
|
sendFormatedMessageToPlayer(sender, textComponent);
|
||||||
|
Reference in New Issue
Block a user