2011-06-23 12:14:24 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
import org.bukkit.Server;
|
|
|
|
import org.bukkit.entity.Fireball;
|
2011-11-20 13:34:03 +00:00
|
|
|
import org.bukkit.entity.SmallFireball;
|
2011-06-23 12:14:24 +00:00
|
|
|
import org.bukkit.util.Vector;
|
|
|
|
|
|
|
|
|
|
|
|
public class Commandfireball extends EssentialsCommand
|
|
|
|
{
|
|
|
|
public Commandfireball()
|
|
|
|
{
|
|
|
|
super("fireball");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
|
|
|
{
|
2011-11-20 13:34:03 +00:00
|
|
|
boolean small = false;
|
|
|
|
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
|
|
|
|
{
|
|
|
|
small = true;
|
|
|
|
}
|
2011-11-18 12:06:59 +00:00
|
|
|
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
|
2011-11-21 02:50:31 +00:00
|
|
|
Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
|
|
|
fireball.setShooter(user.getBase());
|
2011-06-23 12:14:24 +00:00
|
|
|
}
|
|
|
|
}
|