<commit_before>package com.kihira.corruption.common;

import com.kihira.corruption.Corruption;
import com.kihira.corruption.common.corruption.AbstractCorruption;
import com.kihira.corruption.common.corruption.CorruptionRegistry;
import com.kihira.corruption.common.network.PacketEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;

import java.util.Collection;
import java.util.List;

public class FMLEventHandler {

    public static final int CORRUPTION_MAX = 17280;

    @SubscribeEvent
    @SuppressWarnings("unchecked")
    public void onPlayerTick(TickEvent.PlayerTickEvent e) {
        if (e.phase == TickEvent.Phase.END) {
            //Main corruption tick
            //Server
            if (e.side == Side.SERVER) {
                if (Corruption.isCorruptionActiveGlobal && CorruptionDataHelper.canBeCorrupted(e.player)) {
                    if (e.player.worldObj.getTotalWorldTime() % Corruption.corrSpeed == 0) {
                        CorruptionDataHelper.increaseCorruptionForPlayer(e.player, 1);

                        //24 hours
                        if (e.player.worldObj.rand.nextInt(CORRUPTION_MAX) < CorruptionDataHelper.getCorruptionForPlayer(e.player)) {
                            String corrName = CorruptionRegistry.getRandomCorruptionEffect(e.player);
                            if (!CorruptionDataHelper.hasCorruptionEffectsForPlayer(e.player, corrName)) {
                                CorruptionDataHelper.addCorruptionEffectForPlayer(e.player, corrName);
                            }
                        }
                    }
                    List<String> corrEffects = CorruptionDataHelper.getCorruptionEffectsForPlayer(e.player);
                    if (!corrEffects.isEmpty()) {
                        for (String corrEffect : corrEffects) {
                            AbstractCorruption corruption = CorruptionRegistry.corruptionHashMap.get(corrEffect);
                            if (corruption != null) {
                                if (corruption.shouldContinue(e.player, FMLCommonHandler.instance().getEffectiveSide())) {
                                    corruption.onUpdate(e.player, FMLCommonHandler.instance().getEffectiveSide());
                                }
                                else {
                                    corruption.finish(e.player.getCommandSenderName(), FMLCommonHandler.instance().getEffectiveSide());
                                    CorruptionDataHelper.removeCorruptionEffectForPlayer(e.player, corrEffect);
                                }
                            }
                            else {
                                CorruptionDataHelper.removeCorruptionEffectForPlayer(e.player, corrEffect);
                            }
                        }
                    }
                    //AfraidOfTheDark
                    if (e.player.worldObj.getTotalWorldTime() % 200 == 0 && e.player.worldObj.getBlockLightValue((int) e.player.posX, (int) e.player.posY, (int) e.player.posZ) <= 8) {
                        if (CorruptionDataHelper.getCorruptionForPlayer(e.player) > 3000 && e.player.worldObj.rand.nextInt(CORRUPTION_MAX) < CorruptionDataHelper.getCorruptionForPlayer(e.player)) {
                            CorruptionDataHelper.addCorruptionEffectForPlayer(e.player, "afraidOfTheDark");
                        }
                    }<commit_msg>Reduce chance to get random corruption effect if you already have one<commit_after>package com.kihira.corruption.common;

import com.kihira.corruption.Corruption;
import com.kihira.corruption.common.corruption.AbstractCorruption;
import com.kihira.corruption.common.corruption.CorruptionRegistry;
import com.kihira.corruption.common.network.PacketEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;

import java.util.Collection;
import java.util.List;

public class FMLEventHandler {

    public static final int CORRUPTION_MAX = 17280;

    @SubscribeEvent
    @SuppressWarnings("unchecked")
    public void onPlayerTick(TickEvent.PlayerTickEvent e) {
        if (e.phase == TickEvent.Phase.END) {
            //Main corruption tick
            //Server
            if (e.side == Side.SERVER) {
                if (Corruption.isCorruptionActiveGlobal && CorruptionDataHelper.canBeCorrupted(e.player)) {
                    if (e.player.worldObj.getTotalWorldTime() % Corruption.corrSpeed == 0) {
                        CorruptionDataHelper.increaseCorruptionForPlayer(e.player, 1);

                        //24 hours
                        if (e.player.worldObj.rand.nextInt(CORRUPTION_MAX * CorruptionDataHelper.getCorruptionEffectsForPlayer(e.player).size()) < CorruptionDataHelper.getCorruptionForPlayer(e.player)) {
                            String corrName = CorruptionRegistry.getRandomCorruptionEffect(e.player);
                            if (!CorruptionDataHelper.hasCorruptionEffectsForPlayer(e.player, corrName)) {
                                CorruptionDataHelper.addCorruptionEffectForPlayer(e.player, corrName);
                            }
                        }
                    }
                    List<String> corrEffects = CorruptionDataHelper.getCorruptionEffectsForPlayer(e.player);
                    if (!corrEffects.isEmpty()) {
                        for (String corrEffect : corrEffects) {
                            AbstractCorruption corruption = CorruptionRegistry.corruptionHashMap.get(corrEffect);
                            if (corruption != null) {
                                if (corruption.shouldContinue(e.player, FMLCommonHandler.instance().getEffectiveSide())) {
                                    corruption.onUpdate(e.player, FMLCommonHandler.instance().getEffectiveSide());
                                }
                                else {
                                    corruption.finish(e.player.getCommandSenderName(), FMLCommonHandler.instance().getEffectiveSide());
                                    CorruptionDataHelper.removeCorruptionEffectForPlayer(e.player, corrEffect);
                                }
                            }
                            else {
                                CorruptionDataHelper.removeCorruptionEffectForPlayer(e.player, corrEffect);
                            }
                        }
                    }
                    //AfraidOfTheDark
                    if (e.player.worldObj.getTotalWorldTime() % 200 == 0 && e.player.worldObj.getBlockLightValue((int) e.player.posX, (int) e.player.posY, (int) e.player.posZ) <= 8) {
                        if (CorruptionDataHelper.getCorruptionForPlayer(e.player) > 3000 && e.player.worldObj.rand.nextInt(CORRUPTION_MAX) < CorruptionDataHelper.getCorruptionForPlayer(e.player)) {
                            CorruptionDataHelper.addCorruptionEffectForPlayer(e.player, "afraidOfTheDark");
                        }
                    }
{'fraction_non_alphanumeric': 0.08894806924101198, 'fraction_numerical': 0.004793608521970706, 'mean_word_length': 1.8988807410266306, 'pattern_counts': {'":': 0, '<': 11, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3227093', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1897, 'n_words': 256}