mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-06 11:00:43 +01:00
adding sheep:random to /spawnmob
This commit is contained in:
parent
33f48eae0d
commit
12777af61a
@ -7,6 +7,7 @@ import com.earth2me.essentials.Mob;
|
|||||||
import com.earth2me.essentials.Mob.MobException;
|
import com.earth2me.essentials.Mob.MobException;
|
||||||
import com.earth2me.essentials.TargetBlock;
|
import com.earth2me.essentials.TargetBlock;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import java.util.Random;
|
||||||
import net.minecraft.server.EntityWolf;
|
import net.minecraft.server.EntityWolf;
|
||||||
import net.minecraft.server.PathEntity;
|
import net.minecraft.server.PathEntity;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
@ -206,9 +207,17 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
if ("Sheep".equalsIgnoreCase(type))
|
if ("Sheep".equalsIgnoreCase(type))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
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()));
|
((CraftSheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("sheepMalformedColor"), e);
|
throw new Exception(Util.i18n("sheepMalformedColor"), e);
|
||||||
|
Loading…
Reference in New Issue
Block a user