<commit_before>package com.github.niwaniwa.we.core.listener;

import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;

import com.github.niwaniwa.we.core.WhiteEggCore;
import com.github.niwaniwa.we.core.player.AltAccount;
import com.github.niwaniwa.we.core.player.WhiteEggPlayer;
import com.github.niwaniwa.we.core.player.WhitePlayer;
import com.github.niwaniwa.we.core.player.rank.Rank;
import com.github.niwaniwa.we.core.player.rank.RankProperty;

/**
 * 初期処理
 * @author niwaniwa
 *
 */
public class PlayerListener implements Listener {

	@EventHandler(priority = EventPriority.LOWEST)
	public void onJoin(PlayerJoinEvent event) {
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		for (RankProperty p : RankProperty.values()) {
			for (Rank r : Rank.getRanks()) {
				if (r.getProperty().equals(p)) {
					if (player.hasPermission(r.getPermission())) {
						player.addRank(r);
					}
				}
			}
		}
		AltAccount.determine(player);
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void onQuit(PlayerQuitEvent event){
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		((WhiteEggPlayer) player).saveTask();
	}

	public void onKick(PlayerKickEvent event){
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		((WhiteEggPlayer) player).saveTask();
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void onSign(SignChangeEvent event) {
		for (int i = 0; i <= 3; i++) {
			event.setLine(i, ChatColor.translateAlternateColorCodes('&', event.getLine(i)));
		}
	}
<commit_msg>Changed to Lambda Expressions<commit_after>package com.github.niwaniwa.we.core.listener;

import java.util.Arrays;

import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;

import com.github.niwaniwa.we.core.WhiteEggCore;
import com.github.niwaniwa.we.core.player.AltAccount;
import com.github.niwaniwa.we.core.player.WhiteEggPlayer;
import com.github.niwaniwa.we.core.player.WhitePlayer;
import com.github.niwaniwa.we.core.player.rank.Rank;
import com.github.niwaniwa.we.core.player.rank.RankProperty;

/**
 * 初期処理
 * @author niwaniwa
 *
 */
public class PlayerListener implements Listener {

	@EventHandler(priority = EventPriority.LOWEST)
	public void onJoin(PlayerJoinEvent event) {
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		Arrays.asList(RankProperty.values()).forEach(property -> {
			 Rank.getRanks().stream().filter(r -> r.getProperty().equals(property))
			 					.forEach(rank -> { if (player.hasPermission(rank.getPermission())) { player.addRank(rank); }});
		});
		AltAccount.determine(player);
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void onQuit(PlayerQuitEvent event){
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		((WhiteEggPlayer) player).saveTask();
	}

	public void onKick(PlayerKickEvent event){
		WhitePlayer player = WhiteEggCore.getAPI().getPlayer(event.getPlayer());
		((WhiteEggPlayer) player).saveTask();
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void onSign(SignChangeEvent event) {
		for (int i = 0; i <= 3; i++) {
			event.setLine(i, ChatColor.translateAlternateColorCodes('&', event.getLine(i)));
		}
	}

{'fraction_non_alphanumeric': 0.13585508790623335, 'fraction_numerical': 0.0010655301012253596, 'mean_word_length': 5.342905405405405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '6203906', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1264, 'n_words': 193}