mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 04:21:31 +02:00
@@ -1,8 +1,6 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.SmallFireball;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.util.Vector;
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
@@ -12,17 +10,32 @@ public class Commandfireball extends EssentialsCommand
|
||||
@Override
|
||||
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
boolean small = false;
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
|
||||
Class<? extends Entity> clazz = Fireball.class;
|
||||
if (args.length > 0)
|
||||
{
|
||||
small = true;
|
||||
if(args[0].equalsIgnoreCase("small"))
|
||||
{
|
||||
clazz = SmallFireball.class;
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("arrow"))
|
||||
{
|
||||
clazz = Arrow.class;
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("skull"))
|
||||
{
|
||||
clazz = WitherSkull.class;
|
||||
}
|
||||
else if(args[0].equalsIgnoreCase("egg"))
|
||||
{
|
||||
clazz = Egg.class;
|
||||
}
|
||||
}
|
||||
|
||||
final Player player = user.getPlayer();
|
||||
|
||||
final Vector direction = player.getEyeLocation().getDirection().multiply(2);
|
||||
final Fireball fireball = player.getWorld().spawn(
|
||||
player.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
||||
fireball.setShooter(player);
|
||||
Projectile projectile = (Projectile)user.getPlayer().getWorld().spawn(user.getPlayer().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), clazz);
|
||||
projectile.setShooter(user.getPlayer());
|
||||
projectile.setVelocity(direction);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user