diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandext.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandext.java | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 1313ba5b9..34b60cd46 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -1,29 +1,50 @@ package com.earth2me.essentials.commands; import org.bukkit.Server; -import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public class Commandext extends EssentialsCommand { - public Commandext() { +public class Commandext extends EssentialsCommand +{ + public Commandext() + { super("ext"); } @Override - public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception { - if (args.length < 1) { - User.charge(user, this); + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + extinguishPlayers(server, sender, args[0]); + } + + @Override + public void run(Server server, User user, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + charge(user); user.setFireTicks(0); user.sendMessage("§7You extinguished yourself."); return; } - for (Player p : server.matchPlayer(args[0])) { - User.charge(user, this); + extinguishPlayers(server, user, commandLabel); + } + + private void extinguishPlayers(Server server, CommandSender sender, String name) throws Exception + { + for (Player p : server.matchPlayer(name)) + { + charge(sender); p.setFireTicks(0); - user.sendMessage("§7You extinguished " + p.getDisplayName() + "."); + sender.sendMessage("§7You extinguished " + p.getDisplayName() + "."); } } } |