From 0fd1db8571a2215499f671b447e20f335ef6c00f Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 20 Mar 2021 12:45:55 +0900 Subject: PAUL INTEGRATION --- .../features/impl/dungeon/FeatureDungeonScore.java | 27 +++++++++++++++++++++- .../features/impl/etc/FeatureUpdateAlarm.java | 4 ++++ .../impl/etc/ability/FeatureAbilityCooldown.java | 1 - 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src/main/java/kr') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java index 97e337d4..c3439727 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java @@ -5,12 +5,18 @@ import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener; import kr.syeyoung.dungeonsguide.features.text.StyledText; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.features.text.TextStyle; +import kr.syeyoung.dungeonsguide.stomp.StompInterface; +import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler; +import kr.syeyoung.dungeonsguide.stomp.StompPayload; +import kr.syeyoung.dungeonsguide.stomp.StompSubscription; import kr.syeyoung.dungeonsguide.utils.TextUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -19,6 +25,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; @@ -27,7 +34,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class FeatureDungeonScore extends TextHUDFeature { +public class FeatureDungeonScore extends TextHUDFeature implements StompConnectedListener, StompMessageHandler { public FeatureDungeonScore() { super("Dungeon", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); this.setEnabled(false); @@ -149,8 +156,25 @@ public class FeatureDungeonScore extends TextHUDFeature { return actualBit; } + @Override + public void onStompConnected(StompConnectedEvent event) { + event.getStompInterface().subscribe(StompSubscription.builder() + .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/topic/dungeon.bonusscore").build()); + event.getStompInterface().subscribe(StompSubscription.builder() + .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/dungeon.bonusscore").build()); + event.getStompInterface().send(new StompPayload().header("destination", "/app/dungeon.bonusscore.req")); + } + private int mayorScore = 0; + @Override + public void handle(StompInterface stompInterface, StompPayload stompPayload) { + try { + mayorScore = Integer.parseInt(stompPayload.payload().trim()); + System.out.println("mayor " +mayorScore); + } catch (Exception e) { + } + } @Data @@ -263,6 +287,7 @@ public class FeatureDungeonScore extends TextHUDFeature { { bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5); if (context.isGotMimic()) bonus += 2; + bonus += mayorScore; } // amazing thing diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java index 85bb3398..858e05bd 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java @@ -41,5 +41,9 @@ public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedL .destination("/topic/updates") .ackMode(StompSubscription.AckMode.AUTO) .stompMessageHandler(this).build()); + event.getStompInterface().subscribe(StompSubscription.builder() + .destination("/user/queue/messages") + .ackMode(StompSubscription.AckMode.AUTO) + .stompMessageHandler(this).build()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java index 1b66f371..1f568d49 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java @@ -261,7 +261,6 @@ public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListen @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) { - System.out.println(clientChatReceivedEvent.message.getFormattedText()); Matcher m = thePattern.matcher(clientChatReceivedEvent.message.getFormattedText()); if (m.find()) { String name = m.group(2)+":"+m.group(1); -- cgit