From af51313ffb1b13de031ad66512c1cd2722a1c730 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Mon, 6 Feb 2012 00:19:23 -0500 Subject: [PATCH] [Bleeding] Added EntityType to replace CreatureType. --- .../java/net/minecraft/server/EntityEgg.java | 6 +- .../org/bukkit/craftbukkit/CraftWorld.java | 5 ++ .../block/CraftCreatureSpawner.java | 31 +++++++- .../bukkit/craftbukkit/entity/CraftArrow.java | 5 ++ .../bukkit/craftbukkit/entity/CraftBlaze.java | 5 ++ .../bukkit/craftbukkit/entity/CraftBoat.java | 5 ++ .../craftbukkit/entity/CraftCaveSpider.java | 6 ++ .../craftbukkit/entity/CraftChicken.java | 6 ++ .../craftbukkit/entity/CraftComplexPart.java | 5 ++ .../bukkit/craftbukkit/entity/CraftCow.java | 6 ++ .../craftbukkit/entity/CraftCreeper.java | 9 ++- .../bukkit/craftbukkit/entity/CraftEgg.java | 5 ++ .../craftbukkit/entity/CraftEnderCrystal.java | 5 ++ .../craftbukkit/entity/CraftEnderDragon.java | 8 ++ .../craftbukkit/entity/CraftEnderPearl.java | 5 ++ .../craftbukkit/entity/CraftEnderSignal.java | 7 +- .../craftbukkit/entity/CraftEnderman.java | 5 ++ .../entity/CraftExperienceOrb.java | 5 ++ .../craftbukkit/entity/CraftFallingSand.java | 5 ++ .../craftbukkit/entity/CraftFireball.java | 5 ++ .../bukkit/craftbukkit/entity/CraftFish.java | 5 ++ .../bukkit/craftbukkit/entity/CraftGhast.java | 6 ++ .../bukkit/craftbukkit/entity/CraftGiant.java | 5 ++ .../bukkit/craftbukkit/entity/CraftItem.java | 6 ++ .../entity/CraftLightningStrike.java | 7 +- .../craftbukkit/entity/CraftLivingEntity.java | 5 ++ .../craftbukkit/entity/CraftMagmaCube.java | 6 ++ .../craftbukkit/entity/CraftMinecart.java | 5 ++ .../craftbukkit/entity/CraftMushroomCow.java | 6 ++ .../craftbukkit/entity/CraftPainting.java | 5 ++ .../bukkit/craftbukkit/entity/CraftPig.java | 6 ++ .../craftbukkit/entity/CraftPigZombie.java | 5 ++ .../craftbukkit/entity/CraftPlayer.java | 5 ++ .../bukkit/craftbukkit/entity/CraftSheep.java | 4 + .../craftbukkit/entity/CraftSilverfish.java | 6 ++ .../craftbukkit/entity/CraftSkeleton.java | 5 ++ .../bukkit/craftbukkit/entity/CraftSlime.java | 5 ++ .../entity/CraftSmallFireball.java | 5 ++ .../craftbukkit/entity/CraftSnowball.java | 5 ++ .../craftbukkit/entity/CraftSnowman.java | 6 ++ .../craftbukkit/entity/CraftSpider.java | 5 ++ .../bukkit/craftbukkit/entity/CraftSquid.java | 5 ++ .../craftbukkit/entity/CraftTNTPrimed.java | 5 ++ .../craftbukkit/entity/CraftThrownPotion.java | 5 ++ .../craftbukkit/entity/CraftVillager.java | 6 ++ .../craftbukkit/entity/CraftWeather.java | 5 ++ .../bukkit/craftbukkit/entity/CraftWolf.java | 8 +- .../craftbukkit/entity/CraftZombie.java | 5 ++ .../craftbukkit/event/CraftEventFactory.java | 75 +------------------ 49 files changed, 280 insertions(+), 86 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 76490d10ff..4b311eb726 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -3,7 +3,7 @@ package net.minecraft.server; // CraftBukkit start import org.bukkit.Location; import org.bukkit.entity.Animals; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.player.PlayerEggThrowEvent; // CraftBukkit end @@ -36,7 +36,7 @@ public class EntityEgg extends EntityProjectile { numHatching = 0; } - CreatureType hatchingType = CreatureType.CHICKEN; + EntityType hatchingType = EntityType.CHICKEN; if (this.shooter instanceof EntityPlayer) { org.bukkit.entity.Player player = (this.shooter == null) ? null : (org.bukkit.entity.Player) this.shooter.getBukkitEntity(); @@ -46,7 +46,7 @@ public class EntityEgg extends EntityProjectile { hatching = event.isHatching(); numHatching = event.getNumHatches(); - hatchingType = event.getHatchType(); + hatchingType = event.getHatchingType(); } if (hatching) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index e4cc45aa10..744113b735 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -331,7 +331,12 @@ public class CraftWorld implements World { return (Arrow) arrow.getBukkitEntity(); } + @Deprecated public LivingEntity spawnCreature(Location loc, CreatureType creatureType) { + return spawnCreature(loc, creatureType.toEntityType()); + } + + public LivingEntity spawnCreature(Location loc, EntityType creatureType) { Entity result = spawn(loc, creatureType.getEntityClass()); if (result == null) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index 2960e6f67a..7bb3d43d39 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -1,10 +1,12 @@ package org.bukkit.craftbukkit.block; import net.minecraft.server.TileEntityMobSpawner; + import org.bukkit.block.Block; import org.bukkit.block.CreatureSpawner; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner { private final CraftWorld world; @@ -17,25 +19,48 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ()); } + @Deprecated public CreatureType getCreatureType() { return CreatureType.fromName(spawner.mobName); } + public EntityType getSpawnedType() { + return EntityType.fromName(spawner.mobName); + } + + @Deprecated public void setCreatureType(CreatureType creatureType) { spawner.mobName = creatureType.getName(); } + public void setSpawnedType(EntityType creatureType) { + if (!creatureType.isAlive() || !creatureType.isSpawnable()) { + throw new IllegalArgumentException("Can't spawn non-living entities from mob spawners!"); + } + + spawner.mobName = creatureType.getName(); + } + public String getCreatureTypeId() { return spawner.mobName; } - public void setCreatureTypeId(String creatureType) { + @Deprecated + public void setCreatureTypeId(String creatureName) { + setCreatureTypeByName(creatureName); + } + + public String getCreatureTypeName() { + return spawner.mobName; + } + + public void setCreatureTypeByName(String creatureType) { // Verify input - CreatureType type = CreatureType.fromName(creatureType); + EntityType type = EntityType.fromName(creatureType); if (type == null) { return; } - spawner.mobName = type.getName(); + setSpawnedType(type); } public int getDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 3166e4a6be..b46b9c4cc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityArrow; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; public class CraftArrow extends AbstractProjectile implements Arrow { @@ -35,4 +36,8 @@ public class CraftArrow extends AbstractProjectile implements Arrow { public String toString() { return "CraftArrow"; } + + public EntityType getType() { + return EntityType.ARROW; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java index 8214b84176..830d7a8406 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityBlaze; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Blaze; +import org.bukkit.entity.EntityType; public class CraftBlaze extends CraftMonster implements Blaze { public CraftBlaze(CraftServer server, EntityBlaze entity) { @@ -19,4 +20,8 @@ public class CraftBlaze extends CraftMonster implements Blaze { public String toString() { return "CraftBlaze"; } + + public EntityType getType() { + return EntityType.BLAZE; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java index 4e7a922d46..103b9d4597 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityBoat; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Boat; +import org.bukkit.entity.EntityType; public class CraftBoat extends CraftVehicle implements Boat { @@ -55,4 +56,8 @@ public class CraftBoat extends CraftVehicle implements Boat { public String toString() { return "CraftBoat"; } + + public EntityType getType() { + return EntityType.BOAT; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java index da099d8318..0648a851d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java @@ -1,8 +1,10 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityCaveSpider; + import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.CaveSpider; +import org.bukkit.entity.EntityType; public class CraftCaveSpider extends CraftSpider implements CaveSpider { public CraftCaveSpider(CraftServer server, EntityCaveSpider entity) { @@ -18,4 +20,8 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider { public String toString() { return "CraftCaveSpider"; } + + public EntityType getType() { + return EntityType.CAVE_SPIDER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index 2a66fc7c06..d20c2196ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java @@ -1,8 +1,10 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityChicken; + import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Chicken; +import org.bukkit.entity.EntityType; public class CraftChicken extends CraftAnimals implements Chicken { @@ -19,4 +21,8 @@ public class CraftChicken extends CraftAnimals implements Chicken { public String toString() { return "CraftChicken"; } + + public EntityType getType() { + return EntityType.CHICKEN; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java index 77b1fcb54c..84418100c9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityComplexPart; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.ComplexLivingEntity; +import org.bukkit.entity.EntityType; public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { public CraftComplexPart(CraftServer server, EntityComplexPart entity) { @@ -23,4 +24,8 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { public String toString() { return "CraftComplexPart"; } + + public EntityType getType() { + return EntityType.COMPLEX_PART; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java index c078004505..fc48ebd9b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java @@ -1,8 +1,10 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityCow; + import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Cow; +import org.bukkit.entity.EntityType; public class CraftCow extends CraftAnimals implements Cow { @@ -19,4 +21,8 @@ public class CraftCow extends CraftAnimals implements Cow { public String toString() { return "CraftCow"; } + + public EntityType getType() { + return EntityType.COW; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java index 722b49785f..354e13807c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityCreeper; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Creeper; +import org.bukkit.entity.EntityType; import org.bukkit.event.entity.CreeperPowerEvent; public class CraftCreeper extends CraftMonster implements Creeper { @@ -17,7 +18,6 @@ public class CraftCreeper extends CraftMonster implements Creeper { } public void setPowered(boolean powered) { - // CraftBukkit start CraftServer server = this.server; org.bukkit.entity.Entity entity = this.getHandle().getBukkitEntity(); @@ -36,9 +36,6 @@ public class CraftCreeper extends CraftMonster implements Creeper { getHandle().setPowered(false); } } - - // CraftBukkit end - } @Override @@ -50,4 +47,8 @@ public class CraftCreeper extends CraftMonster implements Creeper { public String toString() { return "CraftCreeper"; } + + public EntityType getType() { + return EntityType.CREEPER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java index c20739f83f..60c5188ec4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityEgg; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Egg; +import org.bukkit.entity.EntityType; public class CraftEgg extends CraftProjectile implements Egg { public CraftEgg(CraftServer server, EntityEgg entity) { @@ -18,4 +19,8 @@ public class CraftEgg extends CraftProjectile implements Egg { public String toString() { return "CraftEgg"; } + + public EntityType getType() { + return EntityType.EGG; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java index 6fe52e34d6..2bcf3a1a02 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityEnderCrystal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderCrystal; +import org.bukkit.entity.EntityType; public class CraftEnderCrystal extends CraftEntity implements EnderCrystal { public CraftEnderCrystal(CraftServer server, EntityEnderCrystal entity) { @@ -18,4 +19,8 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal { public String toString() { return "CraftEnderCrystal"; } + + public EntityType getType() { + return EntityType.ENDER_CRYSTAL; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index 98357be2ab..fa0d63aea5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -2,12 +2,16 @@ package org.bukkit.craftbukkit.entity; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; + import java.util.Set; + import net.minecraft.server.EntityComplexPart; import net.minecraft.server.EntityEnderDragon; + import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.EntityType; public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon { public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) { @@ -33,4 +37,8 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD public String toString() { return "CraftEnderDragon"; } + + public EntityType getType() { + return EntityType.ENDER_DRAGON; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java index 1dd0042336..f42f9ab7ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityEnderPearl; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.EntityType; public class CraftEnderPearl extends CraftProjectile implements EnderPearl { public CraftEnderPearl(CraftServer server, EntityEnderPearl entity) { @@ -18,4 +19,8 @@ public class CraftEnderPearl extends CraftProjectile implements EnderPearl { public String toString() { return "CraftEnderPearl"; } + + public EntityType getType() { + return EntityType.ENDER_PEARL; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java index 1a1f899bc9..e3a5081ef9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityEnderSignal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EnderSignal; +import org.bukkit.entity.EntityType; public class CraftEnderSignal extends CraftEntity implements EnderSignal { public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) { @@ -18,4 +19,8 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal { public String toString() { return "CraftEnderSignal"; } -} + + public EntityType getType() { + return EntityType.ENDER_SIGNAL; + } +} \ No newline at end of file diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index 20464076d9..86f09ac9d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -5,6 +5,7 @@ import net.minecraft.server.EntityEnderman; import org.bukkit.Material; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Enderman; +import org.bukkit.entity.EntityType; import org.bukkit.material.MaterialData; public class CraftEnderman extends CraftMonster implements Enderman { @@ -30,4 +31,8 @@ public class CraftEnderman extends CraftMonster implements Enderman { public String toString() { return "CraftEnderman"; } + + public EntityType getType() { + return EntityType.ENDERMAN; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java index 75d0ea4c1c..3a09cab3d4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityExperienceOrb; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.ExperienceOrb; public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { @@ -26,4 +27,8 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { public String toString() { return "CraftExperienceOrb"; } + + public EntityType getType() { + return EntityType.EXPERIENCE_ORB; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java index 222d43369a..f6a954553a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityFallingBlock; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.entity.CraftEntity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.FallingSand; public class CraftFallingSand extends CraftEntity implements FallingSand { @@ -21,4 +22,8 @@ public class CraftFallingSand extends CraftEntity implements FallingSand { public String toString() { return "CraftFallingSand"; } + + public EntityType getType() { + return EntityType.FALLING_BLOCK; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index 27e00aaa31..83e631530a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityFireball; import net.minecraft.server.EntityLiving; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Fireball; import org.bukkit.entity.LivingEntity; import org.bukkit.util.Vector; @@ -60,4 +61,8 @@ public class CraftFireball extends AbstractProjectile implements Fireball { public String toString() { return "CraftFireball"; } + + public EntityType getType() { + return EntityType.FIREBALL; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java index b8453e9304..58c28b380d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntityFishingHook; import net.minecraft.server.EntityHuman; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Fish; import org.bukkit.entity.LivingEntity; @@ -35,4 +36,8 @@ public class CraftFish extends AbstractProjectile implements Fish { public String toString() { return "CraftFish"; } + + public EntityType getType() { + return EntityType.FISHING_HOOK; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index 532b16f9d9..ee9516fc41 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityGhast; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Ghast; public class CraftGhast extends CraftFlying implements Ghast { @@ -19,4 +21,8 @@ public class CraftGhast extends CraftFlying implements Ghast { public String toString() { return "CraftGhast"; } + + public EntityType getType() { + return EntityType.GHAST; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java index 50e0ffb16c..e5609130d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityGiantZombie; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; public class CraftGiant extends CraftMonster implements Giant { @@ -20,4 +21,8 @@ public class CraftGiant extends CraftMonster implements Giant { public String toString() { return "CraftGiant"; } + + public EntityType getType() { + return EntityType.GIANT; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index a92598be7f..36143dbaf9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -1,6 +1,8 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityItem; + +import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack; @@ -39,4 +41,8 @@ public class CraftItem extends CraftEntity implements Item { public String toString() { return "CraftItem"; } + + public EntityType getType() { + return EntityType.DROPPED_ITEM; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index 1a17c7fd91..6142b4703a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityWeatherLighting; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LightningStrike; public class CraftLightningStrike extends CraftEntity implements LightningStrike { @@ -20,6 +21,10 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike @Override public String toString() { - return "CraftLightningStrik"; + return "CraftLightningStrike"; + } + + public EntityType getType() { + return EntityType.LIGHTNING; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 1bd5fab894..cbf5c1c211 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -21,6 +21,7 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Arrow; import org.bukkit.entity.Egg; +import org.bukkit.entity.EntityType; import org.bukkit.entity.HumanEntity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -275,4 +276,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } return effects; } + + public EntityType getType() { + return EntityType.UNKNOWN; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java index 0c6683a53b..dace70b4f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityMagmaCube; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.MagmaCube; public class CraftMagmaCube extends CraftSlime implements MagmaCube { @@ -18,4 +20,8 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube { public String toString() { return "CraftMagmaCube"; } + + public EntityType getType() { + return EntityType.MAGMA_CUBE; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index d4420bd580..807bd2cf2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityMinecart; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; @@ -81,4 +82,8 @@ public class CraftMinecart extends CraftVehicle implements Minecart { public String toString() { return "CraftMinecart"; } + + public EntityType getType() { + return EntityType.MINECART; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java index 8173d893f0..3dd7ea3f22 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityMushroomCow; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.MushroomCow; public class CraftMushroomCow extends CraftCow implements MushroomCow { @@ -18,4 +20,8 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow { public String toString() { return "CraftMushroomCow"; } + + public EntityType getType() { + return EntityType.MUSHROOM_COW; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java index 0fd2176163..7cfca808f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java @@ -10,6 +10,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftArt; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Painting; public class CraftPainting extends CraftEntity implements Painting { @@ -122,4 +123,8 @@ public class CraftPainting extends CraftEntity implements Painting { public String toString() { return "CraftPainting{art=" + getArt() + "}"; } + + public EntityType getType() { + return EntityType.PAINTING; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java index fc2eb9e0ef..82bc7a6f03 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityPig; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Pig; public class CraftPig extends CraftAnimals implements Pig { @@ -25,4 +27,8 @@ public class CraftPig extends CraftAnimals implements Pig { public String toString() { return "CraftPig"; } + + public EntityType getType() { + return EntityType.PIG; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java index 3a129434bb..0e6ccea771 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityPigZombie; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; public class CraftPigZombie extends CraftZombie implements PigZombie { @@ -36,4 +37,8 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { public String toString() { return "CraftPigZombie"; } + + public EntityType getType() { + return EntityType.PIG_ZOMBIE; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 7cca8b1ddb..fe9e72b62a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.map.CraftMapView; import org.bukkit.craftbukkit.map.RenderData; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerTeleportEvent; @@ -718,4 +719,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().netServerHandler.sendPacket(packet); } } + + public EntityType getType() { + return EntityType.PLAYER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java index ecc58c3d46..46f8ef0a57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -4,6 +4,7 @@ import net.minecraft.server.EntitySheep; import org.bukkit.DyeColor; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Sheep; public class CraftSheep extends CraftAnimals implements Sheep { @@ -37,4 +38,7 @@ public class CraftSheep extends CraftAnimals implements Sheep { return "CraftSheep"; } + public EntityType getType() { + return EntityType.SHEEP; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java index 5e608d2f37..ef9477519f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySilverfish; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Silverfish; public class CraftSilverfish extends CraftMonster implements Silverfish { @@ -18,4 +20,8 @@ public class CraftSilverfish extends CraftMonster implements Silverfish { public String toString() { return "CraftSilverfish"; } + + public EntityType getType() { + return EntityType.SILVERFISH; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java index 0eab7074e0..3093341456 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySkeleton; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Skeleton; public class CraftSkeleton extends CraftMonster implements Skeleton { @@ -20,4 +21,8 @@ public class CraftSkeleton extends CraftMonster implements Skeleton { public String toString() { return "CraftSkeleton"; } + + public EntityType getType() { + return EntityType.SKELETON; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index 27a596a772..da3df00f84 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySlime; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Slime; public class CraftSlime extends CraftLivingEntity implements Slime { @@ -28,4 +29,8 @@ public class CraftSlime extends CraftLivingEntity implements Slime { public String toString() { return "CraftSlime"; } + + public EntityType getType() { + return EntityType.SLIME; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java index 9902661ea5..720097004c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySmallFireball; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.SmallFireball; public class CraftSmallFireball extends CraftFireball implements SmallFireball { @@ -18,4 +19,8 @@ public class CraftSmallFireball extends CraftFireball implements SmallFireball { public String toString() { return "CraftSmallFireball"; } + + public EntityType getType() { + return EntityType.SMALL_FIREBALL; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java index 006502e411..44de7496c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySnowball; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Snowball; public class CraftSnowball extends CraftProjectile implements Snowball { @@ -18,4 +19,8 @@ public class CraftSnowball extends CraftProjectile implements Snowball { public String toString() { return "CraftSnowball"; } + + public EntityType getType() { + return EntityType.SNOWBALL; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index f0bb1bb8bf..d725de330c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySnowman; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Snowman; public class CraftSnowman extends CraftCreature implements Snowman { @@ -18,4 +20,8 @@ public class CraftSnowman extends CraftCreature implements Snowman { public String toString() { return "CraftSnowman"; } + + public EntityType getType() { + return EntityType.SNOWMAN; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java index 32b0a11d2b..2a07fe1b28 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySpider; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Spider; public class CraftSpider extends CraftMonster implements Spider { @@ -20,4 +21,8 @@ public class CraftSpider extends CraftMonster implements Spider { public String toString() { return "CraftSpider"; } + + public EntityType getType() { + return EntityType.SPIDER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java index b13fb2259e..433a7c6ac5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntitySquid; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Squid; public class CraftSquid extends CraftWaterMob implements Squid { @@ -20,4 +21,8 @@ public class CraftSquid extends CraftWaterMob implements Squid { public String toString() { return "CraftSquid"; } + + public EntityType getType() { + return EntityType.SQUID; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java index 58cb04bfca..d9ac266ba1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityTNTPrimed; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.TNTPrimed; public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { @@ -45,4 +46,8 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { return "CraftTNTPrimed"; } + public EntityType getType() { + return EntityType.PRIMED_TNT; + } + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index 5afda66172..0636b6f37d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java @@ -5,6 +5,7 @@ import java.util.Collection; import net.minecraft.server.EntityPotion; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.ThrownPotion; import org.bukkit.potion.Potion; import org.bukkit.potion.PotionEffectType; @@ -34,4 +35,8 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion { public String toString() { return "CraftThrownPotion"; } + + public EntityType getType() { + return EntityType.SPLASH_POTION; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 8b1c300a65..2cb26a7b40 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -1,7 +1,9 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityVillager; + import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Villager; public class CraftVillager extends CraftCreature implements Villager { @@ -18,4 +20,8 @@ public class CraftVillager extends CraftCreature implements Villager { public String toString() { return "CraftVillager"; } + + public EntityType getType() { + return EntityType.VILLAGER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java index 7d27e43f0a..91a749334a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityWeather; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Weather; public class CraftWeather extends CraftEntity implements Weather { @@ -18,4 +19,8 @@ public class CraftWeather extends CraftEntity implements Weather { public String toString() { return "CraftWeather"; } + + public EntityType getType() { + return EntityType.WEATHER; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index 304ca35bad..86326b0a6d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -1,11 +1,13 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityWolf; +import net.minecraft.server.PathEntity; + import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.AnimalTamer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; -import net.minecraft.server.PathEntity; public class CraftWolf extends CraftAnimals implements Wolf { private AnimalTamer owner; @@ -112,4 +114,8 @@ public class CraftWolf extends CraftAnimals implements Wolf { public String toString() { return "CraftWolf{anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "}"; } + + public EntityType getType() { + return EntityType.WOLF; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 6212e1730d..12139e3118 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityZombie; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Zombie; public class CraftZombie extends CraftMonster implements Zombie { @@ -20,4 +21,8 @@ public class CraftZombie extends CraftMonster implements Zombie { public String toString() { return "CraftZombie"; } + + public EntityType getType() { + return EntityType.ZOMBIE; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index a829d2ef9a..b06db0f0aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -8,36 +8,13 @@ import net.minecraft.server.ChunkCoordinates; import net.minecraft.server.DamageSource; import net.minecraft.server.Entity; import net.minecraft.server.EntityArrow; -import net.minecraft.server.EntityBlaze; -import net.minecraft.server.EntityCaveSpider; -import net.minecraft.server.EntityChicken; import net.minecraft.server.EntityComplexPart; -import net.minecraft.server.EntityCow; -import net.minecraft.server.EntityCreeper; import net.minecraft.server.EntityEnderCrystal; -import net.minecraft.server.EntityEnderDragon; -import net.minecraft.server.EntityEnderman; -import net.minecraft.server.EntityGhast; -import net.minecraft.server.EntityGiantZombie; import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityItem; -import net.minecraft.server.EntityMagmaCube; import net.minecraft.server.EntityLiving; -import net.minecraft.server.EntityMushroomCow; -import net.minecraft.server.EntityPig; -import net.minecraft.server.EntityPigZombie; import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPotion; -import net.minecraft.server.EntitySheep; -import net.minecraft.server.EntitySilverfish; -import net.minecraft.server.EntitySkeleton; -import net.minecraft.server.EntitySlime; -import net.minecraft.server.EntitySnowman; -import net.minecraft.server.EntitySpider; -import net.minecraft.server.EntitySquid; -import net.minecraft.server.EntityVillager; -import net.minecraft.server.EntityWolf; -import net.minecraft.server.EntityZombie; import net.minecraft.server.Item; import net.minecraft.server.ItemStack; import net.minecraft.server.World; @@ -58,7 +35,6 @@ import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.Arrow; -import org.bukkit.entity.CreatureType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -232,57 +208,10 @@ public class CraftEventFactory { * CreatureSpawnEvent */ public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) { - org.bukkit.entity.Entity entity = entityliving.getBukkitEntity(); + LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity(); CraftServer craftServer = (CraftServer) entity.getServer(); - CreatureType type = null; - - if (entityliving instanceof EntityChicken) { - type = CreatureType.CHICKEN; - } else if (entityliving instanceof EntityCow) { - if (entityliving instanceof EntityMushroomCow) type = CreatureType.MUSHROOM_COW; - else type = CreatureType.COW; - } else if (entityliving instanceof EntityCreeper) { - type = CreatureType.CREEPER; - } else if (entityliving instanceof EntityGhast) { - type = CreatureType.GHAST; - } else if (entityliving instanceof EntityGiantZombie) { - type = CreatureType.GIANT; - } else if (entityliving instanceof EntityWolf) { - type = CreatureType.WOLF; - } else if (entityliving instanceof EntityPig) { - type = CreatureType.PIG; - } else if (entityliving instanceof EntityPigZombie) { - type = CreatureType.PIG_ZOMBIE; - } else if (entityliving instanceof EntitySheep) { - type = CreatureType.SHEEP; - } else if (entityliving instanceof EntitySkeleton) { - type = CreatureType.SKELETON; - } else if (entityliving instanceof EntitySlime) { - if (entityliving instanceof EntityMagmaCube) type = CreatureType.MAGMA_CUBE; - else type = CreatureType.SLIME; - } else if (entityliving instanceof EntitySpider) { - if (entityliving instanceof EntityCaveSpider) type = CreatureType.CAVE_SPIDER; - else type = CreatureType.SPIDER; - } else if (entityliving instanceof EntitySquid) { - type = CreatureType.SQUID; - } else if (entityliving instanceof EntityZombie) { - type = CreatureType.ZOMBIE; - } else if (entityliving instanceof EntityEnderman) { - type = CreatureType.ENDERMAN; - } else if (entityliving instanceof EntitySnowman) { - type = CreatureType.SNOWMAN; - } else if (entityliving instanceof EntityEnderDragon) { - type = CreatureType.ENDER_DRAGON; - } else if (entityliving instanceof EntityVillager) { - type = CreatureType.VILLAGER; - } else if (entityliving instanceof EntityBlaze) { - type = CreatureType.BLAZE; - } else if (entityliving instanceof EntitySilverfish) { - type = CreatureType.SILVERFISH; - } - - CreatureSpawnEvent event = new CreatureSpawnEvent(entity, type, entity.getLocation(), spawnReason); + CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason); craftServer.getPluginManager().callEvent(event); return event; }