From 8773e4ff519aad72d69e106f1fd861f161bcca62 Mon Sep 17 00:00:00 2001 From: Dueris Date: Sat, 9 Nov 2024 10:57:43 -0800 Subject: [PATCH] better impl to check for eclipse --- .../io/github/dueris/originspaper/Bootstrap.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/origins/src/main/java/io/github/dueris/originspaper/Bootstrap.java b/origins/src/main/java/io/github/dueris/originspaper/Bootstrap.java index 503a2727..60f48899 100644 --- a/origins/src/main/java/io/github/dueris/originspaper/Bootstrap.java +++ b/origins/src/main/java/io/github/dueris/originspaper/Bootstrap.java @@ -3,19 +3,33 @@ import io.papermc.paper.plugin.bootstrap.BootstrapContext; import io.papermc.paper.plugin.bootstrap.PluginBootstrap; import me.dueris.eclipse.ignite.IgniteBootstrap; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; @SuppressWarnings("UnstableApiUsage") public class Bootstrap implements PluginBootstrap { + private static final Logger log = LogManager.getLogger(Bootstrap.class); + @Override public void bootstrap(@NotNull BootstrapContext bootContext) { try { - if (!IgniteBootstrap.BOOTED.get()) return; + if (!igniteBooted()) return; OriginsPaper.bootstrap(bootContext); } catch (Throwable e) { throw new RuntimeException("An error occurred when loading OriginsPaper!", e); } } + private static boolean igniteBooted() { + try { + Class.forName("me.dueris.eclipse.ignite.IgniteBootstrap"); + return IgniteBootstrap.BOOTED.get(); + } catch (ClassNotFoundException e) { + log.error("Eclipse was not found in classpath! Please install from modrinth : {}", "https://modrinth.com/plugin/eclipse-mixin"); + return false; + } + } + }