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

View file

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