diff options
Diffstat (limited to 'src/main')
57 files changed, 584 insertions, 301 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index 74aafbeb..ff9e9c69 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -12,6 +12,7 @@ import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.event.vehicle.VehicleUpdateEvent; +import org.bukkit.util.Vector; // CraftBukkit end public class EntityMinecart extends Entity implements IInventory { @@ -32,12 +33,12 @@ public class EntityMinecart extends Entity implements IInventory { // CraftBukkit start public boolean slowWhenEmpty = true; - public double derailedX = 0.5; - public double derailedY = 0.5; - public double derailedZ = 0.5; - public double flyingX = 0.95; - public double flyingY = 0.95; - public double flyingZ = 0.95; + private double derailedX = 0.5; + private double derailedY = 0.5; + private double derailedZ = 0.5; + private double flyingX = 0.95; + private double flyingY = 0.95; + private double flyingZ = 0.95; public double maxSpeed = 0.4D; public ItemStack[] getContents() { @@ -934,4 +935,26 @@ public class EntityMinecart extends Entity implements IInventory { public int m() { return this.datawatcher.getInt(18); } + + // CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers + public Vector getFlyingVelocityMod() { + return new Vector(flyingX, flyingY, flyingZ); + } + + public void setFlyingVelocityMod(Vector flying) { + flyingX = flying.getX(); + flyingY = flying.getY(); + flyingZ = flying.getZ(); + } + + public Vector getDerailedVelocityMod() { + return new Vector(derailedX, derailedY, derailedZ); + } + + public void setDerailedVelocityMod(Vector derailed) { + derailedX = derailed.getX(); + derailedY = derailed.getY(); + derailedZ = derailed.getZ(); + } + // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java new file mode 100644 index 00000000..41247f51 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityPotion.java @@ -0,0 +1,87 @@ +package net.minecraft.server; + +import java.util.Iterator; +import java.util.List; + +public class EntityPotion extends EntityProjectile { + + private int d; + + public EntityPotion(World world) { + super(world); + } + + public EntityPotion(World world, EntityLiving entityliving, int i) { + super(world, entityliving); + this.d = i; + } + + public EntityPotion(World world, double d0, double d1, double d2, int i) { + super(world, d0, d1, d2); + this.d = i; + } + + protected float e() { + return 0.05F; + } + + protected float c() { + return 0.5F; + } + + protected float d() { + return -20.0F; + } + + public int f() { + return this.d; + } + + protected void a(MovingObjectPosition movingobjectposition) { + if (!this.world.isStatic) { + List list = Item.POTION.b(this.d); + + if (list != null && !list.isEmpty()) { + AxisAlignedBB axisalignedbb = this.boundingBox.b(4.0D, 2.0D, 4.0D); + List list1 = this.world.a(EntityLiving.class, axisalignedbb); + + if (list1 != null && !list1.isEmpty()) { + Iterator iterator = list1.iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + double d0 = this.i(entity); + + if (d0 < 16.0D) { + double d1 = 1.0D - Math.sqrt(d0) / 4.0D; + + if (entity == movingobjectposition.entity) { + d1 = 1.0D; + } + + Iterator iterator1 = list.iterator(); + + while (iterator1.hasNext()) { + MobEffect mobeffect = (MobEffect) iterator1.next(); + int i = mobeffect.getEffectId(); + + if (MobEffectList.byId[i].b()) { + MobEffectList.byId[i].a(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1); + } else { + int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); + + if (j > 20) { + ((EntityLiving) entity).addEffect(new MobEffect(i, j, mobeffect.getAmplifier())); + } + } + } + } + } + } + } + + this.world.f(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), this.d); + this.die(); + } + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index e4b51ec8..5211bbb0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -10,9 +10,12 @@ public class CraftAnimals extends CraftCreature implements Animals { super(server, entity); } - @Override - public String toString() { - return "CraftAnimals"; + public int getAge() { + return getHandle().getAge(); + } + + public void setAge(int age) { + getHandle().setAge(age); } @Override @@ -20,11 +23,8 @@ public class CraftAnimals extends CraftCreature implements Animals { return (EntityAnimal) entity; } - public int getAge() { - return getHandle().getAge(); - } - - public void setAge(int age) { - getHandle().setAge(age); + @Override + public String toString() { + return "CraftAnimals"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index b23cdc4a..275e849e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -7,29 +7,35 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Arrow; import org.bukkit.entity.LivingEntity; +import javax.swing.text.html.parser.Entity; + public class CraftArrow extends AbstractProjectile implements Arrow { public CraftArrow(CraftServer server, EntityArrow entity) { super(server, entity); } - @Override - public String toString() { - return "CraftArrow"; - } - public LivingEntity getShooter() { - if (((EntityArrow) getHandle()).shooter != null) { - return (LivingEntity) ((EntityArrow) getHandle()).shooter.getBukkitEntity(); + if (getHandle().shooter != null) { + return (LivingEntity) getHandle().shooter.getBukkitEntity(); } return null; - } public void setShooter(LivingEntity shooter) { if (shooter instanceof CraftLivingEntity) { - ((EntityArrow) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity; + getHandle().shooter = ((CraftLivingEntity) shooter).getHandle(); } } + + @Override + public EntityArrow getHandle(){ + return (EntityArrow) entity; + } + + @Override + public String toString() { + return "CraftArrow"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java index 94e03c5b..94c99016 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java @@ -1,11 +1,22 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.server.EntityBlaze; import net.minecraft.server.EntityMonster; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Blaze; public class CraftBlaze extends CraftMonster implements Blaze { - public CraftBlaze(CraftServer server, EntityMonster entity) { + public CraftBlaze(CraftServer server, EntityBlaze entity) { super(server, entity); } + + @Override + public EntityBlaze getHandle() { + return (EntityBlaze) entity; + } + + @Override + public String toString() { + return "CraftBlaze"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java index 721b653e..4e7a922d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -5,47 +5,50 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Boat; public class CraftBoat extends CraftVehicle implements Boat { - protected EntityBoat boat; public CraftBoat(CraftServer server, EntityBoat entity) { super(server, entity); - boat = entity; } public double getMaxSpeed() { - return boat.maxSpeed; + return getHandle().maxSpeed; } public void setMaxSpeed(double speed) { if (speed >= 0D) { - boat.maxSpeed = speed; + getHandle().maxSpeed = speed; } } public double getOccupiedDeceleration() { - return boat.occupiedDeceleration; + return getHandle().occupiedDeceleration; } public void setOccupiedDeceleration(double speed) { if (speed >= 0D) { - boat.occupiedDeceleration = speed; + getHandle().occupiedDeceleration = speed; } } public double getUnoccupiedDeceleration() { - return boat.unoccupiedDeceleration; + return getHandle().unoccupiedDeceleration; } public void setUnoccupiedDeceleration(double speed) { - boat.unoccupiedDeceleration = speed; + getHandle().unoccupiedDeceleration = speed; } public boolean getWorkOnLand() { - return boat.landBoats; + return getHandle().landBoats; } public void setWorkOnLand(boolean workOnLand) { - boat.landBoats = workOnLand; + getHandle().landBoats = workOnLand; + } + + @Override + public EntityBoat getHandle() { + return (EntityBoat) entity; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java index 5f3bfe94..da099d83 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java @@ -11,7 +11,7 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider { @Override public EntityCaveSpider getHandle() { - return (EntityCaveSpider) super.getHandle(); + return (EntityCaveSpider) entity; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index 84d01e12..2a66fc7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java @@ -11,6 +11,11 @@ public class CraftChicken extends CraftAnimals implements Chicken { } @Override + public EntityChicken getHandle() { + return (EntityChicken) entity; + } + + @Override public String toString() { return "CraftChicken"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java index a0c8d7e7..549c0dfb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java @@ -6,12 +6,17 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexLivingEntity; public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity { - public CraftComplexLivingEntity(CraftServer server, EntityLiving entity) { + public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) { super(server, entity); } @Override public EntityComplex getHandle() { - return (EntityComplex)super.getHandle(); + return (EntityComplex) entity; + } + + @Override + public String toString() { + return "CraftComplexLivingEntity"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java index fc5264b5..13ebd70b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java @@ -7,16 +7,21 @@ import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.ComplexLivingEntity; public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { - public CraftComplexPart(CraftServer server, Entity entity) { + public CraftComplexPart(CraftServer server, EntityComplexPart entity) { super(server, entity); } public ComplexLivingEntity getParent() { - return (ComplexLivingEntity)getHandle().a.getBukkitEntity(); + return (ComplexLivingEntity) getHandle().a.getBukkitEntity(); } @Override public EntityComplexPart getHandle() { - return (EntityComplexPart)super.getHandle(); + return (EntityComplexPart) entity; + } + + @Override + public String toString() { + return "CraftComplexPart"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java index 4136c993..c0780045 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java @@ -11,6 +11,11 @@ public class CraftCow extends CraftAnimals implements Cow { } @Override + public EntityCow getHandle() { + return (EntityCow) entity; + } + + @Override public String toString() { return "CraftCow"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java index 8e24c096..722b4978 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -12,16 +12,6 @@ public class CraftCreeper extends CraftMonster implements Creeper { super(server, entity); } - @Override - public EntityCreeper getHandle() { - return (EntityCreeper) super.getHandle(); - } - - @Override - public String toString() { - return "CraftCreeper"; - } - public boolean isPowered() { return getHandle().isPowered(); } @@ -51,4 +41,13 @@ public class CraftCreeper extends CraftMonster implements Creeper { } + @Override + public EntityCreeper getHandle() { + return (EntityCreeper) entity; + } + + @Override + public String toString() { + return "CraftCreeper"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java index 2af67816..c20739f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java @@ -10,6 +10,11 @@ public class CraftEgg extends CraftProjectile implements Egg { } @Override + public EntityEgg getHandle() { + return (EntityEgg) entity; + } + + @Override public String toString() { return "CraftEgg"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java index c27b3a5d..6acc07b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java @@ -1,16 +1,21 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.EntityEnderCrystal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderSignal; public class CraftEnderCrystal extends CraftEntity implements EnderSignal { - public CraftEnderCrystal(CraftServer server, Entity entity) { + public CraftEnderCrystal(CraftServer server, EntityEnderCrystal entity) { super(server, entity); } @Override + public EntityEnderCrystal getHandle() { + return (EntityEnderCrystal) entity; + } + + @Override public String toString() { - return "CraftEnderSignal"; + return "CraftEnderCrystal"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index 320d17dd..0c595ea1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -11,22 +11,27 @@ import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.EnderDragon; public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon { - public CraftEnderDragon(CraftServer server, EntityLiving entity) { + public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) { super(server, entity); } public Set<ComplexEntityPart> getParts() { Builder<ComplexEntityPart> builder = ImmutableSet.builder(); - + for (EntityComplexPart part : getHandle().f) { - builder.add((ComplexEntityPart)part.getBukkitEntity()); + builder.add((ComplexEntityPart) part.getBukkitEntity()); } - + return builder.build(); } @Override public EntityEnderDragon getHandle() { - return (EntityEnderDragon)super.getHandle(); + return (EntityEnderDragon) entity; + } + + @Override + public String toString() { + return "CraftEnderDragon"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java index 10d77a2c..b62c909e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java @@ -1,17 +1,27 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.EntityComplexPart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragonPart; public class CraftEnderDragonPart extends CraftComplexPart implements EnderDragonPart { - public CraftEnderDragonPart(CraftServer server, Entity entity) { + public CraftEnderDragonPart(CraftServer server, EntityComplexPart entity) { super(server, entity); } @Override public EnderDragon getParent() { - return (EnderDragon)super.getParent(); + return (EnderDragon) super.getParent(); + } + + @Override + public EntityComplexPart getHandle() { + return (EntityComplexPart) entity; + } + + @Override + public String toString() { + return "CraftEnderDragonPart"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java index 4b42c102..1dd00423 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java @@ -1,15 +1,20 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.EntityEnderPearl; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderPearl; public class CraftEnderPearl extends CraftProjectile implements EnderPearl { - public CraftEnderPearl(CraftServer server, Entity entity) { + public CraftEnderPearl(CraftServer server, EntityEnderPearl entity) { super(server, entity); } @Override + public EntityEnderPearl getHandle() { + return (EntityEnderPearl) entity; + } + + @Override public String toString() { return "CraftEnderPearl"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java index 6627dd06..1a1f899b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java @@ -1,15 +1,20 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.EntityEnderSignal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderSignal; public class CraftEnderSignal extends CraftEntity implements EnderSignal { - public CraftEnderSignal(CraftServer server, Entity entity) { + public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) { super(server, entity); } @Override + public EntityEnderSignal getHandle() { + return (EntityEnderSignal) entity; + } + + @Override public String toString() { return "CraftEnderSignal"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index 229885be..20464076 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -12,16 +12,6 @@ public class CraftEnderman extends CraftMonster implements Enderman { super(server, entity); } - @Override - public EntityEnderman getHandle() { - return (EntityEnderman) super.getHandle(); - } - - @Override - public String toString() { - return "CraftEnderman"; - } - public MaterialData getCarriedMaterial() { return Material.getMaterial(getHandle().getCarriedId()).getNewData((byte) getHandle().getCarriedData()); } @@ -30,4 +20,14 @@ public class CraftEnderman extends CraftMonster implements Enderman { getHandle().setCarriedId(data.getItemTypeId()); getHandle().setCarriedData(data.getData()); } + + @Override + public EntityEnderman getHandle() { + return (EntityEnderman) entity; + } + + @Override + public String toString() { + return "CraftEnderman"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 2cf8e8a0..61b65f0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -35,7 +35,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { if (entity instanceof EntityLiving) { // Players if (entity instanceof EntityHuman) { - if (entity instanceof EntityPlayer) { return getPlayer((EntityPlayer)entity); } + if (entity instanceof EntityPlayer) { return getPlayer((EntityPlayer) entity); } else { return new CraftHumanEntity(server, (EntityHuman) entity); } } else if (entity instanceof EntityCreature) { @@ -75,7 +75,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { if (entity instanceof EntitySquid) { return new CraftSquid(server, (EntitySquid) entity); } else { return new CraftWaterMob(server, (EntityWaterAnimal) entity); } } - else if (entity instanceof EntitySnowman) { return new CraftSnowman(server, (EntityCreature) entity); } + else if (entity instanceof EntitySnowman) { return new CraftSnowman(server, (EntitySnowman) entity); } else if (entity instanceof EntityVillager) { return new CraftVillager(server, (EntityVillager) entity); } else { return new CraftCreature(server, (EntityCreature) entity); } } @@ -95,8 +95,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { else { return new CraftLivingEntity(server, (EntityLiving) entity); } } else if (entity instanceof EntityComplexPart) { - EntityComplexPart part = (EntityComplexPart)entity; - if (part.a instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart)entity); } + EntityComplexPart part = (EntityComplexPart) entity; + if (part.a instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); } else { return new CraftComplexPart(server, (EntityComplexPart) entity); } } else if (entity instanceof EntityExperienceOrb) { return new CraftExperienceOrb(server, (EntityExperienceOrb) entity); } @@ -118,21 +118,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); } else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); } else if (entity instanceof EntityWeather) { - if (entity instanceof EntityWeatherStorm) { - return new CraftLightningStrike(server, (EntityWeatherStorm)entity); - } else { - return new CraftWeather(server, (EntityWeather)entity); - } + if (entity instanceof EntityWeatherStorm) { return new CraftLightningStrike(server, (EntityWeatherStorm) entity); } + else { return new CraftWeather(server, (EntityWeather) entity); } } else if (entity instanceof EntityMinecart) { EntityMinecart mc = (EntityMinecart) entity; - if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { - return new CraftStorageMinecart(server, mc); - } else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { - return new CraftPoweredMinecart(server, mc); - } else { - return new CraftMinecart(server, mc); - } + if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { return new CraftStorageMinecart(server, mc); } + else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { return new CraftPoweredMinecart(server, mc); } + else { return new CraftMinecart(server, mc); } } else if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); } else if (entity instanceof EntityTNTPrimed) { return new CraftTNTPrimed(server, (EntityTNTPrimed) entity); } @@ -205,14 +198,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return !entity.aj(); } - public Entity getHandle() { - return entity; - } - - public void setHandle(final Entity entity) { - this.entity = entity; - } - @Override public boolean equals(Object obj) { if (obj == null) { @@ -231,19 +216,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return true; } - @Override - public int hashCode() { - int hash = 7; - hash = 89 * hash + (this.server != null ? this.server.hashCode() : 0); - hash = 89 * hash + (this.entity != null ? this.entity.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - return "CraftEntity{" + "id=" + getEntityId() + '}'; - } - public Server getServer() { return server; } @@ -314,15 +286,36 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return result; } - + public int getTicksLived() { return getHandle().ticksLived; } - + public void setTicksLived(int value) { if (value <= 0) { throw new IllegalArgumentException("Age must be at least 1 tick"); } getHandle().ticksLived = value; } + + public Entity getHandle() { + return entity; + } + + public void setHandle(final Entity entity) { + this.entity = entity; + } + + @Override + public String toString() { + return "CraftEntity{" + "id=" + getEntityId() + '}'; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 89 * hash + (this.server != null ? this.server.hashCode() : 0); + hash = 89 * hash + (this.entity != null ? this.entity.hashCode() : 0); + return hash; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java index 8e8b6fe7..df9a657e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java @@ -10,11 +10,6 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { super(server, entity); } - @Override - public EntityExperienceOrb getHandle() { - return (EntityExperienceOrb) super.getHandle(); - } - public int getExperience() { return getHandle().value; } @@ -22,4 +17,14 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { public void setExperience(int value) { getHandle().value = value; } + + @Override + public EntityExperienceOrb getHandle() { + return (EntityExperienceOrb) entity; + } + + @Override + public String toString() { + return "CraftExperienceOrb"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java index 8af8d539..8a0ba9d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java @@ -13,6 +13,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand { } @Override + public EntityFallingSand getHandle() { + return (EntityFallingSand) entity; + } + + @Override public String toString() { return "CraftFallingSand"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index 1de19a62..27e00aaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -13,47 +13,51 @@ public class CraftFireball extends AbstractProjectile implements Fireball { super(server, entity); } - @Override - public String toString() { - return "CraftFireball"; - } - public float getYield() { - return ((EntityFireball) getHandle()).yield; + return getHandle().yield; } public boolean isIncendiary() { - return ((EntityFireball) getHandle()).isIncendiary; + return getHandle().isIncendiary; } public void setIsIncendiary(boolean isIncendiary) { - ((EntityFireball) getHandle()).isIncendiary = isIncendiary; + getHandle().isIncendiary = isIncendiary; } public void setYield(float yield) { - ((EntityFireball) getHandle()).yield = yield; + getHandle().yield = yield; } public LivingEntity getShooter() { - if (((EntityFireball) getHandle()).shooter != null) { - return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity(); + if (getHandle().shooter != null) { + return (LivingEntity) getHandle().shooter.getBukkitEntity(); } return null; - } public void setShooter(LivingEntity shooter) { if (shooter instanceof CraftLivingEntity) { - ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity; + getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity; } } public Vector getDirection() { - return new Vector(((EntityFireball) getHandle()).dirX, ((EntityFireball) getHandle()).dirY, ((EntityFireball) getHandle()).dirZ); + return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ); } public void setDirection(Vector direction) { - ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ()); + getHandle().setDirection(direction.getX(), direction.getY(), direction.getZ()); + } + + @Override + public EntityFireball getHandle() { + return (EntityFireball) entity; + } + + @Override + public String toString() { + return "CraftFireball"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java index cff09a80..b8453e93 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java @@ -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"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java index 3426590a..f374c7b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java @@ -11,8 +11,12 @@ public class CraftFlying extends CraftLivingEntity implements Flying { } @Override + public EntityFlying getHandle() { + return (EntityFlying) entity; + } + + @Override public String toString() { return "CraftFlying"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index 3d0e70f6..532b16f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -11,8 +11,12 @@ public class CraftGhast extends CraftFlying implements Ghast { } @Override + public EntityGhast getHandle() { + return (EntityGhast) entity; + } + + @Override public String toString() { return "CraftGhast"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java index 8e324c6c..50e0ffb1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java @@ -12,8 +12,12 @@ public class CraftGiant extends CraftMonster implements Giant { } @Override + public EntityGiantZombie getHandle() { + return (EntityGiantZombie) entity; + } + + @Override public String toString() { return "CraftGiant"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index a46ec122..a5256e20 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -31,17 +31,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return getHandle().name; } - @Override - public EntityHuman getHandle() { - return (EntityHuman) entity; - } - - public void setHandle(final EntityHuman entity) { - super.setHandle((EntityHuman) entity); - this.entity = entity; - this.inventory = new CraftInventoryPlayer(entity.inventory); - } - public PlayerInventory getInventory() { return inventory; } @@ -54,11 +43,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getInventory().setItemInHand(item); } - @Override - public String toString() { - return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}'; - } - public boolean isSleeping() { return getHandle().sleeping; } @@ -131,4 +115,19 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { this.mode = mode; } + + @Override + public EntityHuman getHandle() { + return (EntityHuman) entity; + } + + public void setHandle(final EntityHuman entity) { + super.setHandle(entity); + this.inventory = new CraftInventoryPlayer(entity.inventory); + } + + @Override + public String toString() { + return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}'; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 52458f19..a01976cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -31,6 +31,11 @@ public class CraftItem extends CraftEntity implements Item { } @Override + public EntityItem getHandle() { + return (EntityItem) entity; + } + + @Override public String toString() { return "CraftItem"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index 7e37b39b..2a5ba28c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -9,12 +9,17 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike super(server, entity); } + public boolean isEffect() { + return ((EntityWeatherStorm) super.getHandle()).isEffect; + } + @Override public EntityWeatherStorm getHandle() { - return (EntityWeatherStorm) super.getHandle(); + return (EntityWeatherStorm) entity; } - public boolean isEffect() { - return ((EntityWeatherStorm) super.getHandle()).isEffect; + @Override + public String toString() { + return "CraftLightningStrik"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 6d7d3f21..cf6c0b26 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -51,21 +51,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().getMaxHealth(); } - @Override - public EntityLiving getHandle() { - return (EntityLiving) entity; - } - - public void setHandle(final EntityLiving entity) { - super.setHandle((Entity) entity); - this.entity = entity; - } - - @Override - public String toString() { - return "CraftLivingEntity{" + "id=" + getEntityId() + '}'; - } - public Egg throwEgg() { net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); EntityEgg egg = new EntityEgg(world, getHandle()); @@ -224,4 +209,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setNoDamageTicks(int ticks) { getHandle().noDamageTicks = ticks; } + + @Override + public EntityLiving getHandle() { + return (EntityLiving) entity; + } + + public void setHandle(final EntityLiving entity) { + super.setHandle(entity); + } + + @Override + public String toString() { + return "CraftLivingEntity{" + "id=" + getEntityId() + '}'; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java index 4b683702..dd95ae32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java @@ -11,12 +11,12 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube { super(server, entity); } + public EntityLavaSlime getHandle() { + return (EntityLavaSlime) entity; + } + @Override public String toString() { return "CraftMagmaCube"; } - - public EntityLavaSlime getHandle() { - return (EntityLavaSlime) super.getHandle(); - } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 8381aeae..d4420bd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -26,62 +26,59 @@ public class CraftMinecart extends CraftVehicle implements Minecart { } } - protected EntityMinecart minecart; - public CraftMinecart(CraftServer server, EntityMinecart entity) { super(server, entity); - minecart = entity; } public void setDamage(int damage) { - minecart.setDamage(damage); + getHandle().setDamage(damage); } public int getDamage() { - return minecart.getDamage(); + return getHandle().getDamage(); } public double getMaxSpeed() { - return minecart.maxSpeed; + return getHandle().maxSpeed; } public void setMaxSpeed(double speed) { if (speed >= 0D) { - minecart.maxSpeed = speed; + getHandle().maxSpeed = speed; } } public boolean isSlowWhenEmpty() { - return minecart.slowWhenEmpty; + return getHandle().slowWhenEmpty; } public void setSlowWhenEmpty(boolean slow) { - minecart.slowWhenEmpty = slow; + getHandle().slowWhenEmpty = slow; } public Vector getFlyingVelocityMod() { - return new Vector(minecart.flyingX, minecart.flyingY, minecart.flyingZ); + return getHandle().getFlyingVelocityMod(); } public void setFlyingVelocityMod(Vector flying) { - minecart.flyingX = flying.getX(); - minecart.flyingY = flying.getY(); - minecart.flyingZ = flying.getZ(); + getHandle().setFlyingVelocityMod(flying); } public Vector getDerailedVelocityMod() { - return new Vector(minecart.derailedX, minecart.derailedY, minecart.derailedZ); + return getHandle().getDerailedVelocityMod(); } public void setDerailedVelocityMod(Vector derailed) { - minecart.derailedX = derailed.getX(); - minecart.derailedY = derailed.getY(); - minecart.derailedZ = derailed.getZ(); + getHandle().setDerailedVelocityMod(derailed); + } + + @Override + public EntityMinecart getHandle() { + return (EntityMinecart) entity; } @Override public String toString() { return "CraftMinecart"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java index 2736c26d..72dedbc8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java @@ -12,12 +12,12 @@ public class CraftMonster extends CraftCreature implements Monster { } @Override - public String toString() { - return "CraftMonster"; + public EntityMonster getHandle() { + return (EntityMonster) entity; } @Override - public EntityMonster getHandle() { - return (EntityMonster) entity; + public String toString() { + return "CraftMonster"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java index 2a076f29..8173d893 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java @@ -1,11 +1,21 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityCow; +import net.minecraft.server.EntityMushroomCow; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.MushroomCow; public class CraftMushroomCow extends CraftCow implements MushroomCow { - public CraftMushroomCow(CraftServer server, EntityCow entity) { + public CraftMushroomCow(CraftServer server, EntityMushroomCow entity) { super(server, entity); } + + @Override + public EntityMushroomCow getHandle() { + return (EntityMushroomCow) entity; + } + + @Override + public String toString() { + return "CraftMushroomCow"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java index 9a37c5ff..640cb862 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java @@ -20,16 +20,6 @@ public class CraftPainting extends CraftEntity implements Painting { super(server, entity); } - @Override - public EntityPainting getHandle() { - return (EntityPainting) super.getHandle(); - } - - @Override - public String toString() { - return "CraftPainting[art=" + getArt() + "]"; - } - public Art getArt() { EnumArt art = getHandle().e; return CraftArt.NotchToBukkit(art); @@ -124,4 +114,14 @@ public class CraftPainting extends CraftEntity implements Painting { world.addEntity(painting); this.entity = painting; } + + @Override + public EntityPainting getHandle() { + return (EntityPainting) entity; + } + + @Override + public String toString() { + return "CraftPainting{art=" + getArt() + "}"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java index 78d5b877..fc2eb9e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java @@ -18,7 +18,7 @@ public class CraftPig extends CraftAnimals implements Pig { } public EntityPig getHandle() { - return (EntityPig) super.getHandle(); + return (EntityPig) entity; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java index f3087eba..3a129434 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java @@ -11,16 +11,6 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { super(server, entity); } - @Override - public EntityPigZombie getHandle() { - return (EntityPigZombie) super.getHandle(); - } - - @Override - public String toString() { - return "CraftPigZombie"; - } - public int getAnger() { return getHandle().angerLevel; } @@ -37,4 +27,13 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { return getAnger() > 0; } + @Override + public EntityPigZombie getHandle() { + return (EntityPigZombie) entity; + } + + @Override + public String toString() { + return "CraftPigZombie"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index bf404b4a..01b8740a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -86,11 +86,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } - @Override - public EntityPlayer getHandle() { - return (EntityPlayer) entity; - } - public double getEyeHeight() { return getEyeHeight(false); } @@ -107,11 +102,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } - public void setHandle(final EntityPlayer entity) { - super.setHandle((EntityHuman) entity); - this.entity = entity; - } - public void sendRawMessage(String message) { if (getHandle().netServerHandler == null) return; @@ -164,11 +154,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @Override - public String toString() { - return "CraftPlayer{" + "name=" + getName() + '}'; - } - - @Override public boolean equals(Object obj) { if (obj == null) { return false; @@ -183,13 +168,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return true; } - @Override - public int hashCode() { - int hash = 5; - hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0); - return hash; - } - public void kickPlayer(String message) { if (getHandle().netServerHandler == null) return; @@ -543,13 +521,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public Map<String, Object> serialize() { Map<String, Object> result = new LinkedHashMap<String, Object>(); - + result.put("name", getName()); - + return result; } public Player getPlayer() { return this; } + + @Override + public EntityPlayer getHandle() { + return (EntityPlayer) entity; + } + + public void setHandle(final EntityPlayer entity) { + super.setHandle(entity); + } + + @Override + public String toString() { + return "CraftPlayer{" + "name=" + getName() + '}'; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0); + return hash; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java index 668bc4af..b261a0f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java @@ -14,5 +14,4 @@ public class CraftPoweredMinecart extends CraftMinecart implements PoweredMineca public String toString() { return "CraftPoweredMinecart"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java index 240b9e94..7fea15e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java @@ -27,6 +27,11 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj @Override public EntityProjectile getHandle() { - return (EntityProjectile)entity; + return (EntityProjectile) entity; + } + + @Override + public String toString() { + return "CraftProjectile"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java index 2fe42935..ecc58c3d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -11,16 +11,6 @@ public class CraftSheep extends CraftAnimals implements Sheep { super(server, entity); } - @Override - public EntitySheep getHandle() { - return (EntitySheep) entity; - } - - @Override - public String toString() { - return "CraftSheep"; - } - public DyeColor getColor() { return DyeColor.getByData((byte) getHandle().getColor()); } @@ -37,4 +27,14 @@ public class CraftSheep extends CraftAnimals implements Sheep { getHandle().setSheared(flag); } + @Override + public EntitySheep getHandle() { + return (EntitySheep) entity; + } + + @Override + public String toString() { + return "CraftSheep"; + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java index 8296feae..5e608d2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java @@ -11,7 +11,7 @@ public class CraftSilverfish extends CraftMonster implements Silverfish { @Override public EntitySilverfish getHandle() { - return (EntitySilverfish) super.getHandle(); + return (EntitySilverfish) entity; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java index c4bd5e9e..0eab7074 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java @@ -12,8 +12,12 @@ public class CraftSkeleton extends CraftMonster implements Skeleton { } @Override + public EntitySkeleton getHandle() { + return (EntitySkeleton) entity; + } + + @Override public String toString() { return "CraftSkeleton"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index 0dc57f63..27a596a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -11,15 +11,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime { super(server, entity); } - @Override - public String toString() { - return "CraftSlime"; - } - - public EntitySlime getHandle() { - return (EntitySlime) super.getHandle(); - } - public int getSize() { return getHandle().getSize(); } @@ -27,4 +18,14 @@ public class CraftSlime extends CraftLivingEntity implements Slime { public void setSize(int size) { getHandle().setSize(size); } + + @Override + public EntitySlime getHandle() { + return (EntitySlime) entity; + } + + @Override + public String toString() { + return "CraftSlime"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java index 46775024..9902661e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java @@ -1,12 +1,21 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityFireball; +import net.minecraft.server.EntitySmallFireball; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.SmallFireball; public class CraftSmallFireball extends CraftFireball implements SmallFireball { - public CraftSmallFireball(CraftServer server, EntityFireball entity) { + public CraftSmallFireball(CraftServer server, EntitySmallFireball entity) { super(server, entity); } - + + @Override + public EntitySmallFireball getHandle() { + return (EntitySmallFireball) entity; + } + + @Override + public String toString() { + return "CraftSmallFireball"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java index cb52b2dc..006502e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java @@ -10,6 +10,11 @@ public class CraftSnowball extends CraftProjectile implements Snowball { } @Override + public EntitySnowball getHandle() { + return (EntitySnowball) entity; + } + + @Override public String toString() { return "CraftSnowball"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index acfc0521..f0bb1bb8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java @@ -1,11 +1,21 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityCreature; +import net.minecraft.server.EntitySnowman; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Snowman; public class CraftSnowman extends CraftCreature implements Snowman { - public CraftSnowman(CraftServer server, EntityCreature entity) { + public CraftSnowman(CraftServer server, EntitySnowman entity) { super(server, entity); } + + @Override + public EntitySnowman getHandle() { + return (EntitySnowman) entity; + } + + @Override + public String toString() { + return "CraftSnowman"; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java index ad30881a..32b0a11d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java @@ -12,8 +12,12 @@ public class CraftSpider extends CraftMonster implements Spider { } @Override + public EntitySpider getHandle() { + return (EntitySpider) entity; + } + + @Override public String toString() { return "CraftSpider"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java index 9b7427a8..b13fb225 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java @@ -12,8 +12,12 @@ public class CraftSquid extends CraftWaterMob implements Squid { } @Override + public EntitySquid getHandle() { + return (EntitySquid) entity; + } + + @Override public String toString() { return "CraftSquid"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java index bbbc58b1..58cb04bf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java @@ -11,16 +11,6 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { super(server, entity); } - @Override - public String toString() { - return "CraftTNTPrimed"; - } - - @Override - public EntityTNTPrimed getHandle() { - return (EntityTNTPrimed) super.getHandle(); - } - public float getYield() { return getHandle().yield; } @@ -45,4 +35,14 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { getHandle().fuseTicks = fuseTicks; } + @Override + public EntityTNTPrimed getHandle() { + return (EntityTNTPrimed) entity; + } + + @Override + public String toString() { + return "CraftTNTPrimed"; + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index 3faf0541..81dca041 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java @@ -1,15 +1,20 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.Entity; +import net.minecraft.server.EntityPotion; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ThrownPotion; public class CraftThrownPotion extends CraftProjectile implements ThrownPotion { - public CraftThrownPotion(CraftServer server, Entity entity) { + public CraftThrownPotion(CraftServer server, EntityPotion entity) { super(server, entity); } @Override + public EntityPotion getHandle() { + return (EntityPotion) entity; + } + + @Override public String toString() { return "CraftThrownPotion"; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 35b7e1a8..8b1c300a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -1,6 +1,5 @@ package org.bukkit.craftbukkit.entity; -import net.minecraft.server.EntityCreature; import net.minecraft.server.EntityVillager; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Villager; @@ -12,6 +11,11 @@ public class CraftVillager extends CraftCreature implements Villager { @Override public EntityVillager getHandle() { - return (EntityVillager)super.getHandle(); + return (EntityVillager) entity; + } + + @Override + public String toString() { + return "CraftVillager"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java index 62fa9bb9..39e8d89b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java @@ -12,8 +12,12 @@ public class CraftWaterMob extends CraftCreature implements WaterMob { } @Override + public EntityWaterAnimal getHandle() { + return (EntityWaterAnimal) entity; + } + + @Override public String toString() { return "CraftWaterMob"; } - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java index 671394e6..c937aac9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java @@ -12,6 +12,11 @@ public class CraftWeather extends CraftEntity implements Weather { @Override public EntityWeather getHandle() { - return (EntityWeather) super.getHandle(); + return (EntityWeather) entity; + } + + @Override + public String toString() { + return "CraftWeather"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index fc00141f..6aa91b2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -110,6 +110,6 @@ public class CraftWolf extends CraftAnimals implements Wolf { @Override public String toString() { - return "CraftWolf[anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "]"; + return "CraftWolf{anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "}"; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index bb32d3c9..6212e173 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -12,6 +12,11 @@ public class CraftZombie extends CraftMonster implements Zombie { } @Override + public EntityZombie getHandle() { + return (EntityZombie) entity; + } + + @Override public String toString() { return "CraftZombie"; } |