<commit_before>package org.apollo.game.event.handler.impl;

import org.apollo.game.event.handler.EventHandler;
import org.apollo.game.event.handler.EventHandlerContext;
import org.apollo.game.event.impl.PlayerDesignEvent;
import org.apollo.game.model.Appearance;
import org.apollo.game.model.Player;
import org.apollo.game.model.settings.Gender;

/**
 * An {@link EventHandler} that verifies {@link PlayerDesignEvent}s.
 * 
 * @author Graham
 */
public final class PlayerDesignVerificationHandler extends EventHandler<PlayerDesignEvent> {

	@Override
	public void handle(EventHandlerContext ctx, Player player, PlayerDesignEvent event) {
		if (!valid(event.getAppearance()) || player.isNewPlayer()) {
			ctx.breakHandlerChain();
		}
	}

	/**
	 * Checks if an appearance combination is valid.
	 * 
	 * @param appearance The appearance combination.
	 * @return {@code true} if so, {@code false} if not.
	 */
	private boolean valid(Appearance appearance) {
		int[] colors = appearance.getColors();
		int[] maxColors = new int[] { 11, 15, 15, 5, 7 };
		for (int i = 0; i < colors.length; i++) {
			if (colors[i] < 0 || colors[i] > maxColors[i]) {
				return false;
			}<commit_msg>Remove unnecessary check in design verification handler.<commit_after>package org.apollo.game.event.handler.impl;

import org.apollo.game.event.handler.EventHandler;
import org.apollo.game.event.handler.EventHandlerContext;
import org.apollo.game.event.impl.PlayerDesignEvent;
import org.apollo.game.model.Appearance;
import org.apollo.game.model.Player;
import org.apollo.game.model.settings.Gender;

/**
 * An {@link EventHandler} that verifies {@link PlayerDesignEvent}s.
 * 
 * @author Graham
 */
public final class PlayerDesignVerificationHandler extends EventHandler<PlayerDesignEvent> {

	@Override
	public void handle(EventHandlerContext ctx, Player player, PlayerDesignEvent event) {
		if (!valid(event.getAppearance())) {
			ctx.breakHandlerChain();
		}
	}

	/**
	 * Checks if an appearance combination is valid.
	 * 
	 * @param appearance The appearance combination.
	 * @return {@code true} if so, {@code false} if not.
	 */
	private boolean valid(Appearance appearance) {
		int[] colors = appearance.getColors();
		int[] maxColors = new int[] { 11, 15, 15, 5, 7 };
		for (int i = 0; i < colors.length; i++) {
			if (colors[i] < 0 || colors[i] > maxColors[i]) {
				return false;
			}
{'fraction_non_alphanumeric': 0.12979351032448377, 'fraction_numerical': 0.008428150021070375, 'mean_word_length': 4.432494279176201, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5938573', 'n_tokens_mistral': 772, 'n_tokens_neox': 720, 'n_words': 191}