mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 11:27:35 +01:00
Prevent an Entity from riding itself.
This commit is contained in:
parent
87b9f46d72
commit
3e9b5c93d6
@ -1,5 +1,6 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -301,6 +302,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public boolean setPassenger(org.bukkit.entity.Entity passenger) {
|
||||
Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself.");
|
||||
if (passenger instanceof CraftEntity) {
|
||||
((CraftEntity) passenger).getHandle().mount(getHandle());
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user