From 8b78e680240a20d1b44c03f6bbcbb42b36a02827 Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Wed, 25 Nov 2020 22:55:50 -0500 Subject: Add low health alerts --- src/main/java/me/Danker/TheMod.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker/TheMod.java') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 7c821fd..55ec20e 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -2519,7 +2519,7 @@ public class TheMod // Checks 5 times per second if (tickAmount % 4 == 0) { - if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { + if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { List entities = world.getLoadedEntityList(); int highestHealth = 0; highestBlaze = null; @@ -2563,6 +2563,19 @@ public class TheMod } } + // Checks 10 times per second + if (tickAmount % 2 == 0) { + if (ToggleCommand.lowHealthNotifyToggled && Utils.inDungeons && world != null) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + for (String score : scoreboard) { + if (score.endsWith("❤") && score.matches(".*§c\\d.*")) { + Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!", 1); + break; + } + } + } + } + if (titleTimer >= 0) { if (titleTimer == 0) { showTitle = false; -- cgit