diff options
38 files changed, 479 insertions, 28 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java index fb6acadf..6ea7bbfa 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -23,6 +23,8 @@ import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil; import kr.syeyoung.dungeonsguide.launcher.exceptions.*; import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiDisplayer; import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetError; +import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetPrivacyPolicy; +import kr.syeyoung.dungeonsguide.launcher.gui.screen.WidgetPrivacyPolicyLocal; import kr.syeyoung.dungeonsguide.launcher.gui.screen.version.WidgetChooseVersion; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.Notification; import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.NotificationManager; @@ -332,6 +334,15 @@ public class Main if (dgInterface != null) dgInterface.onResourceReload(a); DefaultFontRenderer.DEFAULT_RENDERER.onResourceManagerReload(); }); +// UUID uid = UUID.randomUUID(); +// NotificationManager.getInstance().updateNotification(uid, new WidgetNotification(uid, Notification.builder() +// .title("Privacy Policy") +// .description("Please accept Dungeons Guide\nPrivacy Policy to enjoy server based\nfeatures of Dungeons Guide\n\n(Including Auto-Update/Remote-Jar)") +// .titleColor(0xFFFF0000) +// .onClick(() -> { +// GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(new GlobalHUDScale(new WidgetPrivacyPolicyLocal()))); +// }) +// .build())); } public static Main getMain() { diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java new file mode 100644 index 00000000..eb5eca2f --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/WidgetPrivacyPolicyLocal.java @@ -0,0 +1,94 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.launcher.gui.screen; + +import kr.syeyoung.dungeonsguide.launcher.LetsEncrypt; +import kr.syeyoung.dungeonsguide.launcher.LoaderMeta; +import kr.syeyoung.dungeonsguide.launcher.Main; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.launcher.guiv2.BindableAttribute; +import kr.syeyoung.dungeonsguide.launcher.guiv2.Widget; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.DomElementRegistry; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.ParsedWidgetConverter; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.annotations.Bind; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.annotations.On; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.data.ParserElement; +import kr.syeyoung.dungeonsguide.launcher.guiv2.xml.data.W3CBackedParser; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.ResourceLocation; + +import javax.net.ssl.HttpsURLConnection; +import java.net.URL; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class WidgetPrivacyPolicyLocal extends AnnotatedImportOnlyWidget { + public static final ExecutorService executor = Executors.newSingleThreadExecutor(); + @Bind(variableName = "policy") + public final BindableAttribute<Widget> policy = new BindableAttribute<>(Widget.class); + @Bind(variableName = "policyVisibility") + public final BindableAttribute<String> policyVisibility = new BindableAttribute<>(String.class, "loading"); + + @Bind(variableName = "policyVersion") + public final BindableAttribute<Integer> version = new BindableAttribute<>(Integer.class, 0); + + public WidgetPrivacyPolicyLocal() { + super(new ResourceLocation("dungeons_guide_loader:gui/privacyPolicy/privacyPolicy.gui")); + reload0(); + } + + @On(functionName = "accept") + public void accept() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + AuthManager.getInstance().acceptPrivacyPolicy(version.getValue()); + Minecraft.getMinecraft().displayGuiScreen(null); + } + @On(functionName = "deny") + public void deny() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().displayGuiScreen(null); + } + + + public void reload0() { + policyVisibility.setValue("loading"); + executor.submit(() -> { + try { + + try (W3CBackedParser parser = new W3CBackedParser(WidgetPrivacyPolicyLocal.class.getResourceAsStream("/privacyPolicyTest.gui"))) { + ParserElement element = parser.getRootNode(); + ParsedWidgetConverter converter = DomElementRegistry.obtainConverter(element.getNodeName()); + Widget w = converter.convert(this, element); + policy.setValue(w); + policyVisibility.setValue("loaded"); + } + } catch (Exception e) { + e.printStackTrace(); + policyVisibility.setValue("failed"); + } + }); + } + @On(functionName = "reload") + public void reload() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + reload0(); + } +} diff --git a/loader/src/main/resources/privacyPolicyTest.gui b/loader/src/main/resources/privacyPolicyTest.gui new file mode 100644 index 00000000..988a0d8b --- /dev/null +++ b/loader/src/main/resources/privacyPolicyTest.gui @@ -0,0 +1,43 @@ +<!-- + ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + ~ Copyright (C) 2023 cyoung06 (syeyoung) + ~ + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU Affero General Public License as published + ~ by the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU Affero General Public License for more details. + ~ + ~ You should have received a copy of the GNU Affero General Public License + ~ along with this program. If not, see <https://www.gnu.org/licenses/>. + --> + +<padding left="10" top="10" right="10" bottom="10"> + <col crossAlign="STRETCH"> + <PolicyVersion version="2" bind:policyVersion="policyVersion"/> + <Text text="Dungeons Guide Privacy Policy" size="16" align="CENTER"/> + <size width="0" height="5"/> + <Text text="Last updated 12, Nov, 2023" align="RIGHT"/> + <size width="0" height="10"/> + <Text text="Privacy Policy Summary" size="16" align="LEFT"/> + <size width="0" height="10"/> + <Text text="§lWhat data we collect" size="12" align="LEFT"/> + <size width="0" height="10"/> + <Text text="Dungeons Guide collects the following information from users who accept our Privacy Policy and Terms of Service through their continued use of the platform, products, and services:" size="8" align="LEFT"/> + <size width="0" height="5"/> + <Text text="- Minecraft username and UUID" size="8" align="LEFT"/> + <Text text="- users' Hypixel party members" size="8" align="LEFT"/> + <Text text="- The time users last contacted Dungeons Guide backend" size="8" align="LEFT"/> + <Text text="- Dungeon Scores users get (This is anonymized, and it is to reverse engineer the time score formula)" size="8" align="LEFT"/> + <Text text="- Dungeons Guide Error Stacktraces (This is anonymized, Opt out at /dg -> Misc -> Collect Error Logs) Only Applicable to users using 4.0.0-beta8.4 or later." size="8" align="LEFT"/> + <size width="0" height="20"/> + <Text text="Privacy Policy" size="16" align="LEFT"/> + <Text text="There still isn't anything here currently" align="LEFT"/> + <Text text="You will be prompted to accept to the privacy policy again when it actually gets added" align="LEFT"/> + <Text text="The above section exists for the purpose to inform users about the data we collect currently" align="LEFT"/> + </col> +</padding>
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java index c55d21cd..15329e9b 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java @@ -37,6 +37,7 @@ import kr.syeyoung.dungeonsguide.mod.events.listener.DungeonListener; import kr.syeyoung.dungeonsguide.mod.events.listener.PacketInjector; import kr.syeyoung.dungeonsguide.mod.events.listener.PacketListener; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.richtext.fonts.DefaultFontRenderer; import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java index 37b6c212..8f327986 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/VersionInfo.java @@ -24,6 +24,7 @@ import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch; import kr.syeyoung.dungeonsguide.launcher.branch.UpdateRetrieverUtil; import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiDisplayer; import kr.syeyoung.dungeonsguide.launcher.loader.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Scaler; @@ -53,6 +54,7 @@ public class VersionInfo { VERSION1 = properties.getProperty("VERSION"); MANDATORY_VERSION1 = Integer.parseInt(properties.getProperty("MANDATORY_VERSION", "0")); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); VERSION1 = "unknown"; MANDATORY_VERSION1 = 0; e.printStackTrace(); @@ -133,6 +135,7 @@ public class VersionInfo { logger.error("Failed to check version: Unknown Loader: " + VersionInfo.getLoaderInfo() + " / " + VersionInfo.getCurrentLoader().getClass().getName()); } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); logger.error("Error while checking for updates: ",e); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java index a5eb360f..f8e89c63 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.chat; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiNewChat; import net.minecraft.util.ChatComponentText; @@ -81,6 +82,7 @@ public class ChatProcessor { } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -108,6 +110,7 @@ public class ChatProcessor { if (chatProcessResult.isRemoveChat()) chatReceivedEvent.setResult(Event.Result.DENY); if (chatProcessResult.isRemoveListener()) it.remove(); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java index b120499e..c67128ff 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -27,6 +27,7 @@ import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfi import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; import kr.syeyoung.dungeonsguide.mod.discord.DiscordIntegrationManager; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureViewPlayerStatsOnJoin; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.HoverEventRenderPlayer; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; @@ -216,6 +217,7 @@ public class CommandDungeonsGuide extends CommandBase { target = null; } } catch (Exception t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); t.printStackTrace(); } } @@ -272,6 +274,7 @@ public class CommandDungeonsGuide extends CommandBase { ))))); }); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -299,6 +302,7 @@ public class CommandDungeonsGuide extends CommandBase { .put("payload", actualPayload).toString() )); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java index 2d73ff92..c31b6829 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java @@ -25,6 +25,7 @@ import kr.syeyoung.dungeonsguide.mod.cosmetics.surgical.SurgicalReplacer; import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerListItemPacketEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.stomp.StompHeader; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; @@ -166,7 +167,9 @@ public class CosmeticsManager { EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(activeCosmetic.getPlayerUID()); if (entityPlayer != null) entityPlayer.refreshDisplayName(); } - } catch (Exception exception) {exception.printStackTrace();} + } catch (Exception exception) { + FeatureCollectDiagnostics.queueSendLogAsync(exception); + exception.printStackTrace();} }); @@ -199,7 +202,8 @@ public class CosmeticsManager { EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(cosmeticData.getPlayerUID()); if (entityPlayer != null) entityPlayer.refreshDisplayName(); } - } catch (Exception exception) {exception.printStackTrace();} + } catch (Exception exception) { + FeatureCollectDiagnostics.queueSendLogAsync(exception);exception.printStackTrace();} } rebuildCaches(); }); @@ -254,6 +258,7 @@ public class CosmeticsManager { contextThreadLocal.set(total); } catch (Exception t) { System.out.println(clientChatReceivedEvent.message); + FeatureCollectDiagnostics.queueSendLogAsync(t); t.printStackTrace(); } } @@ -368,6 +373,7 @@ public class CosmeticsManager { } clientChatReceivedEvent.message = SurgicalReplacer.combine(chatComponents); } catch (Exception t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); System.out.println(clientChatReceivedEvent.message); t.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java index 86cf868c..b60ef7a7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java @@ -32,6 +32,7 @@ import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.Reply; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.party.PartyContext; import kr.syeyoung.dungeonsguide.mod.party.PartyManager; import lombok.Getter; @@ -127,6 +128,7 @@ public class DiscordIntegrationManager implements IPCListener { System.out.println("Connecting"); } catch (NoDiscordClientException ignored) { } catch (Exception t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); t.printStackTrace(); } } @@ -184,7 +186,8 @@ public class DiscordIntegrationManager implements IPCListener { JDiscordRelation relation = JDiscordRelation.parse(obj); relationMap.put(relation.getDiscordUser().getIdLong(), relation); } - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e);e.printStackTrace();} } private void sendRichPresence(RichPresence presence) { @@ -241,6 +244,7 @@ public class DiscordIntegrationManager implements IPCListener { updatePresence(); } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); // let thread just die if catastrophic failure occurs. } try { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java index 9ee4a55a..2b721192 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java @@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.dungeon; import kr.syeyoung.dungeonsguide.launcher.Main; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import lombok.Getter; import lombok.Setter; @@ -47,6 +48,7 @@ public class DungeonFacade { DungeonRoomInfoRegistry.loadAll(Main.getConfigDir()); } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | IOException | NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/PathfinderExecutorExecutor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/PathfinderExecutorExecutor.java index fc991023..c7bf2e2a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/PathfinderExecutorExecutor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/PathfinderExecutorExecutor.java @@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.mod.dungeon; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding.algorithms.PathfinderExecutor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import net.minecraft.client.Minecraft; import net.minecraft.util.BlockPos; import scala.reflect.internal.util.WeakHashSet; @@ -70,6 +71,7 @@ public class PathfinderExecutorExecutor extends Thread{ } // Thread.yield(); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); // wtf? try { Thread.sleep(1000); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java index ea1ce09b..04eac305 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java @@ -42,6 +42,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.ProcessorFactory; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.features.impl.secret.FeaturePathfindStrategy; import lombok.AllArgsConstructor; import lombok.Getter; @@ -222,8 +223,10 @@ public class DungeonRoom { matchRoomAndSetupRoomProcessor(); matched = true; } catch (Exception e) { - if (e.getMessage() == null || !e.getMessage().contains("Chunk not loaded")) + if (e.getMessage() == null || !e.getMessage().contains("Chunk not loaded")) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); + } } finally { matching = false; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java index e8088828..337bfe7d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java @@ -23,6 +23,7 @@ import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Getter; @@ -78,6 +79,7 @@ public class RoomProcessorIcePath extends GeneralRoomProcessor { buildMap(); err = false; } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); err = true; return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java index a96b23e6..224279fe 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java @@ -38,6 +38,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.n import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.AllArgsConstructor; @@ -206,6 +207,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { ch.getRight().getProcessor().onDataReceive(compound); } } catch (Exception t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); t.printStackTrace(); ChatTransmitter.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java index cca070e7..cefb4431 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java @@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.entity.boss.BossStatus; @@ -99,6 +100,7 @@ public class BossfightProcessorThorn extends GeneralBossfightProcessor { new Color(0, 255, 0, 50) : new Color(255,0,0, 50), partialTicks, false); } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java index 1171027a..47fea6b2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java @@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -64,6 +65,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { bugged = false; } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java index 66140160..1f018524 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java @@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -84,6 +85,7 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { solution.add(poses); }).start(); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java index fccfcaa1..e9915a0d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java @@ -24,6 +24,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockLever; @@ -226,6 +227,7 @@ public class RoomProcessorWaterPuzzle extends GeneralRoomProcessor { } } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java index 46fff031..0dd8f261 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java @@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.events.annotations; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.features.IFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import lombok.AllArgsConstructor; import lombok.Getter; import net.minecraft.client.Minecraft; @@ -127,8 +128,10 @@ public class EventHandlerRegistry { target.invokeSite.invoke(event); } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); logger.error("An error occurred while handling event: \nFeature = " + target.getFeature().getClass().getName(), e); } catch (Throwable t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); throw new RuntimeException("An catastrophic error occured while handling event: ", t); } profiler.endSection(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java index 811f1678..a16822e2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java @@ -35,6 +35,7 @@ import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; import kr.syeyoung.dungeonsguide.mod.events.impl.*; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.scoreboard.ScoreboardManager; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.tab.TabList; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.teams.TeamManager; @@ -83,6 +84,7 @@ public class DungeonListener { try { Config.saveConfig(); } catch (IOException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } DungeonActionContext.getSpawnLocation().clear(); @@ -173,6 +175,7 @@ public class DungeonListener { MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent()); } } catch (IllegalStateException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); if (! "?".equals(e.getMessage())) { e.printStackTrace(); } @@ -376,6 +379,7 @@ public class DungeonListener { } } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java index 2362d5d6..72f68111 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java @@ -22,6 +22,7 @@ import io.netty.channel.*; import kr.syeyoung.dungeonsguide.mod.events.impl.PacketProcessedEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.RawPacketReceivedEvent; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import net.minecraft.client.Minecraft; import net.minecraft.network.Packet; import net.minecraft.network.play.client.C02PacketUseEntity; @@ -64,6 +65,7 @@ public class PacketInjector extends ChannelDuplexHandler { packet = receivedEvent.packet; } } catch (Exception t) { + FeatureCollectDiagnostics.queueSendLogAsync(t); t.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java index 6adcaf9e..2b766e9a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java @@ -22,6 +22,7 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.events.impl.*; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.map.MapDataManager; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.scoreboard.Objective; import kr.syeyoung.dungeonsguide.mod.parallelUniverse.scoreboard.ScoreboardManager; @@ -56,6 +57,7 @@ public class PacketListener { } event.packet = packet; } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index 21267a61..d08964f8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -247,6 +247,8 @@ public class FeatureRegistry { // Misc + public static final FeatureCollectDiagnostics COLLECT_ERRORS = register(new FeatureCollectDiagnostics()); + // HUD public static final FeatureAbilityCooldown ETC_ABILITY_COOLDOWN = register(new FeatureAbilityCooldown()); public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java index 0d88cdcd..c22ce513 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java @@ -22,6 +22,7 @@ import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -178,6 +179,7 @@ public class PrefixSelectorGUI extends MPanel { selected = value; } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCollectDiagnostics.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCollectDiagnostics.java new file mode 100644 index 00000000..ba666471 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCollectDiagnostics.java @@ -0,0 +1,144 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; + + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.launcher.LetsEncrypt; +import kr.syeyoung.dungeonsguide.launcher.Main; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiDisplayer; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.VersionInfo; +import kr.syeyoung.dungeonsguide.mod.WidgetUpdateLog; +import kr.syeyoung.dungeonsguide.mod.config.types.TCBoolean; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; +import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Scaler; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedImportOnlyWidget; +import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; + +import javax.net.ssl.HttpsURLConnection; +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class FeatureCollectDiagnostics extends SimpleFeature { + private final Map<String, Long> lastSent = new HashMap<>(); + public FeatureCollectDiagnostics() { + super("Misc", "Collect Error Logs", "Enable to allow sending mod errors to developers server\n\nThis option sends Stacktraces to developers server\n\nDisable to opt out of it", "misc.diagnostics_logcollection", false); + addParameter("prompted", new FeatureParameter<Boolean>("prompted", "Was this prompted?", "Did this feature prompt for user apporval yet?", false, TCBoolean.INSTANCE)); + } + + public class WidgetUserApproval extends AnnotatedImportOnlyWidget { + public WidgetUserApproval() { + super(new ResourceLocation("dungeonsguide:gui/collect_diagnostic_approval.gui")); + } + + @On(functionName = "approve") + public void onApprove() { + FeatureCollectDiagnostics.this.<Boolean>getParameter("prompted").setValue(true); + FeatureCollectDiagnostics.this.setEnabled(true); + Minecraft.getMinecraft().displayGuiScreen(null); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + } + + @On(functionName = "deny") + public void onDeny() { + FeatureCollectDiagnostics.this.<Boolean>getParameter("prompted").setValue(true); + FeatureCollectDiagnostics.this.setEnabled(false); + Minecraft.getMinecraft().displayGuiScreen(null); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + } + } + + @Override + public void loadConfig(JsonObject jsonObject) { + super.loadConfig(jsonObject); + + Scaler scaler = new Scaler(); + scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); + scaler.child.setValue(new WidgetUserApproval()); + GuiDisplayer.INSTANCE.displayGui(new GuiScreenAdapter(scaler, null, false)); + + } + + public static final Executor executorService = Executors + .newSingleThreadExecutor(new ThreadFactoryBuilder() + .setThreadFactory(DungeonsGuide.THREAD_FACTORY) + .setNameFormat("DG-Error-Reporter-%d").build()); + + public static void queueSendLogAsync(Throwable t) { + executorService.execute(() -> { + try { + FeatureRegistry.COLLECT_ERRORS.sendLogActually(t); + } catch (Exception ignored) {ignored.printStackTrace();} + }); + } + + private void sendLogActually(Throwable t) throws IOException { + if (!isEnabled()) return; + String token = AuthManager.getInstance().getWorkingTokenOrThrow(); // this require privacy policy. + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + + t.printStackTrace(pw); + + String trace = sw.toString(); + + if (lastSent.getOrDefault(trace, 0L) + 60*1000 > System.currentTimeMillis()) { // don't send same thing for 1m + return; + } + lastSent.put(trace, System.currentTimeMillis()); + + HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(Main.DOMAIN+"/logging/stacktrace").openConnection(); + urlConnection.setRequestMethod("POST"); + urlConnection.setDoOutput(true); + urlConnection.setDoInput(true); + urlConnection.setSSLSocketFactory(LetsEncrypt.LETS_ENCRYPT); + urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/"+ VersionInfo.VERSION); + urlConnection.setConnectTimeout(10000); + urlConnection.setReadTimeout(10000); + urlConnection.setRequestProperty("Authorization", "Bearer "+token); + urlConnection.getOutputStream().write(trace.getBytes(StandardCharsets.UTF_8)); + int code = urlConnection.getResponseCode(); // make sure to send req actually + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java index c929911a..c0f911f5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java @@ -22,6 +22,7 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party; import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler; import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -113,6 +114,7 @@ public class FeatureGoodParties extends SimpleFeature { } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } GlStateManager.colorMask(true, true, true, true); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java index 775fb474..94a54505 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java @@ -24,6 +24,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.*; import kr.syeyoung.dungeonsguide.mod.utils.XPUtils; @@ -239,6 +240,7 @@ public class PlayerProfileParser { try { calculateLilyWeight(playerProfile, playerData); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } return playerProfile; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/TextHUDFeature.java index d0faf0db..a9344085 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/richtext/TextHUDFeature.java @@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.events.impl.DGTickEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.SkyblockLeftEvent; import kr.syeyoung.dungeonsguide.mod.features.AbstractHUDFeature; import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.features.richtext.config.WidgetTextStyleConfig; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; @@ -76,6 +77,7 @@ public abstract class TextHUDFeature extends AbstractHUDFeature { richText.setRootSpan(asd); } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -84,7 +86,8 @@ public abstract class TextHUDFeature extends AbstractHUDFeature { public void onSkyblockExit(SkyblockLeftEvent skyblockLeftEvent) { try { checkVisibility(); - } catch (Exception e) {} + } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e);} } public static FontRenderer getFontRenderer() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java index 3f852e63..c778c5f0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.features.text; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -74,6 +75,7 @@ public class StyledTextRenderer { d = drawFragmentText(fr, str, ts, currX, currY, false); Minecraft.getMinecraft().mcProfiler.endSection(); } catch (InvocationTargetException | IllegalAccessException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } associateds.add(new StyleTextAssociated(st, new Rectangle(currX, currY, d.width, d.height))); @@ -113,6 +115,7 @@ public class StyledTextRenderer { try { d = drawFragmentText(fr, str, ts, currX, currY, true); } catch (InvocationTargetException | IllegalAccessException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } associateds.add(new StyleTextAssociated(st, new Rectangle(currX, currY, d.width, d.height))); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java index 1cf20cca..0917a04f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.gui; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.gui.elements.MRootPanel; import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import kr.syeyoung.dungeonsguide.mod.utils.cursor.GLCursors; @@ -82,6 +83,7 @@ public class MGui extends GuiScreen { mainPanel.keyPressed0(typedChar, keyCode); super.keyTyped(typedChar, keyCode); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } @@ -91,7 +93,8 @@ public class MGui extends GuiScreen { try { mainPanel.keyHeld0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -100,7 +103,8 @@ public class MGui extends GuiScreen { try { mainPanel.keyReleased0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -112,7 +116,8 @@ public class MGui extends GuiScreen { mainPanel.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -137,7 +142,8 @@ public class MGui extends GuiScreen { mainPanel.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -148,7 +154,8 @@ public class MGui extends GuiScreen { mainPanel.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -158,6 +165,7 @@ public class MGui extends GuiScreen { mainPanel.mouseMoved0(mouseX, mouseY , mouseX, mouseY); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } @@ -216,6 +224,7 @@ public class MGui extends GuiScreen { try { mainPanel.mouseScrolled0(i, j, i, j, wheel); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java index b1c26b37..ee351100 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.guiv2; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size; @@ -39,6 +40,7 @@ import java.io.IOException; import java.util.Stack; import static org.lwjgl.opengl.GL11.GL_GREATER; +import static org.lwjgl.opengl.GL11.glCallList; public class GuiScreenAdapter extends GuiScreen { @@ -49,11 +51,16 @@ public class GuiScreenAdapter extends GuiScreen { private Stack<RootDom> domStack = new Stack<>(); private GuiScreen parent; + private boolean allowEsc; public GuiScreenAdapter(Widget widget) { - this(widget, null); + this(widget, null, true); } public GuiScreenAdapter(Widget widget, GuiScreen parent) { + this(widget, parent, true); + } + public GuiScreenAdapter(Widget widget, GuiScreen parent, boolean allowEsc) { this.parent = parent; + this.allowEsc = allowEsc; view = new RootDom(widget); view.getContext().CONTEXT.put("screenAdapter", this); @@ -97,6 +104,7 @@ public class GuiScreenAdapter extends GuiScreen { )); view.setMounted(true); }catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -134,13 +142,14 @@ public class GuiScreenAdapter extends GuiScreen { GlStateManager.enableDepth(); GL11.glDisable(GL11.GL_SCISSOR_TEST); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @Override public void keyTyped(char typedChar, int keyCode) throws IOException { - if (keyCode == 1) { + if (keyCode == 1 && allowEsc) { this.mc.displayGuiScreen((GuiScreen)parent); if (this.mc.currentScreen == null) { this.mc.setIngameFocus(); @@ -150,9 +159,9 @@ public class GuiScreenAdapter extends GuiScreen { try { view.keyPressed0(typedChar, keyCode); - super.keyTyped(typedChar, keyCode); } catch (Exception e) { - + FeatureCollectDiagnostics.queueSendLogAsync(e); + e.printStackTrace(); } } @@ -161,7 +170,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.keyHeld0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -170,7 +180,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.keyReleased0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -182,7 +193,8 @@ public class GuiScreenAdapter extends GuiScreen { view.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -207,7 +219,7 @@ public class GuiScreenAdapter extends GuiScreen { view.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); } catch (Exception e) { - + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -218,7 +230,8 @@ public class GuiScreenAdapter extends GuiScreen { view.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -228,7 +241,8 @@ public class GuiScreenAdapter extends GuiScreen { view.mouseMoved0(mouseX, mouseY , mouseX, mouseY, true); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -276,7 +290,7 @@ public class GuiScreenAdapter extends GuiScreen { try { if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor)); } catch (Throwable e) { - + if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) e.printStackTrace(); } } @@ -287,6 +301,7 @@ public class GuiScreenAdapter extends GuiScreen { try { view.mouseScrolled0(i, j, i, j, wheel); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java index 63faf77d..05e54ba0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Column.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.guiv2.elements; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; @@ -223,7 +224,8 @@ public class Column extends AnnotatedExportOnlyWidget implements Layouter { if (circuitBreaker > 100) { try { throw new RuntimeException("Caught in infinite loop welp"); - } catch (Exception e) { e.printStackTrace(); } + } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } break; } prevWidth = startingWidth; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java index 9a11c5bd..698e8fb8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Row.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.guiv2.elements; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; @@ -206,7 +207,8 @@ public class Row extends AnnotatedExportOnlyWidget implements Layouter { if (circuitBreaker > 1000) { try { throw new RuntimeException("Caught in infinite loop welp"); - } catch (Exception e) { e.printStackTrace(); } + } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e);e.printStackTrace(); } break; } prevHeight = startingHeight; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/TextField.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/TextField.java index fde24655..bab40891 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/TextField.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/TextField.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.mod.guiv2.elements; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute; import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; @@ -304,8 +305,10 @@ public class TextField extends AnnotatedExportOnlyWidget implements Renderer, La cursor += theText.toString().length(); } catch (UnsupportedFlavorException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } catch (IOException e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java index b3453385..1f2a59c4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java @@ -19,6 +19,7 @@ package kr.syeyoung.dungeonsguide.mod.overlay; import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.guiv2.RootDom; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Scaler; @@ -93,6 +94,7 @@ public class OverlayManager { Minecraft.getMinecraft().displayHeight )); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -105,6 +107,7 @@ public class OverlayManager { view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.UNDER_CHAT); drawScreen(postRender.partialTicks); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -118,6 +121,7 @@ public class OverlayManager { view.getContext().CONTEXT.put(OVERLAY_TYPE_KEY, OverlayType.OVER_ANY); drawScreen(postRender.renderPartialTicks); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -157,7 +161,8 @@ public class OverlayManager { try { view.keyPressed0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -166,7 +171,8 @@ public class OverlayManager { try { view.keyHeld0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -175,7 +181,8 @@ public class OverlayManager { try { view.keyReleased0(typedChar, keyCode); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -185,7 +192,8 @@ public class OverlayManager { return view.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } return false; @@ -196,6 +204,7 @@ public class OverlayManager { view.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } @@ -206,6 +215,7 @@ public class OverlayManager { view.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } @@ -216,7 +226,8 @@ public class OverlayManager { view.mouseMoved0(mouseX, mouseY , mouseX, mouseY, true); } catch (Exception e) { - + + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -276,6 +287,7 @@ public class OverlayManager { boolean cancel = view.mouseScrolled0(i, j, i, j, wheel); if (cancel) mouseInputEvent.setCanceled(true); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java index 80dad6c8..3406923e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java @@ -26,6 +26,7 @@ import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.mod.events.impl.HypixelJoinedEvent; import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; import kr.syeyoung.dungeonsguide.mod.features.impl.advanced.FeatureTestPeople; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import kr.syeyoung.dungeonsguide.mod.stomp.StompHeader; import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; @@ -138,6 +139,7 @@ public class PartyManager { try { partyContextConsumer.accept(null); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } @@ -218,6 +220,7 @@ public class PartyManager { try { partyContextConsumer.accept(partyContext); } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java index 02160bb1..78d97f6e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java @@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.mod.stomp; import com.google.common.util.concurrent.ThreadFactoryBuilder; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.VersionInfo; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.FeatureCollectDiagnostics; import lombok.Getter; import net.minecraftforge.common.MinecraftForge; import org.apache.logging.log4j.LogManager; @@ -129,6 +130,7 @@ public class StompClient extends WebSocketClient { } } catch (Exception e) { + FeatureCollectDiagnostics.queueSendLogAsync(e); e.printStackTrace(); } } diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/collect_diagnostic_approval.gui b/mod/src/main/resources/assets/dungeonsguide/gui/collect_diagnostic_approval.gui new file mode 100644 index 00000000..4c4e62b5 --- /dev/null +++ b/mod/src/main/resources/assets/dungeonsguide/gui/collect_diagnostic_approval.gui @@ -0,0 +1,46 @@ +<!-- + ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + ~ Copyright (C) 2023 cyoung06 (syeyoung) + ~ + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU Affero General Public License as published + ~ by the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU Affero General Public License for more details. + ~ + ~ You should have received a copy of the GNU Affero General Public License + ~ along with this program. If not, see <https://www.gnu.org/licenses/>. + --> + +<bgcolor backgroundColor="#FF111111"> + <align vAlign="CENTER"> + <padding left="20.0" right="20.0" top="20.0" bottom="20.0"> + <col crossAlign="CENTER" mainAlign="CENTER"> + <size width="0" height="10"/> + <Text text="Allow Dungeons Guide to send errors to remote server?" color="#FFFFFFFF" size="16" align="CENTER"/> + <size width="0" height="15"/> + <Text text="You can change this setting at /dg -> Misc -> Collect Error Logs" color="#FFFFFFFF" size="8" align="CENTER"/> + <Text text="This will only collect errors within dg, and it will not send your latest.log" color="#FFFFFFFF" size="8" align="CENTER"/> + <Text text="It will only send stacktraces, a piece of text that tells where in dg what error occured" color="#FFFFFFFF" size="8" align="CENTER"/> + <size width="0" height="15"/> + <Text text="The data is completely anonymized, and by allowing this you help Dungeons Guide fix problems that went unnoticed" color="#FFFFFF00" size="8" align="CENTER"/> + <Text text="This option is completely optional and there is no penalty for denying" color="#FFFFFF00" size="8" align="CENTER"/> + <size width="0" height="15"/> + <row mainAlign="CENTER"> + <size width="80" height="20"> + <RoundButton text="Allow" on:click="approve"/> + </size>aa + <size width="10" height="0"/> + <size width="80" height="20"> + <RoundButton text="Deny" on:click="deny"/> + </size> + </row> + <size width="0" height="10"/> + </col> + </padding> + </align> +</bgcolor>
\ No newline at end of file |