summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhyperia <khyperia@live.com>2011-12-07 09:10:24 +0800
committersnowleo <schneeleo@gmail.com>2011-12-07 09:36:11 +0800
commitd7f200dfbc6a17f58fe1125a44d60c81d40fa9c9 (patch)
tree3d3a5ea456d231c2716977bdbcb8b829c68d7a49
parent64db184e7d5cb018465a45435045241463b9c48c (diff)
downloadEssentials-d7f200dfbc6a17f58fe1125a44d60c81d40fa9c9.tar
Essentials-d7f200dfbc6a17f58fe1125a44d60c81d40fa9c9.tar.gz
Essentials-d7f200dfbc6a17f58fe1125a44d60c81d40fa9c9.tar.lz
Essentials-d7f200dfbc6a17f58fe1125a44d60c81d40fa9c9.tar.xz
Essentials-d7f200dfbc6a17f58fe1125a44d60c81d40fa9c9.zip
Added new player argument: /spawnmob <mob> [amount] [player]
Test: #821
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java16
-rw-r--r--Essentials/src/plugin.yml2
2 files changed, 12 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index 60b99b217..f867a1503 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -76,7 +76,12 @@ public class Commandspawnmob extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
- final Location loc = block.getLocation();
+ User otherUser = null;
+ if (args.length >= 3)
+ {
+ otherUser = getPlayer(ess.getServer(), args, 2);
+ }
+ final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
final Location sloc = Util.getSafeDestination(loc);
try
{
@@ -122,7 +127,7 @@ public class Commandspawnmob extends EssentialsCommand
{
changeMobData(mobMount.getType(), spawnedMount, mountData, user);
}
- if (args.length == 2)
+ if (args.length >= 2)
{
int mobCount = Integer.parseInt(args[1]);
int serverLimit = ess.getSettings().getSpawnMobLimit();
@@ -205,13 +210,14 @@ public class Commandspawnmob extends EssentialsCommand
}
if (type == CreatureType.SHEEP)
{
- if (data.toLowerCase(Locale.ENGLISH).contains("baby")) {
+ if (data.toLowerCase(Locale.ENGLISH).contains("baby"))
+ {
((Sheep)spawned).setAge(-24000);
}
final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", "");
try
- {
-
+ {
+
if (color.equalsIgnoreCase("random"))
{
Random rand = new Random();
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index ac1ced96e..64e5fb2cb 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -304,7 +304,7 @@ commands:
aliases: [espawner]
spawnmob:
description: Spawns a mob.
- usage: /<command> <mob>[:data][,<mount>[:data]] [amount]
+ usage: /<command> <mob>[:data][,<mount>[:data]] [amount] [player]
aliases: [espawnmob]
sudo:
description: Make another user perform a command.