summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/Mob.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/Mob.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/Mob.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java
index 6cef12a7c..1586b041d 100644
--- a/Essentials/src/com/earth2me/essentials/Mob.java
+++ b/Essentials/src/com/earth2me/essentials/Mob.java
@@ -6,11 +6,15 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+// Suffixes can be appended on the end of a mob name to make it plural
+// Entities without a suffix, will default to 's'
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN),
@@ -37,8 +41,14 @@ public enum Mob
MAGMACUBE("MagmaCube", Enemies.ENEMY, EntityType.MAGMA_CUBE),
SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN),
OCELOT("Ocelot", Enemies.NEUTRAL, EntityType.OCELOT),
- IRONGOLEM("IronGolem", Enemies.NEUTRAL, EntityType.IRON_GOLEM);
-
+ IRONGOLEM("IronGolem", Enemies.NEUTRAL, EntityType.IRON_GOLEM),
+ WITHER("Wither", Enemies.ENEMY, EntityType.WITHER),
+ BAT("Bat", Enemies.FRIENDLY, EntityType.BAT),
+ WITCH("Witch", Enemies.ENEMY, EntityType.WITCH),
+ BOAT("Boat", Enemies.NEUTRAL, EntityType.BOAT),
+ MINECART("Minecart", Enemies.NEUTRAL, EntityType.MINECART),
+ ENDERCRYSTAL("EnderCrystal", Enemies.NEUTRAL, EntityType.ENDER_CRYSTAL),
+ EXPERIENCEORB("ExperienceOrb", Enemies.NEUTRAL, EntityType.EXPERIENCE_ORB);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s, EntityType type)
@@ -68,14 +78,20 @@ public enum Mob
hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob);
}
}
-
- public static Set<String> getMobList() {
+
+ public static Set<String> getMobList()
+ {
return Collections.unmodifiableSet(hashMap.keySet());
}
- public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
+ public Entity spawn(final Player player, final Server server, final Location loc) throws MobException
+ {
+ return spawn(player.getWorld(), server, loc);
+ }
+
+ public Entity spawn(final World world, final Server server, final Location loc) throws MobException
{
- final LivingEntity entity = player.getWorld().spawn(loc, (Class<? extends LivingEntity>)this.bukkitType.getEntityClass());
+ final Entity entity = world.spawn(loc, (Class<? extends Entity>)this.bukkitType.getEntityClass());
if (entity == null)
{
logger.log(Level.WARNING, _("unableToSpawnMob"));