Archiviert
13
0

Prevent an Entity from riding itself.

Dieser Commit ist enthalten in:
Xor Boole 2015-07-20 16:18:08 +10:00 committet von md_5
Ursprung 87b9f46d72
Commit 3e9b5c93d6

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; 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) { public boolean setPassenger(org.bukkit.entity.Entity passenger) {
Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself.");
if (passenger instanceof CraftEntity) { if (passenger instanceof CraftEntity) {
((CraftEntity) passenger).getHandle().mount(getHandle()); ((CraftEntity) passenger).getHandle().mount(getHandle());
return true; return true;