aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features/impl
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-03-01 22:36:06 +0900
committersyeyoung <cyong06@naver.com>2021-03-01 22:36:06 +0900
commitc8f4ff4acbd9c723e87b519b8516558a5ca97a65 (patch)
tree856f5a806bce55387f1c70e37544a4ab0419f411 /src/main/java/kr/syeyoung/dungeonsguide/features/impl
parentca37e92e857b8de791f9ddea16743c4139fe9880 (diff)
downloadSkyblock-Dungeons-Guide-c8f4ff4acbd9c723e87b519b8516558a5ca97a65.tar.gz
Skyblock-Dungeons-Guide-c8f4ff4acbd9c723e87b519b8516558a5ca97a65.tar.bz2
Skyblock-Dungeons-Guide-c8f4ff4acbd9c723e87b519b8516558a5ca97a65.zip
stomp!
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureBlah.java)31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureBlah.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java
index 16c99db2..85bb3398 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureBlah.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java
@@ -1,7 +1,9 @@
package kr.syeyoung.dungeonsguide.features.impl.etc;
import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.events.StompConnectedEvent;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
+import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener;
import kr.syeyoung.dungeonsguide.features.listener.TickListener;
import kr.syeyoung.dungeonsguide.stomp.StompInterface;
import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler;
@@ -13,26 +15,31 @@ import net.minecraft.util.ChatComponentText;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
-public class FeatureBlah extends SimpleFeature implements StompMessageHandler, TickListener {
- public FeatureBlah() {
- super("ETC", "TEST","test.test");
- e.getDungeonsGuide().getStompConnection().subscribe(StompSubscription.builder()
- .destination("/topic/updates")
- .ackMode(StompSubscription.AckMode.AUTO)
- .stompMessageHandler(this).build());
+public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, StompMessageHandler, TickListener {
+ public FeatureUpdateAlarm() {
+ super("ETC", "Update Alarm","Show a warning on chat when new update has bnee released.", "etc.updatealarm", true);
}
- Queue<StompPayload> stompPayloadQueue = new ConcurrentLinkedQueue<StompPayload>();
+ private StompPayload stompPayload;
@Override
public void handle(StompInterface stompInterface, StompPayload stompPayload) {
- stompPayloadQueue.add(stompPayload);
+ this.stompPayload = stompPayload;
}
-
@Override
public void onTick() {
- while (!stompPayloadQueue.isEmpty()) {
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(stompPayloadQueue.poll().payload()));
+ if (stompPayload != null) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(stompPayload.payload()));
+ stompPayload = null;
+ Minecraft.getMinecraft().thePlayer.playSound("random.successful_hit", 1f,1f);
}
}
+
+ @Override
+ public void onStompConnected(StompConnectedEvent event) {
+ event.getStompInterface().subscribe(StompSubscription.builder()
+ .destination("/topic/updates")
+ .ackMode(StompSubscription.AckMode.AUTO)
+ .stompMessageHandler(this).build());
+ }
}