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