diff --git a/gradle.properties b/gradle.properties index f2bce18..c9ceff1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ pluginGroup=org.popcraft -pluginVersion=1.0.2 +pluginVersion=1.0.3 diff --git a/src/main/java/org/popcraft/stress/Stress.java b/src/main/java/org/popcraft/stress/Stress.java index f1c08ee..18cd6d4 100644 --- a/src/main/java/org/popcraft/stress/Stress.java +++ b/src/main/java/org/popcraft/stress/Stress.java @@ -76,14 +76,18 @@ public void onEnable() { int pluginId = 7063; Metrics metrics = new Metrics(this, pluginId); // Register LuckPerms contexts - LuckPermsContexts.register(); + if (serverSupportsContexts()) { + LuckPermsContexts.register(); + } } @Override public void onDisable() { tickProfiler.stop(); // Unregister LuckPerms contexts - LuckPermsContexts.unregister(); + if (serverSupportsContexts()) { + LuckPermsContexts.unregister(); + } } @Override @@ -188,4 +192,12 @@ private void addTests(Test... tests) { } } + private boolean serverSupportsContexts() { + try { + Class.forName("net.luckperms.api.context.ContextCalculator"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } }