From aaee159fc9958d8aab409bd0eb89b2486807b39d Mon Sep 17 00:00:00 2001 From: ementalo Date: Tue, 26 Apr 2011 12:39:57 +0000 Subject: [PATCH] [trunk] weather / thunder refactor, added /lightning. usage: /lightning [player] it will zap them and kill them. You can also zap yourself. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1278 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../essentials/commands/Commandlightning.java | 45 +++++++++++++++++++ .../essentials/commands/Commandthunder.java | 6 --- .../essentials/commands/Commandweather.java | 8 +--- Essentials/src/plugin.yml | 3 ++ 4 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 Essentials/src/com/earth2me/essentials/commands/Commandlightning.java diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java new file mode 100644 index 000000000..a2379c752 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -0,0 +1,45 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.User; +import java.util.List; + +import org.bukkit.Server; +import org.bukkit.World; +import org.bukkit.entity.Player; + + +public class Commandlightning extends EssentialsCommand +{ + public Commandlightning() + { + super("lightning"); + } + + @Override + public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception + { + + if (args.length < 1) + { + user.sendMessage("§cUsage: /" + commandLabel + " [player]"); + return; + } + + World world = user.getWorld(); + if(server.matchPlayer(args[0]).isEmpty()) + { + user.sendMessage("§cPlayer not found"); + return; + } + + for (Player p : server.matchPlayer(args[0])) + { + user.sendMessage("§7Smiting" + p.getDisplayName()); + world.strikeLightning(p.getLocation()); + p.setHealth(0); + p.sendMessage("§7You have just been smited"); + } + user.charge(this); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java index ca7a15a0b..a95475ef3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java @@ -24,12 +24,6 @@ public class Commandthunder extends EssentialsCommand return; } - if (!user.isAuthorized(this)) - { - user.sendMessage("§cThe power of the Thor has been denied to you"); - return; - } - user.charge(this); World world = user.getWorld(); boolean setThunder = args[0].equalsIgnoreCase("true"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java index 2d7e9c076..d76807a3f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java @@ -23,13 +23,7 @@ public class Commandweather extends EssentialsCommand return; } - if (!user.isAuthorized(this)) - { - user.sendMessage("§cThe power of the sky has been denied to you"); - return; - } - - boolean isStorm = args[0].equalsIgnoreCase("storm"); + boolean isStorm = args[0].equalsIgnoreCase("storm"); World world = user.getWorld(); user.charge(this); if (!args[1].isEmpty() || args[1] != null) diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index bbd843c90..654dba375 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -144,6 +144,9 @@ commands: description: List all online players. usage: / aliases: [playerlist,who,online,elist] + lightning: + description: Smite down players with the power of Thor + usage: / [player] mail: description: Manages inter-player, intra-server mail. usage: / [read|clear|send [to] [message]]