Fix Craft Entity constructors and toStrings.
Also, standardise getHandle and clean up in general. getHandle is now using the 'entity' member variable instead of super.getHandle, as this reduces the number of chained calls needed.
This commit is contained in:
@@ -12,24 +12,27 @@ public class CraftFish extends AbstractProjectile implements Fish {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftFish";
|
||||
}
|
||||
|
||||
public LivingEntity getShooter() {
|
||||
if (((EntityFishingHook) getHandle()).owner != null) {
|
||||
return (LivingEntity) ((EntityFishingHook) getHandle()).owner.getBukkitEntity();
|
||||
if (getHandle().owner != null) {
|
||||
return (LivingEntity) getHandle().owner.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void setShooter(LivingEntity shooter) {
|
||||
if (shooter instanceof CraftHumanEntity) {
|
||||
((EntityFishingHook) getHandle()).owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
||||
getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityFishingHook getHandle() {
|
||||
return (EntityFishingHook) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftFish";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user