summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandfireball.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java
index 671d0f72b..1b7905ac3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java
@@ -2,8 +2,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Server;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.SmallFireball;
+import org.bukkit.entity.*;
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
{
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);
- Fireball fireball = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
- fireball.setShooter(user.getBase());
+ final Vector direction = user.getEyeLocation().getDirection().multiply(speed);
+ projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type);
+ projectile.setShooter(user.getBase());
+ projectile.setVelocity(direction);
}
}