From 396fb50e1c90f503d8059f5e9f55c29a273d32b1 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Sun, 9 Jul 2023 17:08:05 +0100 Subject: [PATCH] Support removal of isBackwardsCompatible --- .../sfmetrics/charts/CompatibilityModeChart.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/walshy/sfmetrics/charts/CompatibilityModeChart.java b/src/main/java/dev/walshy/sfmetrics/charts/CompatibilityModeChart.java index ef1a737..6ddc367 100644 --- a/src/main/java/dev/walshy/sfmetrics/charts/CompatibilityModeChart.java +++ b/src/main/java/dev/walshy/sfmetrics/charts/CompatibilityModeChart.java @@ -6,6 +6,8 @@ import org.bstats.json.JsonObjectBuilder; import org.bukkit.Server; +import java.lang.reflect.Method; + import javax.annotation.Nonnull; /** @@ -18,7 +20,14 @@ public class CompatibilityModeChart extends SimplePie implements SlimefunMetrics public CompatibilityModeChart() { super("compatibility_mode", () -> { - boolean enabled = Slimefun.getRegistry().isBackwardsCompatible(); + boolean enabled; + try { + final Method method = Slimefun.getRegistry().getClass().getDeclaredMethod("isBackwardsCompatible"); + enabled = (boolean) method.invoke(Slimefun.getRegistry()); + } catch(Exception e) { + enabled = false; + } + return enabled ? "enabled" : "disabled"; }); }