From 5a3105919b2b3188ffdda50e47f69a049c7bc181 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 29 Dec 2021 10:48:15 +1100 Subject: [PATCH] Add self-riding check to Entity#addPassenger By: md_5 --- .../src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index edd2276b69..f4049559dd 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -662,6 +662,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public boolean addPassenger(org.bukkit.entity.Entity passenger) { Preconditions.checkArgument(passenger != null, "passenger == null"); + Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself."); return ((CraftEntity) passenger).getHandle().startRiding(getHandle(), true); }