Skip to content

Commit

Permalink
Return empty list instead of null for passengers tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mergu committed Jul 28, 2017
1 parent f429e42 commit 46fb0bc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1978,14 +1978,11 @@ else if (mtr.angle == BlockFace.EAST) {
// Returns a list of the entity's passengers, if any.
// -->
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_11_R1) && (attribute.startsWith("passengers") || attribute.startsWith("get_passengers"))) {
if (!entity.isEmpty()) {
ArrayList<dEntity> passengers = new ArrayList<dEntity>();
for (Entity ent : entity.getPassengers()) {
passengers.add(new dEntity(ent));
}
return new dList(passengers)
.getAttribute(attribute.fulfill(1));
ArrayList<dEntity> passengers = new ArrayList<dEntity>();
for (Entity ent : entity.getPassengers()) {
passengers.add(new dEntity(ent));
}
return new dList(passengers).getAttribute(attribute.fulfill(1));
}

// <--[tag]
Expand Down

0 comments on commit 46fb0bc

Please sign in to comment.