aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'bukkit/src/main/java/com')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/coreprotect/CoreProtectHook.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/coreprotect/CoreProtectHook.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/coreprotect/CoreProtectHook.java
index 516f5ae2..e2bf8e78 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/coreprotect/CoreProtectHook.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/coreprotect/CoreProtectHook.java
@@ -23,6 +23,7 @@ public class CoreProtectHook implements AbstractCoreProtectHook {
CompletableFuture<Boolean> future = new CompletableFuture<>();
plugin.getScheduler().doAsync(() -> {
List<String[]> queueLookup = api.queueLookup(block);
+
if (queueLookup.size() >= 2) {
// first queue element when breaking a block is always
// a break action so we just get the second one
@@ -38,7 +39,17 @@ public class CoreProtectHook implements AbstractCoreProtectHook {
}
}
+ long blockLookupDelay = plugin.getConfig().getLong("options.coreprotect-block-lookup-delay", -1L);
+ if (blockLookupDelay > 0L) {
+ try {
+ Thread.sleep(blockLookupDelay);
+ } catch (InterruptedException ignored) {
+ }
+ }
+
List<String[]> blockLookup = api.blockLookup(block, time);
+ boolean first = true;
+
for (String[] result : blockLookup) {
CoreProtectAPI.ParseResult parseResult = api.parseResult(result);
@@ -47,6 +58,13 @@ public class CoreProtectHook implements AbstractCoreProtectHook {
continue;
}
+ // we need to skip first break interaction too in case it's already been inserted
+ if (first && parseResult.getActionId() == 0) {
+ first = false;
+
+ continue;
+ }
+
// due to the order the first element that is not
// an interaction is always the one we need to check
// (0=removed, 1=placed, 2=interaction)