From 4c610d2a02c3f9a7addf3c86386f8c5214b72d4d Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 28 Jul 2011 01:15:47 +0100 Subject: adding sheep:random to /spawnmob --- .../src/com/earth2me/essentials/commands/Commandspawnmob.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3