[trunk] lightning strikes where you look if you do not pass an arg. fixed health taking

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1282 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
ementalo 2011-04-27 00:16:23 +00:00
parent edc0904789
commit 29869fa264
2 changed files with 8 additions and 8 deletions

View file

@ -1,9 +1,8 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.TargetBlock;
import com.earth2me.essentials.User;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -20,13 +19,14 @@ public class Commandlightning extends EssentialsCommand
public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
{
World world = user.getWorld();
if (args.length < 1)
{
user.sendMessage("§cUsage: /" + commandLabel + " [player]");
world.strikeLightning(user.getTargetBlock(null, 600).getLocation());
user.sendMessage("§7CRACK");
return;
}
World world = user.getWorld();
if(server.matchPlayer(args[0]).isEmpty())
{
user.sendMessage("§cPlayer not found");
@ -35,9 +35,9 @@ public class Commandlightning extends EssentialsCommand
for (Player p : server.matchPlayer(args[0]))
{
user.sendMessage("§7Smiting" + p.getDisplayName());
user.sendMessage("§7Smiting " + p.getDisplayName());
world.strikeLightning(p.getLocation());
p.setHealth(p.getHealth() - 5);
p.setHealth(p.getHealth() < 5 ? 0 : p.getHealth() -5);
p.sendMessage("§7You have just been smited");
}
user.charge(this);

View file

@ -145,8 +145,8 @@ commands:
usage: /<command>
aliases: [playerlist,who,online,elist]
lightning:
description: Smite down players with the power of Thor, will take 5 hearts
usage: /<command> [player]
description: Command the power of Thor. Look and strike or pass a player args.
usage: /<command> <player>
mail:
description: Manages inter-player, intra-server mail.
usage: /<command> [read|clear|send [to] [message]]