Skip to content

Commit

Permalink
Remove /invis smite, add /invis clear. Resolves #959 (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
LegendIsAwesomes authored and JeromSar committed Jan 8, 2017
1 parent 93c86b7 commit 9b2aba7
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
import org.bukkit.potion.PotionEffectType;

@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/<command> (smite)")
@CommandParameters(description = "Shows (and optionally clears) invisisible players", usage = "/<command> [clear]")
public class Command_invis extends FreedomCommand
{

@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean smite = false;
boolean clear = false;
if (args.length >= 1)
{
if (args[0].equalsIgnoreCase("smite"))
if (args[0].equalsIgnoreCase("clear"))
{
FUtil.adminAction(sender.getName(), "Smiting all invisible players", true);
smite = true;
FUtil.adminAction(sender.getName(), "Clearing invisibility for all players", false);
clear = true;
}
else
{
Expand All @@ -33,17 +33,17 @@ public boolean run(CommandSender sender, Player playerSender, Command cmd, Strin
}

List<String> players = new ArrayList<>();
int smites = 0;
int clears = 0;

for (Player player : server.getOnlinePlayers())
{
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{
players.add(player.getName());
if (smite && !plugin.al.isAdmin(player))
if (clear && !plugin.al.isAdmin(player))
{
player.setHealth(0.0);
smites++;
player.removePotionEffect(PotionEffectType.INVISIBILITY);
clears++;
}
}
}
Expand All @@ -54,9 +54,9 @@ public boolean run(CommandSender sender, Player playerSender, Command cmd, Strin
return true;
}

if (smite)
if (clear)
{
msg("Smitten " + smites + " players");
msg("Cleared invisibility effect from " + clears + " players");
}
else
{
Expand Down

0 comments on commit 9b2aba7

Please sign in to comment.