<commit_before>package aperf.modules.entity.limiter;

import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.world.ChunkEvent;

/**
 */
public class SpawnLimiterEventListener {
    @SubscribeEvent
    public void entityJoinWorld(EntityJoinWorldEvent ev) {
        if (!(ev.entity instanceof EntityLivingBase) || ev.entity instanceof EntityPlayer)
            return;

        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setCanceled(true);
        }
    }

    @SubscribeEvent
    public void specialSpawn(LivingSpawnEvent.SpecialSpawn ev) {
        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setResult(Event.Result.DENY);
        }
    }

    @SubscribeEvent
    public void checkSpawn(LivingSpawnEvent.CheckSpawn ev) {
        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setResult(Event.Result.DENY);
        }
    }

    @SubscribeEvent
    public void chunkLoad(ChunkEvent.Load ev) {
    }

    @SubscribeEvent
    public void chunkUnload(ChunkEvent.Unload ev) {
    }
}<commit_msg>Fixed SpawnLimiterEventListener. Set result instead of canceled an event.<commit_after>package aperf.modules.entity.limiter;

import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.world.ChunkEvent;

/**
 */
public class SpawnLimiterEventListener {
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void entityJoinWorld(EntityJoinWorldEvent ev) {
        if (!(ev.entity instanceof EntityLivingBase) || ev.entity instanceof EntityPlayer)
            return;

        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setCanceled(true);
        }
    }

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void specialSpawn(LivingSpawnEvent.SpecialSpawn ev) {
        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setCanceled(true);
        }
    }

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void checkSpawn(LivingSpawnEvent.CheckSpawn ev) {
        if (!SpawnLimits.findLimitAndCheck((EntityLivingBase) ev.entity, ev.world)) {
            ev.setResult(Event.Result.DENY);
        }
    }

    @SubscribeEvent
    public void chunkLoad(ChunkEvent.Load ev) {
    }

    @SubscribeEvent
    public void chunkUnload(ChunkEvent.Unload ev) {
    }
}
{'fraction_non_alphanumeric': 0.10026041666666667, 'fraction_numerical': 0.0, 'mean_word_length': 3.6773211567732114, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6204669', 'n_tokens_mistral': 954, 'n_tokens_neox': 935, 'n_words': 147}