summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-07-28 01:15:47 +0100
committerKHobbits <rob@khobbits.co.uk>2011-07-28 01:15:47 +0100
commit12777af61aaeb20a95ea0a75ea40794a3b8efa36 (patch)
treeeaa0efe289853789c7f1b1678788c4d9373fea4f
parent33f48eae0dbf91afd6415606fd5f3a6bbcc38089 (diff)
downloadEssentials-12777af61aaeb20a95ea0a75ea40794a3b8efa36.tar
Essentials-12777af61aaeb20a95ea0a75ea40794a3b8efa36.tar.gz
Essentials-12777af61aaeb20a95ea0a75ea40794a3b8efa36.tar.lz
Essentials-12777af61aaeb20a95ea0a75ea40794a3b8efa36.tar.xz
Essentials-12777af61aaeb20a95ea0a75ea40794a3b8efa36.zip
adding sheep:random to /spawnmob
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index a2af502ee..86d2beac4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -7,6 +7,7 @@ import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Mob.MobException;
import com.earth2me.essentials.TargetBlock;
import com.earth2me.essentials.Util;
+import java.util.Random;
import net.minecraft.server.EntityWolf;
import net.minecraft.server.PathEntity;
import org.bukkit.DyeColor;
@@ -207,7 +208,15 @@ public class Commandspawnmob extends EssentialsCommand
{
try
{
- ((CraftSheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase()));
+ if (data.equalsIgnoreCase("random"))
+ {
+ Random rand = new Random();
+ ((CraftSheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
+ }
+ else
+ {
+ ((CraftSheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase()));
+ }
}
catch (Exception e)
{