Skip to content

Commit

Permalink
Support removal of isBackwardsCompatible
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev committed Jul 9, 2023
1 parent 1b6223f commit 396fb50
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.bstats.json.JsonObjectBuilder;
import org.bukkit.Server;

import java.lang.reflect.Method;

import javax.annotation.Nonnull;

/**
Expand All @@ -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";
});
}
Expand Down

0 comments on commit 396fb50

Please sign in to comment.