Add more items to Fireball command. Add delay option to /spawner

This commit is contained in:
GunfighterJ 2013-01-09 10:12:04 -06:00 committed by Chris Ward
parent 5d210d81dc
commit b04fa82be2
2 changed files with 23 additions and 1 deletions

View file

@ -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);

View file

@ -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)
{