summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandext.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandext.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandext.java37
1 files changed, 13 insertions, 24 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java
index 47efe518f..5f174298a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java
@@ -2,13 +2,12 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-public class Commandext extends EssentialsCommand
+public class Commandext extends EssentialsLoopCommand
{
public Commandext()
{
@@ -23,7 +22,7 @@ public class Commandext extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
- extinguishPlayers(server, sender, args[0]);
+ loopOnlinePlayers(server, sender, true, args[0], null);
}
@Override
@@ -31,7 +30,7 @@ public class Commandext extends EssentialsCommand
{
if (args.length < 1)
{
- user.setFireTicks(0);
+ extPlayer(user.getBase());
user.sendMessage(_("extinguish"));
return;
}
@@ -41,28 +40,18 @@ public class Commandext extends EssentialsCommand
throw new PlayerNotFoundException();
}
- extinguishPlayers(server, user.getBase(), args[0]);
+ loopOnlinePlayers(server, user.getBase(), true, args[0], null);
}
- private void extinguishPlayers(final Server server, final CommandSender sender, final String name) throws Exception
+ @Override
+ protected void updatePlayer(final Server server, final CommandSender sender, final User player, final String[] args)
{
- boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
- boolean foundUser = false;
- final List<Player> matchedPlayers = server.matchPlayer(name);
- for (Player matchPlayer : matchedPlayers)
- {
- final User player = ess.getUser(matchPlayer);
- if (skipHidden && player.isHidden())
- {
- continue;
- }
- foundUser = true;
- matchPlayer.setFireTicks(0);
- sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName()));
- }
- if (!foundUser)
- {
- throw new PlayerNotFoundException();
- }
+ extPlayer(player.getBase());
+ sender.sendMessage(_("extinguishOthers", player.getDisplayName()));
+ }
+
+ private void extPlayer(final Player player)
+ {
+ player.setFireTicks(0);
}
}