1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-18 20:41:37 +02:00

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

b04fa82be2
2988db08ca
This commit is contained in:
Chris Ward
2013-01-10 03:51:09 +11:00
parent 7381ec79d8
commit 4d4a3142f7
2 changed files with 22 additions and 1 deletions

View File

@@ -29,6 +29,18 @@ public class Commandfireball extends EssentialsCommand
{ {
clazz = Egg.class; clazz = Egg.class;
} }
else if(args[0].equalsIgnoreCase("snowball"))
{
clazz = Snowball.class;
}
else if(args[0].equalsIgnoreCase("expbottle"))
{
clazz = ThrownExpBottle.class;
}
else if(args[0].equalsIgnoreCase("large"))
{
clazz = LargeFireball.class;
}
} }
final Player player = user.getPlayer(); final Player player = user.getPlayer();

View File

@@ -45,9 +45,18 @@ public class Commandspawner extends EssentialsCommand
{ {
throw new Exception(_("unableToSpawnMob")); throw new Exception(_("unableToSpawnMob"));
} }
int delay = 0;
if(args.length > 1 && Util.isInt(args[1]))
{
delay = Integer.parseInt(args[1]);
}
final Trade charge = new Trade("spawner-" + mob.getName().toLowerCase(Locale.ENGLISH), ess); final Trade charge = new Trade("spawner-" + mob.getName().toLowerCase(Locale.ENGLISH), ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob);
CreatureSpawner spawner = ((CreatureSpawner)target.getBlock().getState());
spawner.setSpawnedType(mob);
spawner.setDelay(delay);
charge.charge(user); charge.charge(user);
user.sendMessage(_("setSpawner", mob.getName())); user.sendMessage(_("setSpawner", mob.getName()));
} }