From b04fa82be251608f829ff55e46d917b39a3fe7f3 Mon Sep 17 00:00:00 2001 From: GunfighterJ Date: Wed, 9 Jan 2013 10:12:04 -0600 Subject: [PATCH] Add more items to Fireball command. Add delay option to /spawner --- .../essentials/commands/Commandfireball.java | 12 ++++++++++++ .../earth2me/essentials/commands/Commandspawner.java | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java index 1b7905ac3..f1aae3ca7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java @@ -38,6 +38,18 @@ public class Commandfireball extends EssentialsCommand { type = Egg.class; } + else if(args[0].equalsIgnoreCase("snowball")) + { + type = Snowball.class; + } + else if(args[0].equalsIgnoreCase("expbottle")) + { + type = ThrownExpBottle.class; + } + else if(args[0].equalsIgnoreCase("large")) + { + type = LargeFireball.class; + } } final Vector direction = user.getEyeLocation().getDirection().multiply(speed); projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index 351b6a8b4..035adabae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -6,6 +6,7 @@ import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.Locale; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; @@ -34,6 +35,7 @@ public class Commandspawner extends EssentialsCommand } String name = args[0]; + Integer delay = 0; Mob mob = null; mob = Mob.fromName(name); @@ -49,11 +51,19 @@ 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) {