mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
parent
475b299e37
commit
0eb0c7a02f
@ -11,20 +11,20 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
@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
|
public class Command_invis extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
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.length >= 1)
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("smite"))
|
if (args[0].equalsIgnoreCase("clear"))
|
||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Smiting all invisible players", true);
|
FUtil.adminAction(sender.getName(), "Clearing invisibility for all players", false);
|
||||||
smite = true;
|
clear = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -33,17 +33,17 @@ public class Command_invis extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> players = new ArrayList<>();
|
List<String> players = new ArrayList<>();
|
||||||
int smites = 0;
|
int clears = 0;
|
||||||
|
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
|
||||||
{
|
{
|
||||||
players.add(player.getName());
|
players.add(player.getName());
|
||||||
if (smite && !plugin.al.isAdmin(player))
|
if (clear && !plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
player.setHealth(0.0);
|
player.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||||
smites++;
|
clears++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,9 +54,9 @@ public class Command_invis extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smite)
|
if (clear)
|
||||||
{
|
{
|
||||||
msg("Smitten " + smites + " players");
|
msg("Cleared invisibility effect from " + clears + " players");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user