Cause.isKnown() now returns false if it only contains objects that do not properly constitute a cause.

This commit is contained in:
sk89q 2014-08-24 02:55:57 -07:00
parent c5b08781f7
commit f00d73d60e

View File

@ -65,12 +65,26 @@ private Cause(List<Object> causes) {
}
/**
* Return whether a cause is known.
* 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 true if known
*/
public boolean isKnown() {
return !causes.isEmpty();
if (causes.isEmpty()) {
return false;
}
boolean found = false;
for (Object object : causes) {
if (!(object instanceof TNTPrimed)) {
found = true;
break;
}
}
return found;
}
@Nullable