summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-29 23:06:53 +0200
committerErik Broes <erikbroes@grum.nl>2011-03-29 23:14:59 +0200
commitec74fe8e375816ac4a7efd75fc96b485e329cd9f (patch)
treec075ace368c7842a6acea302948caa6e45cab91e /src/main/java/org
parent195423cd0b3ffdc4966d4722883eb7810af29a08 (diff)
downloadcraftbukkit-ec74fe8e375816ac4a7efd75fc96b485e329cd9f.tar
craftbukkit-ec74fe8e375816ac4a7efd75fc96b485e329cd9f.tar.gz
craftbukkit-ec74fe8e375816ac4a7efd75fc96b485e329cd9f.tar.lz
craftbukkit-ec74fe8e375816ac4a7efd75fc96b485e329cd9f.tar.xz
craftbukkit-ec74fe8e375816ac4a7efd75fc96b485e329cd9f.zip
Move passenger-handling to CraftEntity
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java27
2 files changed, 26 insertions, 27 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index f404fd47..6fa8f87d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -196,4 +196,30 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void setMomentum(Vector value) {
setVelocity(value);
}
+
+ public CraftEntity getPassenger() {
+ return isEmpty() ? null : (CraftEntity) getHandle().passenger.getBukkitEntity();
+ }
+
+ public boolean setPassenger(org.bukkit.entity.Entity passenger) {
+ if (passenger instanceof CraftEntity){
+ ((CraftEntity) passenger).getHandle().setPassengerOf(getHandle());
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isEmpty() {
+ return getHandle().passenger == null;
+ }
+
+ public boolean eject() {
+ if (getHandle().passenger == null) {
+ return false;
+ }
+
+ getHandle().passenger.setPassengerOf(null);
+ return true;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java
index 20c52a9d..af72ba07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java
@@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle;
/**
@@ -14,32 +13,6 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
super(server, entity);
}
- public Entity getPassenger() {
- return isEmpty() ? null : (getHandle().passenger.getBukkitEntity());
- }
-
- public boolean setPassenger(Entity passenger) {
- if (passenger instanceof CraftEntity){
- ((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
- return true;
- } else {
- return false;
- }
- }
-
- public boolean isEmpty() {
- return getHandle().passenger == null;
- }
-
- public boolean eject() {
- if (getHandle().passenger == null) {
- return false;
- }
-
- getHandle().passenger.setPassengerOf(null);
- return true;
- }
-
@Override
public String toString() {
return "CraftVehicle{passenger=" + getPassenger() + '}';