<commit_before>package hdr.glow.commands;

import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.effect.potion.PotionEffect;
import org.spongepowered.api.effect.potion.PotionEffectTypes;
import org.spongepowered.api.data.manipulator.mutable.PotionEffectData;
import org.spongepowered.api.text.chat.ChatTypes;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.format.TextStyles;

import static hdr.glow.playerGlow.glowPot;
import java.util.List;

public class glowToggle implements CommandExecutor {
    @Override
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
        if (src instanceof Player) {
            Player player = (Player) src;
            if (player.get(Keys.POTION_EFFECTS).isPresent()) {
                List<PotionEffect> potionEffects = player.get(Keys.POTION_EFFECTS).get();
                for (PotionEffect pot : potionEffects) {
                    if (pot.getType().equals(PotionEffectTypes.GLOWING)) {
                        List<PotionEffect> effects = player.get(Keys.POTION_EFFECTS).get();
                        effects.clear();
                        player.offer(Keys.POTION_EFFECTS, effects);
                        player.sendMessage(ChatTypes.ACTION_BAR, Text.of(TextColors.RED, TextStyles.BOLD, "Glow Disabled"));
                    }

                }
            } else {
                PotionEffectData effects = player.getOrCreate(PotionEffectData.class).get();
                effects.addElement(glowPot);
                player.offer(effects);
                player.sendMessage(ChatTypes.ACTION_BAR, Text.of(TextColors.GREEN, TextStyles.BOLD, "Glow Enabled"));
            }
        }
        return CommandResult.success();
    }
}<commit_msg>Fix toggling glow off removing all potion effects<commit_after>package hdr.glow.commands;

import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.data.manipulator.mutable.PotionEffectData;
import org.spongepowered.api.effect.potion.PotionEffectTypes;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.chat.ChatTypes;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.format.TextStyles;

import static hdr.glow.playerGlow.glowPot;

public class glowToggle implements CommandExecutor {
    @Override
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
        if (src instanceof Player) {
            Player player = (Player) src;
            PotionEffectData effects = player.getOrCreate(PotionEffectData.class).get();
            if (effects.asList().stream().anyMatch(pot -> pot.getType().equals(PotionEffectTypes.GLOWING))) {
                effects.removeAll(pot -> pot.getType().equals(PotionEffectTypes.GLOWING));
                player.offer(effects);
                player.sendMessage(ChatTypes.ACTION_BAR, Text.of(TextColors.RED, TextStyles.BOLD, "Glow Disabled"));
            } else {
                effects.addElement(glowPot);
                player.offer(effects);
                player.sendMessage(ChatTypes.ACTION_BAR, Text.of(TextColors.GREEN, TextStyles.BOLD, "Glow Enabled"));
            }
        }
        return CommandResult.success();
    }
}
{'fraction_non_alphanumeric': 0.10386656557998483, 'fraction_numerical': 0.0, 'mean_word_length': 3.233155080213904, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6533145', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1137, 'n_words': 174}