Added option to /fireball command: /fireball small

This commit is contained in:
snowleo 2011-11-20 14:34:03 +01:00
parent 293f2f7cd2
commit 8c478c76a5
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,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.util.Vector;
@ -16,7 +17,12 @@ public class Commandfireball extends EssentialsCommand
@Override
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"))
{
small = true;
}
final Vector direction = user.getEyeLocation().getDirection().multiply(2);
user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), Fireball.class);
user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), small ? SmallFireball.class : Fireball.class);
}
}

View File

@ -88,7 +88,7 @@ commands:
aliases: [extinguish,eext,eextinguish]
fireball:
description: Throw a fireball.
usage: /<command>
usage: /<command> [small]
aliases: [efireball]
gamemode:
description: Change player gamemode.