diff options
author | ingle <inglettronald@gmail.com> | 2022-10-03 23:51:37 -0500 |
---|---|---|
committer | ingle <inglettronald@gmail.com> | 2022-10-04 04:41:36 -0500 |
commit | cecfa8fd5773eee9e5e732ab816b69b77162387d (patch) | |
tree | a0b4aae7160f6562c261f098bfda3579cff6297f /src/main/kotlin/dulkirmod/features | |
parent | 2092d19741295699b49c9aeaee4993cc15797556 (diff) | |
download | DulkirMod-cecfa8fd5773eee9e5e732ab816b69b77162387d.tar.gz DulkirMod-cecfa8fd5773eee9e5e732ab816b69b77162387d.tar.bz2 DulkirMod-cecfa8fd5773eee9e5e732ab816b69b77162387d.zip |
-Added bestiary stuff
Diffstat (limited to 'src/main/kotlin/dulkirmod/features')
-rw-r--r-- | src/main/kotlin/dulkirmod/features/AlarmClock.kt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt new file mode 100644 index 0000000..9c46a08 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt @@ -0,0 +1,48 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.Config +import dulkirmod.utils.Utils +import net.minecraft.scoreboard.Score +import net.minecraft.scoreboard.ScorePlayerTeam +import net.minecraft.util.EnumChatFormatting + +var lastUpdate : Long = 0 + +fun alarmClock() { + // CHECK IF IN SKYBLOCK + if (!Utils.isInSkyblock()) return + // CHECK TIME + val currTime : Long = System.currentTimeMillis() + val scoreboard = mc.thePlayer.worldScoreboard + val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1) + val scores: List<Score> = ArrayList(scoreboard.getSortedScores(sidebarObjective)) + val lines: MutableList<String> = ArrayList() + for (i in scores.indices.reversed()) { + val score = scores[i] + val scoreplayerteam1 = scoreboard.getPlayersTeam(score.playerName) + val line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.playerName) + lines.add(line) + } + for (l in lines) { + // ZOMBIE VILLAGER + if (Config.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) { + lastUpdate = currTime + val color = if (Config.bestiaryNotifColor == 16) "§z" else EnumChatFormatting.values()[Config.bestiaryNotifColor] + DulkirMod.titleUtils.drawStringForTime("${color}Zombie Villager", 5000) + if (Config.bestiaryAlertSounds) + mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f) + } + // GHASTS + else if (Config.notifyGhast && l.contains("9:00pm") && (currTime - lastUpdate) > 15000) { + lastUpdate = currTime + val color = if (Config.bestiaryNotifColor == 16) "§z" else EnumChatFormatting.values()[Config.bestiaryNotifColor] + DulkirMod.titleUtils.drawStringForTime("${color}Ghast", 5000) + if (Config.bestiaryAlertSounds) + mc.thePlayer.playSound("mob.ghast.scream", 1f * Config.bestiaryNotifVol, 1f) + } + + } + +}
\ No newline at end of file |