package de.steamwar.bausystem.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import de.steamwar.bausystem.BauSystem;
public class CommandGills implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player))
return false;
Player player = (Player) sender;
for(PotionEffect effect : player.getActivePotionEffects()){
if(effect.getType().equals(PotionEffectType.WATER_BREATHING)){
player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert");
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
}
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false));
player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert");