From c5b08781f75be4e0dcfe8ba0fc9ec58e80409840 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 24 Aug 2014 02:49:58 -0700 Subject: [PATCH] Build the cause list order correctly. --- .../sk89q/worldguard/bukkit/cause/Cause.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java b/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java index 0bef3854..9912d5d9 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/cause/Cause.java @@ -154,6 +154,16 @@ private static void expand(List list, @Nullable Object ... element) { continue; } + if (o instanceof TNTPrimed) { + expand(list, ((TNTPrimed) o).getSource()); + } else if (o instanceof Projectile) { + expand(list, ((Projectile) o).getShooter()); + } else if (o instanceof Vehicle) { + expand(list, ((Vehicle) o).getPassenger()); + } else if (o instanceof Tameable) { + expand(list, ((Tameable) o).getOwner()); + } + // Add manually tracked parent causes Object source = o; int index = list.size(); @@ -164,21 +174,7 @@ private static void expand(List list, @Nullable Object ... element) { } } - if (o instanceof TNTPrimed) { - expand(list, ((TNTPrimed) o).getSource()); - list.add(o); - } else if (o instanceof Projectile) { - expand(list, ((Projectile) o).getShooter()); - list.add(o); - } else if (o instanceof Vehicle) { - expand(list, ((Vehicle) o).getPassenger()); - list.add(o); - } else if (o instanceof Tameable) { - expand(list, ((Tameable) o).getOwner()); - list.add(o); - } else { - list.add(o); - } + list.add(o); } } }