summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-20 14:33:17 +0100
committersnowleo <schneeleo@gmail.com>2011-11-20 14:33:17 +0100
commit293f2f7cd28ea69ad34aa4cce4e61369ce49ad99 (patch)
treea29f37a857772a491e45bb65af2f95bebe211619
parent1f6b1f4a2cf1d1a2c5c27656d823a3156ec03d62 (diff)
downloadEssentials-293f2f7cd28ea69ad34aa4cce4e61369ce49ad99.tar
Essentials-293f2f7cd28ea69ad34aa4cce4e61369ce49ad99.tar.gz
Essentials-293f2f7cd28ea69ad34aa4cce4e61369ce49ad99.tar.lz
Essentials-293f2f7cd28ea69ad34aa4cce4e61369ce49ad99.tar.xz
Essentials-293f2f7cd28ea69ad34aa4cce4e61369ce49ad99.zip
Added new mobs
-rw-r--r--Essentials/src/com/earth2me/essentials/Mob.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawner.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java10
3 files changed, 20 insertions, 18 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java
index d937ba0fb..b8c7388fd 100644
--- a/Essentials/src/com/earth2me/essentials/Mob.java
+++ b/Essentials/src/com/earth2me/essentials/Mob.java
@@ -29,8 +29,12 @@ public enum Mob
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);
-
+ 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);
+ //TODO: Snowman
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s, CreatureType type)
@@ -47,7 +51,6 @@ public enum Mob
this.type = en;
this.bukkitType = type;
}
-
public String suffix = "s";
final public String name;
final public Enemies type;
@@ -58,7 +61,7 @@ public enum Mob
{
for (Mob mob : Mob.values())
{
- hashMap.put(mob.name, mob);
+ hashMap.put(mob.name.toLowerCase(), mob);
}
}
@@ -81,24 +84,26 @@ public enum Mob
NEUTRAL("neutral"),
ENEMY("enemy");
- private Enemies(final String t)
+ private Enemies(final String type)
{
- this.type = t;
+ this.type = type;
}
final protected String type;
}
- public CreatureType getType () {
+ public CreatureType getType()
+ {
return bukkitType;
}
- public static class MobException extends Exception
+ public static Mob fromName(final String name)
{
- private static final long serialVersionUID = 1L;
+ return hashMap.get(name.toLowerCase());
}
- public static Mob fromName(String n)
+
+ public static class MobException extends Exception
{
- return hashMap.get(n);
+ private static final long serialVersionUID = 1L;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
index 18e4fb349..cbec7955d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
@@ -34,7 +34,6 @@ public class Commandspawner extends EssentialsCommand
try
{
String name = args[0];
- name = name.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : name.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(name);
Mob mob = null;
mob = Mob.fromName(name);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 49f2a67d1..1e5682beb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -32,7 +32,6 @@ public class Commandspawnmob extends EssentialsCommand
String[] mountparts = args[0].split(",");
String[] parts = mountparts[0].split(":");
String mobType = parts[0];
- mobType = mobType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mobType);
String mobData = null;
if (parts.length == 2)
{
@@ -44,7 +43,6 @@ public class Commandspawnmob extends EssentialsCommand
{
parts = mountparts[1].split(":");
mountType = parts[0];
- mountType = mountType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mountType);
if (parts.length == 2)
{
mountData = parts[1];
@@ -62,14 +60,14 @@ public class Commandspawnmob extends EssentialsCommand
{
throw new Exception(Util.i18n("invalidMob"));
}
-
+
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
{
throw new Exception(Util.i18n("unableToSpawnMob"));
}
-
+
final Block block = Util.getTarget(user).getBlock();
- if (block == null)
+ if (block == null)
{
throw new Exception(Util.i18n("unableToSpawnMob"));
}
@@ -92,7 +90,7 @@ public class Commandspawnmob extends EssentialsCommand
user.sendMessage(Util.i18n("invalidMob"));
return;
}
-
+
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
{
throw new Exception(Util.i18n("unableToSpawnMob"));