diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-01-09 00:58:29 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-01-09 00:58:29 +0000 |
commit | c210e8730b5140b737d1279e0e9f9481d8a79aa5 (patch) | |
tree | 5bafa0d8b452aabf4cced2a5d154fe2d9873772b | |
parent | 6c48e02c14518cc323a44d557504cc5e60f5ef3d (diff) | |
download | Essentials-c210e8730b5140b737d1279e0e9f9481d8a79aa5.tar Essentials-c210e8730b5140b737d1279e0e9f9481d8a79aa5.tar.gz Essentials-c210e8730b5140b737d1279e0e9f9481d8a79aa5.tar.lz Essentials-c210e8730b5140b737d1279e0e9f9481d8a79aa5.tar.xz Essentials-c210e8730b5140b737d1279e0e9f9481d8a79aa5.zip |
Fire a few extra entities from /fireball
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandfireball.java | 32 |
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); } } |