mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 04:21:31 +02:00
Add more items to Fireball command. Add /delay option to spawner
b04fa82be2
2988db08ca
This commit is contained in:
@@ -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();
|
||||||
|
@@ -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()));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user