diff options
author | syeyoung <cyong06@naver.com> | 2021-01-08 13:40:43 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-08 13:40:43 +0900 |
commit | b382461db0b5fb96271bf548fa5aa89f0981ae05 (patch) | |
tree | e44c9db526292f70679103b7a8b13db6198f2d08 /src/main/java/kr/syeyoung/dungeonsguide/features/impl | |
parent | a248c240b2d8164453ac2269e71bd64ce26ae373 (diff) | |
download | Skyblock-Dungeons-Guide-b382461db0b5fb96271bf548fa5aa89f0981ae05.tar.gz Skyblock-Dungeons-Guide-b382461db0b5fb96271bf548fa5aa89f0981ae05.tar.bz2 Skyblock-Dungeons-Guide-b382461db0b5fb96271bf548fa5aa89f0981ae05.zip |
new eventos
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl')
3 files changed, 26 insertions, 40 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java index 17efd2e8..56ff4ce7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -11,7 +12,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; -public class FeatureCooldownCounter extends GuiFeature implements TickListener { +public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitListener { public FeatureCooldownCounter() { super("ETC", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color")); @@ -21,11 +22,11 @@ public class FeatureCooldownCounter extends GuiFeature implements TickListener { private boolean wasInDungeon = false; @Override public void drawHUD(float partialTicks) { - if (System.currentTimeMillis() - leftDungeonTime > 10000) return; + if (System.currentTimeMillis() - leftDungeonTime > 20000) return; FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; GL11.glScaled(scale, scale, 0); - fr.drawString("Cooldown: "+(10 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString("Cooldown: "+(20 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); } @Override @@ -33,17 +34,13 @@ public class FeatureCooldownCounter extends GuiFeature implements TickListener { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; GL11.glScaled(scale, scale, 0); - fr.drawString("Cooldown: 10s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString("Cooldown: 20s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); } SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override - public void onTick() { - if (wasInDungeon && !skyblockStatus.isOnDungeon()) { - if (skyblockStatus.isOnSkyblock()) - leftDungeonTime = System.currentTimeMillis(); - else return; - } - wasInDungeon = skyblockStatus.isOnDungeon(); + public void onDungeonQuit() { + leftDungeonTime = System.currentTimeMillis(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java index 9b2620e4..eef21539 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java @@ -5,6 +5,8 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.gui.FontRenderer; @@ -14,7 +16,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.text.SimpleDateFormat; -public class FeatureDungeonRealTime extends GuiFeature implements TickListener { +public class FeatureDungeonRealTime extends GuiFeature implements DungeonStartListener, DungeonEndListener { public FeatureDungeonRealTime() { super("Dungeon", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); @@ -43,15 +45,13 @@ public class FeatureDungeonRealTime extends GuiFeature implements TickListener { fr.drawString("Time(Real): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - private boolean wasInDungeon = false; @Override - public void onTick() { - if (wasInDungeon && !skyblockStatus.isOnDungeon()) { - if (skyblockStatus.isOnSkyblock()) started = -1; - } else if (!wasInDungeon && skyblockStatus.isOnDungeon()) { - started = System.currentTimeMillis(); - } - wasInDungeon = skyblockStatus.isOnDungeon(); + public void onDungeonEnd() { + started = -1; + } + + @Override + public void onDungeonStart() { + started= System.currentTimeMillis(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java index 65f06f58..88236758 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java @@ -2,10 +2,10 @@ package kr.syeyoung.dungeonsguide.features.impl; import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.events.DungeonEndedEvent; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.features.listener.*; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -19,24 +19,25 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.Collection; -public class FeatureDungeonSBTime extends GuiFeature implements TickListener { +public class FeatureDungeonSBTime extends GuiFeature { + + private SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + public FeatureDungeonSBTime() { super("Dungeon", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color")); } - - private long started = -1; @Override public void drawHUD(float partialTicks) { - if (started == -1) return; + if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; GL11.glScaled(scale, scale, 0); Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); Collection<Score> scores = scoreboard.getSortedScores(objective); - String time = "idkyet"; + String time = "unknown"; for (Score sc:scores) { ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); @@ -77,16 +78,4 @@ public class FeatureDungeonSBTime extends GuiFeature implements TickListener { fr.drawString("Time(Ig): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } - - SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); - private boolean wasInDungeon = false; - @Override - public void onTick() { - if (wasInDungeon && !skyblockStatus.isOnDungeon()) { - if (skyblockStatus.isOnSkyblock()) started = -1; - } else if (!wasInDungeon && skyblockStatus.isOnDungeon()) { - started = System.currentTimeMillis(); - } - wasInDungeon = skyblockStatus.isOnDungeon(); - } } |