From f8c8c5a4c16338349a5a9e38608cdfcd603d339b Mon Sep 17 00:00:00 2001 From: Cow Date: Sun, 2 Aug 2020 23:40:24 +0200 Subject: Added more ways to detect if a player is in a SkyBlock dungeon --- .../java/de/cowtipper/cowlection/handler/DungeonCache.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/de/cowtipper/cowlection/handler') diff --git a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java index 3df9048..b687ef2 100644 --- a/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java +++ b/src/main/java/de/cowtipper/cowlection/handler/DungeonCache.java @@ -34,12 +34,24 @@ public class DungeonCache { return isInDungeon; } + public void onDungeonEnterOrLeave(boolean isInDungeonNow) { + boolean wasInDungeon = isInDungeon; + + if (!wasInDungeon && isInDungeonNow) { + onDungeonEntered(); + } else if (wasInDungeon && !isInDungeonNow) { + onDungeonLeft(); + } + } + public void onDungeonEntered() { + main.getLogger().info("Entered SkyBlock Dungeon!"); isInDungeon = true; resetCounters(); } public void onDungeonLeft() { + main.getLogger().info("Leaving SkyBlock Dungeon!"); isInDungeon = false; resetCounters(); } -- cgit