From c4e76af5f4256954d77da3951a7d784dcbd1016e Mon Sep 17 00:00:00 2001 From: stonar96 Date: Sat, 15 May 2021 21:03:55 +0200 Subject: [PATCH] Fix Cause#isKnown() (#1768) * Fix Cause#isKnown() * Grammar Co-authored-by: wizjany --- .../sk89q/worldguard/bukkit/cause/Cause.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java index 508a20e2..0c9e5136 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java @@ -90,26 +90,15 @@ public boolean isIndirect() { } /** - * Return whether a cause is known. This method will return true if - * the list of causes is empty or the list of causes only contains - * objects that really are not root causes (i.e primed TNT). + * Return whether a cause is known. This method will return false if + * the list of causes is empty or the root cause is really not known + * (e.g. primed TNT). * * @return true if known */ public boolean isKnown() { - if (causes.isEmpty()) { - return false; - } - - boolean found = false; - for (Object object : causes) { - if (!(object instanceof TNTPrimed) && !(object instanceof Vehicle)) { - found = true; - break; - } - } - - return found; + Object object = getRootCause(); + return !(object == null || object instanceof TNTPrimed || object instanceof Vehicle); } @Nullable