mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 20:41:23 +01:00
Fire a few extra entities from /fireball
This commit is contained in:
parent
6c48e02c14
commit
c210e8730b
@ -2,8 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.SmallFireball;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
@ -18,12 +17,31 @@ public class Commandfireball extends EssentialsCommand
|
|||||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
boolean small = false;
|
boolean small = false;
|
||||||
if (args.length > 0 && args[0].equalsIgnoreCase("small"))
|
Class<? extends Entity> type = Fireball.class;
|
||||||
|
Projectile projectile;
|
||||||
|
int speed = 2;
|
||||||
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
small = true;
|
if (args[0].equalsIgnoreCase("small"))
|
||||||
|
{
|
||||||
|
type = SmallFireball.class;
|
||||||
|
}
|
||||||
|
else if (args[0].equalsIgnoreCase("arrow"))
|
||||||
|
{
|
||||||
|
type = Arrow.class;
|
||||||
|
}
|
||||||
|
else if (args[0].equalsIgnoreCase("skull"))
|
||||||
|
{
|
||||||
|
type = WitherSkull.class;
|
||||||
|
}
|
||||||
|
else if (args[0].equalsIgnoreCase("egg"))
|
||||||
|
{
|
||||||
|
type = Egg.class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
|
final Vector direction = user.getEyeLocation().getDirection().multiply(speed);
|
||||||
Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
|
projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
|
||||||
fireball.setShooter(user.getBase());
|
projectile.setShooter(user.getBase());
|
||||||
|
projectile.setVelocity(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user