summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-11-30 03:58:20 +0000
committerKHobbits <rob@khobbits.co.uk>2011-11-30 03:58:20 +0000
commita8a9fc3dd6444d591a24f2267a80222e8ac44272 (patch)
tree650a20950ab0be4011663b41c8aecdb677e36627
parent1de4a40bf65b81b16dc931391776ac5318ce559e (diff)
downloadEssentials-a8a9fc3dd6444d591a24f2267a80222e8ac44272.tar
Essentials-a8a9fc3dd6444d591a24f2267a80222e8ac44272.tar.gz
Essentials-a8a9fc3dd6444d591a24f2267a80222e8ac44272.tar.lz
Essentials-a8a9fc3dd6444d591a24f2267a80222e8ac44272.tar.xz
Essentials-a8a9fc3dd6444d591a24f2267a80222e8ac44272.zip
/spawnmob sheep:<colour> + /spawnmob sheep:baby = /spawnmob sheep:<colour>baby.
And as a nice extra, random: /spawnmob sheep:randombaby 10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 2c1fa9538..d42437368 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -205,16 +205,21 @@ public class Commandspawnmob extends EssentialsCommand
}
if (type == CreatureType.SHEEP)
{
+ if (data.toLowerCase(Locale.ENGLISH).contains("baby")) {
+ ((Sheep)spawned).setAge(-24000);
+ }
+ final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", "");
try
- {
- if (data.equalsIgnoreCase("random"))
+ {
+
+ if (color.equalsIgnoreCase("random"))
{
Random rand = new Random();
((Sheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
}
else
{
- ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase(Locale.ENGLISH)));
+ ((Sheep)spawned).setColor(DyeColor.valueOf(color));
}
}
catch (Exception e)