mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Baby wolfs, awwwwh
This commit is contained in:
parent
613cb57fdb
commit
03452bda68
1 changed files with 14 additions and 13 deletions
|
@ -20,7 +20,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
{
|
{
|
||||||
super("spawnmob");
|
super("spawnmob");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -29,8 +29,8 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
//TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf");
|
//TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String[] mountparts = args[0].split(",");
|
String[] mountparts = args[0].split(",");
|
||||||
String[] parts = mountparts[0].split(":");
|
String[] parts = mountparts[0].split(":");
|
||||||
String mobType = parts[0];
|
String mobType = parts[0];
|
||||||
|
@ -50,24 +50,24 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
mountData = parts[1];
|
mountData = parts[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity spawnedMob = null;
|
Entity spawnedMob = null;
|
||||||
Mob mob = null;
|
Mob mob = null;
|
||||||
Entity spawnedMount = null;
|
Entity spawnedMount = null;
|
||||||
Mob mobMount = null;
|
Mob mobMount = null;
|
||||||
|
|
||||||
mob = Mob.fromName(mobType);
|
mob = Mob.fromName(mobType);
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("invalidMob"));
|
throw new Exception(_("invalidMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
|
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
throw new Exception(_("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block block = Util.getTarget(user).getBlock();
|
final Block block = Util.getTarget(user).getBlock();
|
||||||
if (block == null)
|
if (block == null)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new Exception(_("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mountType != null)
|
if (mountType != null)
|
||||||
{
|
{
|
||||||
mobMount = Mob.fromName(mountType);
|
mobMount = Mob.fromName(mountType);
|
||||||
|
@ -92,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
user.sendMessage(_("invalidMob"));
|
user.sendMessage(_("invalidMob"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH)))
|
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
throw new Exception(_("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
|
@ -124,7 +124,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
mobCount = serverLimit;
|
mobCount = serverLimit;
|
||||||
user.sendMessage(_("mobSpawnLimit"));
|
user.sendMessage(_("mobSpawnLimit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int i = 1; i < mobCount; i++)
|
for (int i = 1; i < mobCount; i++)
|
||||||
|
@ -171,7 +171,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
user.sendMessage(mob.name + " " + _("spawned"));
|
user.sendMessage(mob.name + " " + _("spawned"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
|
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
|
||||||
{
|
{
|
||||||
if ("Slime".equalsIgnoreCase(type))
|
if ("Slime".equalsIgnoreCase(type))
|
||||||
|
@ -188,7 +188,8 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
if (("Sheep".equalsIgnoreCase(type)
|
if (("Sheep".equalsIgnoreCase(type)
|
||||||
|| "Cow".equalsIgnoreCase(type)
|
|| "Cow".equalsIgnoreCase(type)
|
||||||
|| "Chicken".equalsIgnoreCase(type)
|
|| "Chicken".equalsIgnoreCase(type)
|
||||||
|| "Pig".equalsIgnoreCase(type))
|
|| "Pig".equalsIgnoreCase(type)
|
||||||
|
|| "Wolf".equalsIgnoreCase(type))
|
||||||
&& data.equalsIgnoreCase("baby"))
|
&& data.equalsIgnoreCase("baby"))
|
||||||
{
|
{
|
||||||
((Animals)spawned).setAge(-24000);
|
((Animals)spawned).setAge(-24000);
|
||||||
|
|
Loading…
Reference in a new issue