From 5200d29e31ff1d2a05c3c325070637aee6cd1ca9 Mon Sep 17 00:00:00 2001 From: yor42 Date: Mon, 18 Nov 2024 10:29:46 +0900 Subject: [PATCH] add Link Generator --- src/main/java/cn/academy/Main.java | 3 ++- .../support/groovyscript/LinkGenerator.java | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/main/java/cn/academy/support/groovyscript/LinkGenerator.java diff --git a/src/main/java/cn/academy/Main.java b/src/main/java/cn/academy/Main.java index 3084b07c..31d01d6f 100644 --- a/src/main/java/cn/academy/Main.java +++ b/src/main/java/cn/academy/Main.java @@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientDisconnectionFromServerEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import net.minecraftforge.fml.relauncher.FMLLaunchHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.apache.logging.log4j.LogManager; @@ -43,7 +44,7 @@ public class Main { public static final String VERSION = "@VERSION@"; - public static final boolean DEBUG_MODE = VERSION.startsWith("@"); + public static final boolean DEBUG_MODE = FMLLaunchHandler.isDeobfuscatedEnvironment(); public static final Logger log = LogManager.getLogger("AcademyCraft"); diff --git a/src/main/java/cn/academy/support/groovyscript/LinkGenerator.java b/src/main/java/cn/academy/support/groovyscript/LinkGenerator.java new file mode 100644 index 00000000..ed5782b4 --- /dev/null +++ b/src/main/java/cn/academy/support/groovyscript/LinkGenerator.java @@ -0,0 +1,23 @@ +package cn.academy.support.groovyscript; + +import cn.academy.Main; +import com.cleanroommc.groovyscript.documentation.linkgenerator.BasicLinkGenerator; +import com.cleanroommc.groovyscript.documentation.linkgenerator.ILinkGenerator; + +public class LinkGenerator extends BasicLinkGenerator implements ILinkGenerator { + + @Override + public String id() { + return "academy"; + } + + @Override + protected String version() { + return "v"+ Main.VERSION; + } + + @Override + protected String domain() { + return "https://github.com/yor42/AcademyCraft"; + } +}