From b382461db0b5fb96271bf548fa5aa89f0981ae05 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Fri, 8 Jan 2021 13:40:43 +0900 Subject: new eventos --- .../features/impl/FeatureDungeonSBTime.java | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java') 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 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 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.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(); - } } -- cgit