Blocked access to BlocksHub to prevent duplicate data from being logged

This commit is contained in:
Intelli 2022-02-28 18:49:20 -07:00
parent 1aaff4e2b0
commit a596dd66a9

View File

@ -31,6 +31,8 @@ import net.coreprotect.utility.Util;
public class CoreProtectAPI extends Queue {
private boolean checkedBlocksHub = false;
public class ParseResult {
String[] parse;
@ -167,6 +169,24 @@ public class CoreProtectAPI extends Queue {
public int APIVersion() {
return 8;
try {
// deny access to BlocksHub to prevent duplicate data from being logged
if (!checkedBlocksHub && Bukkit.getPluginManager().getPlugin("BlocksHub") != null) {
for (StackTraceElement element : Thread.currentThread().getStackTrace()) {
if (element.getClassName().startsWith("org.primesoft.blockshub")) {
checkedBlocksHub = true;
return 0;
}
}
}
else if (!checkedBlocksHub) {
checkedBlocksHub = true;
}
}
catch (Exception e) {
// proceed with returning API version
}
}
public List<String[]> blockLookup(Block block, int time) {