Skip to content

Commit

Permalink
better impl to check for eclipse
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed Nov 9, 2024
1 parent e295d44 commit 8773e4f
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

}

0 comments on commit 8773e4f

Please sign in to comment.