From ed10877431fd77b5af5aa61f5678735e61071041 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 8 Mar 2019 23:04:38 +0000 Subject: [PATCH] Should fix IndexOutOfBoundsException when copying fixes#2290 --- .../bukkit/object/entity/ReplicatingEntityWrapper.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index d59fabf1c..f05555947 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -10,6 +10,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; +import java.util.List; + public final class ReplicatingEntityWrapper extends EntityWrapper { private final short depth; @@ -38,9 +40,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { if (depth == 0) { return; } - Entity passenger = entity.getPassengers().get(0); - if (passenger != null) { - this.base.passenger = new ReplicatingEntityWrapper(passenger, depth); + List passengers = entity.getPassengers(); + if (passengers.size() > 0) { + this.base.passenger = new ReplicatingEntityWrapper(passengers.get(0), depth); } this.base.fall = entity.getFallDistance(); this.base.fire = (short) entity.getFireTicks();