aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java22
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java65
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java19
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java20
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java27
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java5
21 files changed, 191 insertions, 50 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
index ab3f8519..0015672e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
@@ -6,4 +6,8 @@ public class AColor extends Color {
public AColor(int r, int g, int b, int a) {
super(r, g, b, a);
}
+
+ public AColor(int rgba, boolean hasalpha) {
+ super(rgba, hasalpha);
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
index bce13c26..2b37b258 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
@@ -13,7 +13,7 @@ public class TCAColor implements TypeConverter<Color> {
@Override
public Color deserialize(JsonElement element) {
- return new Color(element.getAsInt());
+ return new AColor(element.getAsInt(), true);
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
index 0bf0d9e5..df8c41f2 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
@@ -6,6 +6,7 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider;
+import kr.syeyoung.dungeonsguide.events.DungeonContextInitializationEvent;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
import lombok.Getter;
import net.minecraft.client.Minecraft;
@@ -14,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.storage.MapData;
+import net.minecraftforge.common.MinecraftForge;
import javax.vecmath.Vector2d;
import java.awt.*;
@@ -37,6 +39,9 @@ public class MapProcessor {
private boolean axisMatch = false;
@Getter
+ private boolean initialized = false;
+
+ @Getter
private int undiscoveredRoom = 0;
public MapProcessor(DungeonContext context) {
@@ -143,6 +148,8 @@ public class MapProcessor {
e.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension));
e.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint));
e.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension));
+ initialized = true;
+ MinecraftForge.EVENT_BUS.post(new DungeonContextInitializationEvent());
}
public Point mapPointToRoomPoint(Point mapPoint) {
@@ -176,6 +183,7 @@ public class MapProcessor {
DungeonRoom dungeonRoom = context.getRoomMapper().get(new Point(x,y));
if (color == 30 || color == 18) {
dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED);
+ dungeonRoom.setTotalSecrets(0);
} else {
byte centerColor = MapUtils.getMapColorAt(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2);
MapUtils.record(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2, new Color(0,255,0,80));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
index fcd31ab8..536476eb 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
@@ -7,6 +7,10 @@ import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.events.DungeonLeftEvent;
+import kr.syeyoung.dungeonsguide.events.DungeonStartedEvent;
+import kr.syeyoung.dungeonsguide.events.SkyblockJoinedEvent;
+import kr.syeyoung.dungeonsguide.events.SkyblockLeftEvent;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.roomedit.EditingContext;
import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet;
@@ -28,11 +32,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.GL11;
+import scala.collection.parallel.ParIterableLike;
import java.awt.*;
@@ -44,8 +50,17 @@ public class DungeonListener {
SkyblockStatus skyblockStatus = (SkyblockStatus) kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus();
{
boolean isOnDungeon = skyblockStatus.isOnDungeon();
+ boolean isOnSkyblock = skyblockStatus.isOnSkyblock();
skyblockStatus.updateStatus();
- if (!skyblockStatus.isOnDungeon()) {
+
+ if (isOnSkyblock && !skyblockStatus.isOnSkyblock()) {
+ MinecraftForge.EVENT_BUS.post(new SkyblockLeftEvent());
+ } else if (!isOnSkyblock && skyblockStatus.isOnSkyblock()) {
+ MinecraftForge.EVENT_BUS.post(new SkyblockJoinedEvent());
+ }
+
+ if (isOnDungeon && !skyblockStatus.isOnDungeon()) {
+ MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent());
skyblockStatus.setContext(null);
MapUtils.clearMap();
return;
@@ -53,7 +68,10 @@ public class DungeonListener {
if (isOnDungeon) {
skyblockStatus.getContext().tick();
}
- else skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj));
+ else {
+ skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj));
+ MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent());
+ }
}
if (!skyblockStatus.isOnDungeon()) return;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
index 11531352..c63b5e51 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
@@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.eventlistener;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.config.guiconfig.GuiGuiLocationConfig;
import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.events.*;
import kr.syeyoung.dungeonsguide.features.*;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.listener.*;
@@ -159,4 +160,68 @@ public class FeatureListener {
t.printStackTrace();
}
}
+
+ @SubscribeEvent
+ public void onSkyblockJoin(SkyblockJoinedEvent joinedEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof SkyblockJoinListener) {
+ ((SkyblockJoinListener) abstractFeature).onSkyblockJoin();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onSkyblockQuit(SkyblockLeftEvent leftEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof SkyblockLeaveListener) {
+ ((SkyblockLeaveListener) abstractFeature).onSkyblockQuit();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onDungeonStart(DungeonStartedEvent leftEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof DungeonStartListener) {
+ ((DungeonStartListener) abstractFeature).onDungeonStart();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onDungeonLeft(DungeonLeftEvent leftEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof DungeonQuitListener) {
+ ((DungeonQuitListener) abstractFeature).onDungeonQuit();
+ }
+ if (abstractFeature instanceof DungeonEndListener) {
+ ((DungeonEndListener) abstractFeature).onDungeonEnd();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onDungeonInitialize(DungeonContextInitializationEvent leftEvent) {
+ try {
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof DungeonContextInitializationListener) {
+ ((DungeonContextInitializationListener) abstractFeature).onDungeonInitialize();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java
index 9252a03d..3406f205 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java
@@ -40,12 +40,6 @@ public class PacketListener extends ChannelDuplexHandler {
@SubscribeEvent
public void onServerConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
- if (event.manager.channel().pipeline().get("dg_packet_handler") != null)
- event.manager.channel().pipeline().remove(this);
- try {
- event.manager.channel().pipeline().addBefore("packet_handler", "dg_packet_handler", this);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ event.manager.channel().pipeline().addBefore("packet_handler", "dg_packet_handler", this);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java
new file mode 100644
index 00000000..8364cde4
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class DungeonContextInitializationEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java
new file mode 100644
index 00000000..15445abe
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class DungeonEndedEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java
new file mode 100644
index 00000000..62253762
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class DungeonLeftEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java
new file mode 100644
index 00000000..0c4864de
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class DungeonStartedEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java
new file mode 100644
index 00000000..ce8338f0
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class SkyblockJoinedEvent extends Event {
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java
new file mode 100644
index 00000000..6ddf0fa0
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java
@@ -0,0 +1,6 @@
+package kr.syeyoung.dungeonsguide.events;
+
+import net.minecraftforge.fml.common.eventhandler.Event;
+
+public class SkyblockLeftEvent extends Event {
+}
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();
- }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java
new file mode 100644
index 00000000..4fe3630e
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface DungeonContextInitializationListener {
+ void onDungeonInitialize();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java
new file mode 100644
index 00000000..89363aef
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface DungeonEndListener {
+ void onDungeonEnd();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java
new file mode 100644
index 00000000..040e40eb
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface DungeonQuitListener {
+ void onDungeonQuit();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java
new file mode 100644
index 00000000..60e2d141
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface DungeonStartListener {
+ void onDungeonStart();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java
new file mode 100644
index 00000000..f32ce8fa
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface SkyblockJoinListener {
+ void onSkyblockJoin();
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java
new file mode 100644
index 00000000..59e6d193
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface SkyblockLeaveListener {
+ void onSkyblockQuit();
+}