mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 04:21:31 +02:00
@@ -72,7 +72,7 @@ public class SpawnMob
|
|||||||
for (String mobPart : mobParts)
|
for (String mobPart : mobParts)
|
||||||
{
|
{
|
||||||
String[] mobDatas = colon.split(mobPart);
|
String[] mobDatas = colon.split(mobPart);
|
||||||
if(mobDatas.length == 1)
|
if (mobDatas.length == 1)
|
||||||
{
|
{
|
||||||
mobData.add(null);
|
mobData.add(null);
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public class SpawnMob
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
mob = EntityType.fromName(parts.get(i));
|
mob = EntityType.fromName(parts.get(i));
|
||||||
spawnedMob = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>)mob.getEntityClass());
|
spawnedMob = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>) mob.getEntityClass());
|
||||||
|
|
||||||
if (data.get(i) != null)
|
if (data.get(i) != null)
|
||||||
{
|
{
|
||||||
@@ -174,9 +174,9 @@ public class SpawnMob
|
|||||||
if (next < parts.size())
|
if (next < parts.size())
|
||||||
{
|
{
|
||||||
EntityType mMob = EntityType.fromName(parts.get(next));
|
EntityType mMob = EntityType.fromName(parts.get(next));
|
||||||
spawnedMount = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>)mMob.getEntityClass());
|
spawnedMount = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>) mMob.getEntityClass());
|
||||||
|
|
||||||
if(data.get(next) != null)
|
if (data.get(next) != null)
|
||||||
{
|
{
|
||||||
changeMobData(mMob, spawnedMount, data.get(next), target);
|
changeMobData(mMob, spawnedMount, data.get(next), target);
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ public class SpawnMob
|
|||||||
throw new Exception(_("invalidMob"));
|
throw new Exception(_("invalidMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Permissions.SPAWNMOB.isAuthorized((User)sender, mob.getName()))
|
if (!Permissions.SPAWNMOB.isAuthorized((User) sender, mob.getName()))
|
||||||
{
|
{
|
||||||
throw new Exception(_("noPermToSpawnMob"));
|
throw new Exception(_("noPermToSpawnMob"));
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ public class SpawnMob
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
((Slime)spawned).setSize(Integer.parseInt(data));
|
((Slime) spawned).setSize(Integer.parseInt(data));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ public class SpawnMob
|
|||||||
}
|
}
|
||||||
if (spawned instanceof Ageable && data.contains("baby"))
|
if (spawned instanceof Ageable && data.contains("baby"))
|
||||||
{
|
{
|
||||||
((Ageable)spawned).setBaby();
|
((Ageable) spawned).setBaby();
|
||||||
data = data.replace("baby", "");
|
data = data.replace("baby", "");
|
||||||
}
|
}
|
||||||
if (spawned instanceof Colorable)
|
if (spawned instanceof Colorable)
|
||||||
@@ -229,11 +229,11 @@ public class SpawnMob
|
|||||||
if (color.equals("RANDOM"))
|
if (color.equals("RANDOM"))
|
||||||
{
|
{
|
||||||
final Random rand = new Random();
|
final Random rand = new Random();
|
||||||
((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
|
((Colorable) spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((Colorable)spawned).setColor(DyeColor.valueOf(color));
|
((Colorable) spawned).setColor(DyeColor.valueOf(color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -243,32 +243,32 @@ public class SpawnMob
|
|||||||
}
|
}
|
||||||
if (spawned instanceof Tameable && data.contains("tamed") && target != null)
|
if (spawned instanceof Tameable && data.contains("tamed") && target != null)
|
||||||
{
|
{
|
||||||
final Tameable tameable = ((Tameable)spawned);
|
final Tameable tameable = ((Tameable) spawned);
|
||||||
tameable.setTamed(true);
|
tameable.setTamed(true);
|
||||||
tameable.setOwner(target.getPlayer());
|
tameable.setOwner(target.getPlayer());
|
||||||
data = data.replace("tamed", "");
|
data = data.replace("tamed", "");
|
||||||
}
|
}
|
||||||
if (type == EntityType.WOLF && data.contains("angry"))
|
if (type == EntityType.WOLF && data.contains("angry"))
|
||||||
{
|
{
|
||||||
((Wolf)spawned).setAngry(true);
|
((Wolf) spawned).setAngry(true);
|
||||||
}
|
}
|
||||||
if (type == EntityType.CREEPER && data.contains("powered"))
|
if (type == EntityType.CREEPER && data.contains("powered"))
|
||||||
{
|
{
|
||||||
((Creeper)spawned).setPowered(true);
|
((Creeper) spawned).setPowered(true);
|
||||||
}
|
}
|
||||||
if (type == EntityType.OCELOT)
|
if (type == EntityType.OCELOT)
|
||||||
{
|
{
|
||||||
if (data.contains("siamese") || data.contains("white"))
|
if (data.contains("siamese") || data.contains("white"))
|
||||||
{
|
{
|
||||||
((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT);
|
((Ocelot) spawned).setCatType(Ocelot.Type.SIAMESE_CAT);
|
||||||
}
|
}
|
||||||
else if (data.contains("red") || data.contains("orange") || data.contains("tabby"))
|
else if (data.contains("red") || data.contains("orange") || data.contains("tabby"))
|
||||||
{
|
{
|
||||||
((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT);
|
((Ocelot) spawned).setCatType(Ocelot.Type.RED_CAT);
|
||||||
}
|
}
|
||||||
else if (data.contains("black") || data.contains("tuxedo"))
|
else if (data.contains("black") || data.contains("tuxedo"))
|
||||||
{
|
{
|
||||||
((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT);
|
((Ocelot) spawned).setCatType(Ocelot.Type.BLACK_CAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == EntityType.VILLAGER)
|
if (type == EntityType.VILLAGER)
|
||||||
@@ -277,7 +277,7 @@ public class SpawnMob
|
|||||||
{
|
{
|
||||||
if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH)))
|
if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
((Villager)spawned).setProfession(prof);
|
((Villager) spawned).setProfession(prof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,23 +285,23 @@ public class SpawnMob
|
|||||||
{
|
{
|
||||||
if (data.contains("villager"))
|
if (data.contains("villager"))
|
||||||
{
|
{
|
||||||
((Zombie)spawned).setVillager(true);
|
((Zombie) spawned).setVillager(true);
|
||||||
}
|
}
|
||||||
if (data.contains("baby"))
|
if (data.contains("baby"))
|
||||||
{
|
{
|
||||||
((Zombie)spawned).setBaby(true);
|
((Zombie) spawned).setBaby(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == EntityType.SKELETON)
|
if (type == EntityType.SKELETON)
|
||||||
{
|
{
|
||||||
if (data.contains("wither"))
|
if (data.contains("wither"))
|
||||||
{
|
{
|
||||||
((Skeleton)spawned).setSkeletonType(Skeleton.SkeletonType.WITHER);
|
((Skeleton) spawned).setSkeletonType(Skeleton.SkeletonType.WITHER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == EntityType.EXPERIENCE_ORB)
|
if (type == EntityType.EXPERIENCE_ORB)
|
||||||
{
|
{
|
||||||
((ExperienceOrb)spawned).setExperience(Integer.parseInt(data));
|
((ExperienceOrb) spawned).setExperience(Integer.parseInt(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user