added /potion clearall

This commit is contained in:
Jerom van der Sar 2013-01-07 16:33:54 +01:00
parent ac0dc43cd7
commit 3399207fd7

View File

@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList;
import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -31,6 +32,21 @@ public class Command_potion extends TFM_Command
}
playerMsg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
}
else if (args[0].equalsIgnoreCase("clearall"))
{
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
{
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
for (Player target : server.getOnlinePlayers())
{
for (PotionEffect potion_effect : target.getActivePotionEffects())
{
target.removePotionEffect(potion_effect.getType());
}
}
}
else if (args[0].equalsIgnoreCase("clear"))
{
Player target = sender_p;