diff options
author | syeyoung <cyong06@naver.com> | 2021-04-18 18:28:25 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-04-18 18:28:25 +0900 |
commit | 5a2e091587c613c3bcd7acc58d7b464149c51bdd (patch) | |
tree | 1fc93818b3c6fa9b1433b24c60f99569ba69e646 /src/main/java/kr | |
parent | 23d82b22e5dc9743483cf3ebde848a2c19d9606a (diff) | |
download | Skyblock-Dungeons-Guide-5a2e091587c613c3bcd7acc58d7b464149c51bdd.tar.gz Skyblock-Dungeons-Guide-5a2e091587c613c3bcd7acc58d7b464149c51bdd.tar.bz2 Skyblock-Dungeons-Guide-5a2e091587c613c3bcd7acc58d7b464149c51bdd.zip |
ok great
Diffstat (limited to 'src/main/java/kr')
3 files changed, 29 insertions, 15 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java index 04cb96ba..7a2f43e1 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/RichPresenceManager.java @@ -21,10 +21,11 @@ import java.time.Instant; public class RichPresenceManager implements Runnable { public static RichPresenceManager INSTANCE = new RichPresenceManager(); + private Thread t = new Thread(this); + public RichPresenceManager() { - setup(); - new Thread(this).start(); + t.start(); Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC::discordShutdown)); } public void setup() { @@ -46,10 +47,12 @@ public class RichPresenceManager implements Runnable { .payload(new JSONObject().put("token", joinSecret).toString())); }).setErroredEventHandler((errorCode, message) -> { System.out.println("ERROR! "+errorCode+ " - "+message); - setup(); + t.interrupt(); + (t = new Thread(this)).start(); }).setDisconnectedEventHandler((errorCode, message) -> { System.out.println("ERROR! "+errorCode+ " - "+message); - setup(); + t.interrupt(); + (t = new Thread(this)).start(); }).build(), true); } @@ -99,15 +102,18 @@ public class RichPresenceManager implements Runnable { } @Override public void run() { - while(true) { - try { - DiscordRPC.discordRunCallbacks(); - if (skyblockStatus.isOnSkyblock() && !lastLoc.equalsIgnoreCase(skyblockStatus.getDungeonName())) { - lastLoc = skyblockStatus.getDungeonName()+""; - } - updatePresence(); - Thread.sleep(300L); - } catch (Exception e) {e.printStackTrace();} - } + + try { + Thread.sleep(300L); + setup(); + while(!Thread.interrupted()) { + DiscordRPC.discordRunCallbacks(); + if (skyblockStatus.isOnSkyblock() && !lastLoc.equalsIgnoreCase(skyblockStatus.getDungeonName())) { + lastLoc = skyblockStatus.getDungeonName()+""; + } + updatePresence(); + Thread.sleep(300L); + } + } catch (Exception e) {e.printStackTrace();} } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java index 6e7ef176..2f92873e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java @@ -31,6 +31,12 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; + DungeonContext dc = ss.getContext(); + if (dc == null) { + return; + } + if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; + if (!dc.getBossfightProcessor().getCurrentPhase().equals("terminals")) return; if (orderclick.size() >= 1) RenderUtils.highlightBlock(orderclick.get(0), new Color(0, 255 ,255, 100), partialTicks, false); @@ -46,6 +52,8 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender return; } if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; + if (!dc.getBossfightProcessor().getCurrentPhase().equals("terminals")) return; + World w = dc.getWorld(); if (wasButton && w.getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.air) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java index 9f24edf8..fbb2ebc2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java @@ -33,7 +33,7 @@ public class BossfightProcessorNecron extends GeneralBossfightProcessor { ); addPhase(PhaseData.builder() .phase("fight-2") - .signatureMsg("§r§4[BOSS] Necron§r§c: §r§cTHAT'S IT YOU HAVE DONE IT!§rr") + .signatureMsg("§r§4[BOSS] Necron§r§c: §r§cTHAT'S IT YOU HAVE DONE IT!§r") .nextPhase("won").nextPhase("lost").build() ); addPhase(PhaseData.builder() |