mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 17:57:34 +01:00
Add self-riding check to Entity#addPassenger
By: md_5 <git@md-5.net>
This commit is contained in:
parent
7a54f9da31
commit
5a3105919b
@ -662,6 +662,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean addPassenger(org.bukkit.entity.Entity passenger) {
|
public boolean addPassenger(org.bukkit.entity.Entity passenger) {
|
||||||
Preconditions.checkArgument(passenger != null, "passenger == null");
|
Preconditions.checkArgument(passenger != null, "passenger == null");
|
||||||
|
Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself.");
|
||||||
|
|
||||||
return ((CraftEntity) passenger).getHandle().startRiding(getHandle(), true);
|
return ((CraftEntity) passenger).getHandle().startRiding(getHandle(), true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user