diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandspawner.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandspawner.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index 351b6a8b4..a01f42f01 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -34,6 +34,7 @@ public class Commandspawner extends EssentialsCommand } String name = args[0]; + int delay = 0; Mob mob = null; mob = Mob.fromName(name); @@ -49,11 +50,20 @@ public class Commandspawner extends EssentialsCommand { throw new Exception(_("noPermToSpawnMob")); } + if (args.length > 1) + { + if (Util.isInt(args[1])) + { + delay = Integer.parseInt(args[1]); + } + } final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess); charge.isAffordableFor(user); try { - ((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob.getType()); + CreatureSpawner spawner = (CreatureSpawner)target.getBlock().getState(); + spawner.setSpawnedType(mob.getType()); + spawner.setDelay(delay); } catch (Throwable ex) { |