mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-18 08:35:44 +01:00
Support new skeleton and zombie types.
Also fix baby sheep colours.
This commit is contained in:
parent
28ad7b96d2
commit
00bd6a3e02
@ -12,6 +12,7 @@ import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.material.Colorable;
|
||||
|
||||
|
||||
@ -186,14 +187,16 @@ public class SpawnMob
|
||||
throw new Exception(_("slimeMalformedSize"), e);
|
||||
}
|
||||
}
|
||||
if (spawned instanceof Ageable && data.contains("baby"))
|
||||
|
||||
if ((spawned instanceof Ageable) && data.contains("baby"))
|
||||
{
|
||||
((Ageable)spawned).setBaby();
|
||||
return;
|
||||
data = data.replace("baby", "");
|
||||
}
|
||||
|
||||
if (spawned instanceof Colorable)
|
||||
{
|
||||
final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", "");
|
||||
final String color = data.toUpperCase(Locale.ENGLISH);
|
||||
try
|
||||
{
|
||||
if (color.equals("RANDOM"))
|
||||
@ -201,7 +204,7 @@ public class SpawnMob
|
||||
final Random rand = new Random();
|
||||
((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
|
||||
}
|
||||
else
|
||||
else if (color.length() > 1)
|
||||
{
|
||||
((Colorable)spawned).setColor(DyeColor.valueOf(color));
|
||||
}
|
||||
@ -211,21 +214,28 @@ public class SpawnMob
|
||||
throw new Exception(_("sheepMalformedColor"), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (spawned instanceof Tameable && data.contains("tamed") && target != null)
|
||||
{
|
||||
final Tameable tameable = ((Tameable)spawned);
|
||||
tameable.setTamed(true);
|
||||
tameable.setOwner(target.getBase());
|
||||
data = data.replace("tamed", "");
|
||||
}
|
||||
if (type == EntityType.WOLF
|
||||
&& data.contains("angry"))
|
||||
|
||||
if (type == EntityType.WOLF)
|
||||
{
|
||||
((Wolf)spawned).setAngry(true);
|
||||
if (data.contains("angry"))
|
||||
{
|
||||
((Wolf)spawned).setAngry(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == EntityType.CREEPER && data.contains("powered"))
|
||||
{
|
||||
((Creeper)spawned).setPowered(true);
|
||||
}
|
||||
|
||||
if (type == EntityType.OCELOT)
|
||||
{
|
||||
if (data.contains("siamese"))
|
||||
@ -241,6 +251,7 @@ public class SpawnMob
|
||||
((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == EntityType.VILLAGER)
|
||||
{
|
||||
for (Villager.Profession prof : Villager.Profession.values())
|
||||
@ -251,5 +262,26 @@ public class SpawnMob
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spawned instanceof Zombie)
|
||||
{
|
||||
if (data.contains("villager"))
|
||||
{
|
||||
((Zombie)spawned).setVillager(true);
|
||||
}
|
||||
if (data.contains("baby"))
|
||||
{
|
||||
((Zombie)spawned).setBaby(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == EntityType.SKELETON)
|
||||
{
|
||||
if (data.contains("wither"))
|
||||
{
|
||||
((Skeleton)spawned).setSkeletonType(SkeletonType.WITHER);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user