Build the cause list order correctly.

This commit is contained in:
sk89q 2014-08-24 02:49:58 -07:00
parent 4b80c4e4e6
commit c5b08781f7

View File

@ -154,6 +154,16 @@ private static void expand(List<Object> 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<Object> 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);
}
}
}