diff options
author | syeyoung <cyong06@naver.com> | 2021-02-06 16:39:16 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-06 16:39:16 +0900 |
commit | 3443cf479a1cd6158ab78fcd0e0ea74903009ba3 (patch) | |
tree | 68dae2de00c5ae269c71337b9b580f32b64078b8 /src/main | |
parent | 3c2e3b674458430094ccafd942612771df890c26 (diff) | |
download | Skyblock-Dungeons-Guide-3443cf479a1cd6158ab78fcd0e0ea74903009ba3.tar.gz Skyblock-Dungeons-Guide-3443cf479a1cd6158ab78fcd0e0ea74903009ba3.tar.bz2 Skyblock-Dungeons-Guide-3443cf479a1cd6158ab78fcd0e0ea74903009ba3.zip |
command trialers
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java | 14 | ||||
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java | 58 |
2 files changed, 68 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index 77a337a7..a24d168c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.commands; +import com.google.gson.JsonObject; import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.e; @@ -17,6 +18,8 @@ import javax.crypto.NoSuchPaddingException; import java.io.IOException; import java.security.*; import java.security.cert.CertificateException; +import java.text.SimpleDateFormat; +import java.util.Date; public class CommandDungeonsGuide extends CommandBase { @Override @@ -82,11 +85,19 @@ public class CommandDungeonsGuide extends CommandBase { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fReloaded Ah data")); } else if (args[0].equalsIgnoreCase("brand")) { String serverBrand = Minecraft.getMinecraft().thePlayer.getClientBrand(); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+serverBrand)); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + serverBrand)); } else if (args[0].equalsIgnoreCase("reparty")) { e.getDungeonsGuide().getCommandReparty().requestReparty(); } else if (args[0].equalsIgnoreCase("gui")) { openConfig = true; + } else if (args[0].equalsIgnoreCase("info")) { + JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fCurrent Plan§7: §e" + obj.get("plan").getAsString())); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound to§7: §e" + obj.get("nickname").getAsString())); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound uuid§7: §e" + obj.get("uuid").getAsString())); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSession Expire§7: §e" + sdf.format(new Date(obj.get("exp").getAsLong() * 1000)))); } else { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); @@ -96,6 +107,7 @@ public class CommandDungeonsGuide extends CommandBase { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reloadah §7-§f Reloads price data from server.")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg brand §7-§f View server brand.")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reparty §7-§f Reparty.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg info §7-§f View Current DG User info.")); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 855c31c4..3a0fbb00 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -1,5 +1,7 @@ package kr.syeyoung.dungeonsguide.eventlistener; +import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.a; import kr.syeyoung.dungeonsguide.config.Config; import kr.syeyoung.dungeonsguide.Keybinds; import kr.syeyoung.dungeonsguide.SkyblockStatus; @@ -21,6 +23,8 @@ import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiErrorScreen; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; @@ -35,6 +39,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; @@ -100,9 +105,44 @@ public class DungeonListener { } @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent e) { + public void onTick(TickEvent.ClientTickEvent ev) throws Throwable { try { - if (e.phase == TickEvent.Phase.START) { + if (ev.phase == TickEvent.Phase.START) { + JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + if (!obj.get("uuid").getAsString().equals(Minecraft.getMinecraft().getSession().getProfile().getId().toString())) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiErrorScreen) return; + + final String[] a = new String[]{ + "User has changed current Minecraft session.", + "Please restart mc to revalidate Dungeons Guide" + }; + final GuiScreen b = new GuiErrorScreen(null, null) { + @Override + public void drawScreen(int par1, int par2, float par3) { + super.drawScreen(par1, par2, par3); + for (int i = 0; i < a.length; ++i) { + drawCenteredString(fontRendererObj, a[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); + } + } + + @Override + public void initGui() { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, width / 2 - 50, height - 50, 100,20, "close")); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + System.exit(-1); + } + }; + Minecraft.getMinecraft().displayGuiScreen(b); + return; + } + + + SkyblockStatus skyblockStatus = (SkyblockStatus) kr.syeyoung.dungeonsguide.e.getDungeonsGuide().getSkyblockStatus(); { boolean isOnDungeon = skyblockStatus.isOnDungeon(); @@ -146,13 +186,25 @@ public class DungeonListener { } } } - } catch (Throwable e2) {e2.printStackTrace();} + } catch (Throwable e2) { + if (e2 instanceof CustomModLoadingErrorDisplayException) throw e2; + e2.printStackTrace(); + } } @SubscribeEvent public void onRender(RenderGameOverlayEvent.Post postRender) { try { if (postRender.type != RenderGameOverlayEvent.ElementType.TEXT) return; + + JsonObject obj = e.getDungeonsGuide().getAuthenticator().a(e.getDungeonsGuide().getAuthenticator().c()); + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (obj.get("plan").getAsString().equalsIgnoreCase("TRIAL")) { + fr.drawString("Using trial Version of Dungeons Guide", 0,0, 0xFFFFFFFF); + fr.drawString("Trial version bound to: "+obj.get("nickname").getAsString(), 0,10, 0xFFFFFFFF); + } + + SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; |