From c33851002f95fdfad0f3ee256d5571e919f8bd53 Mon Sep 17 00:00:00 2001 From: Saturn5Vfive Date: Tue, 3 May 2022 20:57:08 -0500 Subject: [PATCH] a --- .../java/net/shadow/client/ShadowMain.java | 3 +++ .../client/helper/protection/Locker.java | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/main/java/net/shadow/client/helper/protection/Locker.java diff --git a/src/main/java/net/shadow/client/ShadowMain.java b/src/main/java/net/shadow/client/ShadowMain.java index a66c156..2e2f0b1 100644 --- a/src/main/java/net/shadow/client/ShadowMain.java +++ b/src/main/java/net/shadow/client/ShadowMain.java @@ -23,6 +23,7 @@ import net.shadow.client.helper.font.FontRenderers; import net.shadow.client.helper.font.adapter.impl.BruhAdapter; import net.shadow.client.helper.font.renderer.FontRenderer; import net.shadow.client.helper.manager.ConfigManager; +import net.shadow.client.helper.protection.Locker; import net.shadow.client.helper.util.Utils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -57,6 +58,8 @@ public class ShadowMain implements ModInitializer { INSTANCE = this; log(Level.INFO, "Initializing"); + //Locker.init(); + Runtime.getRuntime().addShutdownHook(new Thread(ConfigManager::saveState)); if (BASE.exists() && !BASE.isDirectory()) { BASE.delete(); diff --git a/src/main/java/net/shadow/client/helper/protection/Locker.java b/src/main/java/net/shadow/client/helper/protection/Locker.java new file mode 100644 index 0000000..6ac33b6 --- /dev/null +++ b/src/main/java/net/shadow/client/helper/protection/Locker.java @@ -0,0 +1,20 @@ +package net.shadow.client.helper.protection; + +import meteordevelopment.discordipc.DiscordIPC; +import meteordevelopment.discordipc.IPCUser; + +public class Locker { + + public static void init() { + boolean result = DiscordIPC.start(958479347390500874L, () -> { + IPCUser user = DiscordIPC.getUser(); + //user.id + DiscordIPC.stop(); + }); + if (!result) { + System.out.println("Please have discord open while launching the client"); + System.exit(1); + } + } + +}