From 056303b53c953f4a9effa661b1a61d35893a8858 Mon Sep 17 00:00:00 2001 From: snowleo Date: Thu, 1 Mar 2012 17:33:09 +0100 Subject: EntityType instead of CreatureType --- Essentials/src/com/earth2me/essentials/Mob.java | 56 +++++++++++----------- .../essentials/commands/Commandspawner.java | 3 +- .../essentials/commands/Commandspawnmob.java | 24 +++++----- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java index 049f7b8a3..7be698950 100644 --- a/Essentials/src/com/earth2me/essentials/Mob.java +++ b/Essentials/src/com/earth2me/essentials/Mob.java @@ -9,40 +9,40 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; public enum Mob { - CHICKEN("Chicken", Enemies.FRIENDLY, CreatureType.CHICKEN), - COW("Cow", Enemies.FRIENDLY, CreatureType.COW), - CREEPER("Creeper", Enemies.ENEMY, CreatureType.CREEPER), - GHAST("Ghast", Enemies.ENEMY, CreatureType.GHAST), - GIANT("Giant", Enemies.ENEMY, CreatureType.GIANT), - PIG("Pig", Enemies.FRIENDLY, CreatureType.PIG), - PIGZOMB("PigZombie", Enemies.NEUTRAL, CreatureType.PIG_ZOMBIE), - SHEEP("Sheep", Enemies.FRIENDLY, "", CreatureType.SHEEP), - SKELETON("Skeleton", Enemies.ENEMY, CreatureType.SKELETON), - SLIME("Slime", Enemies.ENEMY, CreatureType.SLIME), - SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER), - SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID), - ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE), - WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF), - CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER), - ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN), - SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH), - ENDERDRAGON("EnderDragon", Enemies.ENEMY, CreatureType.ENDER_DRAGON), - VILLAGER("Villager", Enemies.FRIENDLY, CreatureType.VILLAGER), - BLAZE("Blaze", Enemies.ENEMY, CreatureType.BLAZE), - MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, CreatureType.MUSHROOM_COW), - MAGMACUBE("MagmaCube", Enemies.ENEMY, CreatureType.MAGMA_CUBE), - SNOWMAN("Snowman", Enemies.FRIENDLY, "", CreatureType.SNOWMAN); + CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN), + COW("Cow", Enemies.FRIENDLY, EntityType.COW), + CREEPER("Creeper", Enemies.ENEMY, EntityType.CREEPER), + GHAST("Ghast", Enemies.ENEMY, EntityType.GHAST), + GIANT("Giant", Enemies.ENEMY, EntityType.GIANT), + PIG("Pig", Enemies.FRIENDLY, EntityType.PIG), + PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE), + SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP), + SKELETON("Skeleton", Enemies.ENEMY, EntityType.SKELETON), + SLIME("Slime", Enemies.ENEMY, EntityType.SLIME), + SPIDER("Spider", Enemies.ENEMY, EntityType.SPIDER), + SQUID("Squid", Enemies.FRIENDLY, EntityType.SQUID), + ZOMBIE("Zombie", Enemies.ENEMY, EntityType.ZOMBIE), + WOLF("Wolf", Enemies.NEUTRAL, EntityType.WOLF), + CAVESPIDER("CaveSpider", Enemies.ENEMY, EntityType.CAVE_SPIDER), + ENDERMAN("Enderman", Enemies.ENEMY, "", EntityType.ENDERMAN), + SILVERFISH("Silverfish", Enemies.ENEMY, "", EntityType.SILVERFISH), + ENDERDRAGON("EnderDragon", Enemies.ENEMY, EntityType.ENDER_DRAGON), + VILLAGER("Villager", Enemies.FRIENDLY, EntityType.VILLAGER), + BLAZE("Blaze", Enemies.ENEMY, EntityType.BLAZE), + MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, EntityType.MUSHROOM_COW), + MAGMACUBE("MagmaCube", Enemies.ENEMY, EntityType.MAGMA_CUBE), + SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN); public static final Logger logger = Logger.getLogger("Minecraft"); - private Mob(String n, Enemies en, String s, CreatureType type) + private Mob(String n, Enemies en, String s, EntityType type) { this.suffix = s; this.name = n; @@ -50,7 +50,7 @@ public enum Mob this.bukkitType = type; } - private Mob(String n, Enemies en, CreatureType type) + private Mob(String n, Enemies en, EntityType type) { this.name = n; this.type = en; @@ -59,7 +59,7 @@ public enum Mob public String suffix = "s"; final public String name; final public Enemies type; - final private CreatureType bukkitType; + final private EntityType bukkitType; private static final Map hashMap = new HashMap(); static @@ -99,7 +99,7 @@ public enum Mob final protected String type; } - public CreatureType getType() + public EntityType getType() { return bukkitType; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index d52315241..1cd65a743 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -10,6 +10,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.EntityType; public class Commandspawner extends EssentialsCommand @@ -54,7 +55,7 @@ public class Commandspawner extends EssentialsCommand } final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess); charge.isAffordableFor(user); - ((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType()); + ((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob.getType()); charge.charge(user); user.sendMessage(_("setSpawner", mob.name)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 948c82871..4971c7922 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -197,9 +197,9 @@ public class Commandspawnmob extends EssentialsCommand } } - private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception + private void changeMobData(final EntityType type, final Entity spawned, final String data, final User user) throws Exception { - if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE) + if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE) { try { @@ -210,18 +210,18 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("slimeMalformedSize"), e); } } - if ((type == CreatureType.SHEEP - || type == CreatureType.COW - || type == CreatureType.MUSHROOM_COW - || type == CreatureType.CHICKEN - || type == CreatureType.PIG - || type == CreatureType.WOLF) + if ((type == EntityType.SHEEP + || type == EntityType.COW + || type == EntityType.MUSHROOM_COW + || type == EntityType.CHICKEN + || type == EntityType.PIG + || type == EntityType.WOLF) && data.equalsIgnoreCase("baby")) { ((Animals)spawned).setAge(-24000); return; } - if (type == CreatureType.SHEEP) + if (type == EntityType.SHEEP) { if (data.toLowerCase(Locale.ENGLISH).contains("baby")) { @@ -246,7 +246,7 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("sheepMalformedColor"), e); } } - if (type == CreatureType.WOLF + if (type == EntityType.WOLF && data.toLowerCase(Locale.ENGLISH).startsWith("tamed")) { final Wolf wolf = ((Wolf)spawned); @@ -258,7 +258,7 @@ public class Commandspawnmob extends EssentialsCommand ((Animals)spawned).setAge(-24000); } } - if (type == CreatureType.WOLF + if (type == EntityType.WOLF && data.toLowerCase(Locale.ENGLISH).startsWith("angry")) { ((Wolf)spawned).setAngry(true); @@ -267,7 +267,7 @@ public class Commandspawnmob extends EssentialsCommand ((Animals)spawned).setAge(-24000); } } - if (type == CreatureType.CREEPER && data.equalsIgnoreCase("powered")) + if (type == EntityType.CREEPER && data.equalsIgnoreCase("powered")) { ((Creeper)spawned).setPowered(true); } -- cgit v1.2.3