    @Override
    @PacketOptions(forcePlayer = true)
    public void onSend(final SentPacket packet) {
        if (packet.hasPlayer()) {
            if ("PacketPlayOutPlayerInfo".equals(packet.getPacketName())) {
                try {
                    Object profileHandle = packet.getPacketValue("b");
                    List list = (List) profileHandle;
                    for (ListIterator<Object> iterator = list.listIterator(); iterator.hasNext(); ) {
                        Object originalData = iterator.next();
                        if (originalData == null) continue;

                        FieldAccessor latencyField = PlayerInfoDataFieldResolver.resolveIndexAccessor(0);
                        FieldAccessor gameModeField = PlayerInfoDataFieldResolver.resolveIndexAccessor(1);
                        FieldAccessor profileField = PlayerInfoDataFieldResolver.resolveIndexAccessor(2);
                        FieldAccessor nameField = PlayerInfoDataFieldResolver.resolveIndexAccessor(3);

                        GameProfile originalProfile = profileField.get(originalData);
                        GameProfile disguisedProfile = disguiseProfile(packet.getPlayer(), originalProfile);
                        if (disguisedProfile != null) {
                            Object newData = ClassBuilder.buildPlayerInfoData(disguisedProfile, (int) latencyField.get(originalData), gameModeField.get(originalData), nameField.get(originalData));
                            iterator.set(newData);
                        }
                    }
                } catch (Exception e) {
                    getPlugin().getLogger().log(Level.SEVERE, "Failed to disguise profile", e);
                }
            }

            //// Name replacement
            if (!NickNamerAPI.getNickManager().isSimple()) {
                if ("PacketPlayOutChat".equalsIgnoreCase(packet.getPacketName())) {
                    if (ChatOutReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        handlePacketPlayOutChat(packet, false);
                    }
                    if (ChatOutReverseReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        handlePacketPlayOutChat(packet, true);
                    }
                }
                if ("PacketPlayOutScoreboardObjective".equals(packet.getPacketName())) {
                    if (ScoreboardReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final String displayName = serializeChat(packet.getPacketValue("e"));
                        final String replacedDisplayName = NickNamerAPI.replaceNames(displayName, NickNamerAPI.getNickedPlayerNames(), original -> {
                            Player player = Bukkit.getPlayer(original);
                            if (player != null) {
                                boolean async = !getPlugin().getServer().isPrimaryThread();
                                ScoreboardReplacementEvent replacementEvent = new ScoreboardReplacementEvent(player, packet.getPlayer(), displayName, original, original, async);
                                Bukkit.getPluginManager().callEvent(replacementEvent);
                                if (replacementEvent.isCancelled()) { return original; }
                                return replacementEvent.getReplacement();
                            }
                            return original;
                        }, true);
                        if (replacedDisplayName != null) {
                            // the packet only needs name, displayName, renderType of the objective
                            Object newObjective = ClassBuilder.buildScoreboardObjective(null, (String) packet.getPacketValue("d"), null, deserializeChat(replacedDisplayName), packet.getPacketValue("f"));
                            Object newPacket = ClassBuilder.buildPacketPlayOutScoreboard(newObjective, (int) packet.getPacketValue("g"));
                            packet.setPacket(newPacket);
                        }
                    }
                }
                if ("PacketPlayOutScoreboardScore".equals(packet.getPacketName())) {
                    if (ScoreboardScoreReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final String playerName = (String) packet.getPacketValue("a");
                        final String replacedPlayerName = NickNamerAPI.replaceNames(playerName, NickNamerAPI.getNickedPlayerNames(), original -> {
                            Player player = Bukkit.getPlayer(original);
                            if (player != null) {
                                boolean async = !getPlugin().getServer().isPrimaryThread();
                                ScoreboardScoreReplacementEvent replacementEvent = new ScoreboardScoreReplacementEvent(player, packet.getPlayer(), playerName, original, original, async);
                                Bukkit.getPluginManager().callEvent(replacementEvent);
                                if (replacementEvent.isCancelled()) { return original; }
                                return replacementEvent.getReplacement();
                            }
                            return original;
                        }, true);
                        if (replacedPlayerName != null) {
                            Object newPacket = ClassBuilder.buildPacketPlayOutScoreboardScore(packet.getPacketValue("d"), (String) packet.getPacketValue("b"), (String) replacedPlayerName, (int) packet.getPacketValue("c"));
                            packet.setPacket(newPacket);
                        }
                    }
                }
                if ("PacketPlayOutScoreboardTeam".equals(packet.getPacketName())) {
                    if (ScoreboardTeamReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final Collection<String> playerNames = (Collection<String>) packet.getPacketValue("j");
                        final List<String> newPlayerNames = new ArrayList<>();
                        for (String entry : playerNames) {
                            final String replacedEntry = NickNamerAPI.replaceNames(entry, NickNamerAPI.getNickedPlayerNames(), original -> {
                                Player player = Bukkit.getPlayer(original);
                                if (player != null) {
                                    boolean async = !getPlugin().getServer().isPrimaryThread();
                                    ScoreboardTeamReplacementEvent replacementEvent = new ScoreboardTeamReplacementEvent(player, packet.getPlayer(), entry, original, original, async);
                                    Bukkit.getPluginManager().callEvent(replacementEvent);
                                    if (replacementEvent.isCancelled()) { return original; }
                                    return replacementEvent.getReplacement();
                                }
                                return original;
                            }, true);
                            newPlayerNames.add(Objects.requireNonNullElse(replacedEntry, entry));
                        }
                        Object newPacket = ClassBuilder.buildPacketPlayOutScoreboardTeam((String) packet.getPacketValue("i"), (int) packet.getPacketValue("h"), (Optional) packet.getPacketValue("k"), (Collection<String>) newPlayerNames);
                        packet.setPacket(newPacket);
                    }
                }
            }
        }
    }

    @Override
    @PacketOptions(forcePlayer = true)
    public void onSend(final SentPacket packet) {
        if (packet.hasPlayer()) {
            if ("PacketPlayOutPlayerInfo".equals(packet.getPacketName())) {
                try {
                    Object profileHandle = packet.getPacketValue("b");
                    List list = (List) profileHandle;
                    for (ListIterator<Object> iterator = list.listIterator(); iterator.hasNext(); ) {
                        Object originalData = iterator.next();
                        if (originalData == null) continue;

                        FieldAccessor latencyField = PlayerInfoDataFieldResolver.resolveIndexAccessor(0);
                        FieldAccessor gameModeField = PlayerInfoDataFieldResolver.resolveIndexAccessor(1);
                        FieldAccessor profileField = PlayerInfoDataFieldResolver.resolveIndexAccessor(2);
                        FieldAccessor nameField = PlayerInfoDataFieldResolver.resolveIndexAccessor(3);

                        GameProfile originalProfile = profileField.get(originalData);
                        GameProfile disguisedProfile = disguiseProfile(packet.getPlayer(), originalProfile);
                        if (disguisedProfile != null) {
                            Object newData = ClassBuilder.buildPlayerInfoData(disguisedProfile, (int) latencyField.get(originalData), gameModeField.get(originalData), nameField.get(originalData));
                            iterator.set(newData);
                        }
                    }
                } catch (Exception e) {
                    getPlugin().getLogger().log(Level.SEVERE, "Failed to disguise profile", e);
                }
            }

            //// Name replacement
            if (!NickNamerAPI.getNickManager().isSimple()) {
                if ("PacketPlayOutChat".equalsIgnoreCase(packet.getPacketName())) {
                    if (ChatOutReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        handlePacketPlayOutChat(packet, false);
                    }
                    if (ChatOutReverseReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        handlePacketPlayOutChat(packet, true);
                    }
                }
                if ("PacketPlayOutScoreboardObjective".equals(packet.getPacketName())) {
                    if (ScoreboardReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final String displayName = serializeChat(packet.getPacketValue("e"));
                        final String replacedDisplayName = NickNamerAPI.replaceNames(displayName, NickNamerAPI.getNickedPlayerNames(), original -> {
                            Player player = Bukkit.getPlayer(original);
                            if (player != null) {
                                boolean async = !getPlugin().getServer().isPrimaryThread();
                                ScoreboardReplacementEvent replacementEvent = new ScoreboardReplacementEvent(player, packet.getPlayer(), displayName, original, original, async);
                                Bukkit.getPluginManager().callEvent(replacementEvent);
                                if (replacementEvent.isCancelled()) { return original; }
                                return replacementEvent.getReplacement();
                            }
                            return original;
                        }, true);
                        if (replacedDisplayName != null) {
                            // the packet only needs name, displayName, renderType of the objective
                            Object newObjective = ClassBuilder.buildScoreboardObjective(null, (String) packet.getPacketValue("d"), null, deserializeChat(replacedDisplayName), packet.getPacketValue("f"));
                            Object newPacket = ClassBuilder.buildPacketPlayOutScoreboard(newObjective, (int) packet.getPacketValue("g"));
                            packet.setPacket(newPacket);
                        }
                    }
                }
                if ("PacketPlayOutScoreboardScore".equals(packet.getPacketName())) {
                    if (ScoreboardScoreReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final String playerName = (String) packet.getPacketValue("a");
                        final String replacedPlayerName = NickNamerAPI.replaceNames(playerName, NickNamerAPI.getNickedPlayerNames(), original -> {
                            Player player = Bukkit.getPlayer(original);
                            if (player != null) {
                                boolean async = !getPlugin().getServer().isPrimaryThread();
                                ScoreboardScoreReplacementEvent replacementEvent = new ScoreboardScoreReplacementEvent(player, packet.getPlayer(), playerName, original, original, async);
                                Bukkit.getPluginManager().callEvent(replacementEvent);
                                if (replacementEvent.isCancelled()) { return original; }
                                return replacementEvent.getReplacement();
                            }
                            return original;
                        }, true);
                        if (replacedPlayerName != null) {
                            Object newPacket = ClassBuilder.buildPacketPlayOutScoreboardScore(packet.getPacketValue("d"), (String) packet.getPacketValue("b"), (String) replacedPlayerName, (int) packet.getPacketValue("c"));
                            packet.setPacket(newPacket);
                        }
                    }
                }
                if ("PacketPlayOutScoreboardTeam".equals(packet.getPacketName())) {
                    if (ScoreboardTeamReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        final Collection<String> playerNames = (Collection<String>) packet.getPacketValue("j");
                        final List<String> newPlayerNames = new ArrayList<>();
                        for (String entry : playerNames) {
                            final String replacedEntry = NickNamerAPI.replaceNames(entry, NickNamerAPI.getNickedPlayerNames(), new NameReplacer() {
                                @Override
                                public String replace(String original) {
                                    Player player = Bukkit.getPlayer(original);
                                    if (player != null) {
                                        boolean async = !getPlugin().getServer().isPrimaryThread();
                                        ScoreboardTeamReplacementEvent replacementEvent = new ScoreboardTeamReplacementEvent(player, packet.getPlayer(), entry, original, original, async);
                                        Bukkit.getPluginManager().callEvent(replacementEvent);
                                        if (replacementEvent.isCancelled()) { return original; }
                                        return replacementEvent.getReplacement();
                                    }
                                    return original;
                                }
                            }, true);
                            newPlayerNames.add(Objects.requireNonNullElse(replacedEntry, entry));
                        }
                        Object newPacket = ClassBuilder.buildPacketPlayOutScoreboardTeam((String) packet.getPacketValue("i"), (int) packet.getPacketValue("h"), (Optional) packet.getPacketValue("k"), (Collection<String>) newPlayerNames);
                        packet.setPacket(newPacket);
                    }
                }
            }
        }
    }

Replace Anonymous With Lambda org.inventivetalent.nicknamer.api.PacketListener.onSend.replacedEntry.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public onSend(packet SentPacket) : void from class org.inventivetalent.nicknamer.api.PacketListener


	void initStorageSQL() {
		if (sqlPass == null || sqlPass.isEmpty()) { sqlPass = null; }

		Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
			try {
				Connection connection = DriverManager.getConnection(sqlAddress, sqlUser, sqlPass);
				((PluginNickManager) NickNamerAPI.getNickManager())
						.setNickDataProvider(initCache(AsyncStringValueMapper
								.sql(new SQLDataProvider(connection, "nicknamer_data_nick"))));
				((PluginNickManager) NickNamerAPI.getNickManager())
						.setSkinDataProvider(initCache(AsyncStringValueMapper
								.sql(new SQLDataProvider(connection, "nicknamer_data_skin"))));
				SkinLoader.setSkinDataProvider(initCache(AsyncJsonValueMapper
						.sql(new SQLDataProvider(connection, "nicknamer_skins"))));
			} catch (SQLException e) {
				throw new RuntimeException("SQL connection failed", e);
			}
		});
	}

	void initStorageSQL() {
		if (sqlPass == null || sqlPass.isEmpty()) { sqlPass = null; }

		Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
			@Override
			public void run() {
				try {
					Connection connection = DriverManager.getConnection(sqlAddress, sqlUser, sqlPass);
					((PluginNickManager) NickNamerAPI.getNickManager())
							.setNickDataProvider(initCache(AsyncStringValueMapper
									.sql(new SQLDataProvider(connection, "nicknamer_data_nick"))));
					((PluginNickManager) NickNamerAPI.getNickManager())
							.setSkinDataProvider(initCache(AsyncStringValueMapper
									.sql(new SQLDataProvider(connection, "nicknamer_data_skin"))));
					SkinLoader.setSkinDataProvider(initCache(AsyncJsonValueMapper
							.sql(new SQLDataProvider(connection, "nicknamer_skins"))));
				} catch (SQLException e) {
					throw new RuntimeException("SQL connection failed", e);
				}
			}
		});
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.initStorageSQL.runTaskAsynchronously.new Runnable with () -> {tryConnection connection=DriverManager.getConnection(sqlAddress,sqlUser,sqlPass); in method package initStorageSQL() : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	void initStorageRedis() {
		if (redisPass == null || redisPass.isEmpty()) { redisPass = null; }

		Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
			JedisPoolConfig config = new JedisPoolConfig();
			config.setMaxTotal(redisMaxConnections);
			final JedisPool pool = new JedisPool(config, redisHost, redisPort, 0, redisPass);
			try (final Jedis jedis = pool.getResource()) {
				jedis.ping();
				getLogger().info("Connected to Redis");

				((PluginNickManager) NickNamerAPI.getNickManager())
						.setNickDataProvider(initCache(AsyncStringValueMapper
								.redis(new RedisDataProvider(jedis, "nn_data:%s:nick", "nn_data:(.*):nick"))));
				//					((PluginNickManager) NickNamerAPI.getNickManager()).setNickDataProvider(wrapAsyncProvider(String.class, new RedisDataProvider<>(String.class, pool, "nn_data:%s:nick", "nn_data:(.*):nick")));
				((PluginNickManager) NickNamerAPI.getNickManager())
						.setSkinDataProvider(initCache(AsyncStringValueMapper
								.redis(new RedisDataProvider(jedis, "nn_data:%s:skin", "nn_data:(.*):skin"))));
				//					((PluginNickManager) NickNamerAPI.getNickManager()).setSkinDataProvider(wrapAsyncProvider(String.class, new RedisDataProvider<>(String.class, pool, "nn_data:%s:skin", "nn_data:(.*):skin")));
				SkinLoader.setSkinDataProvider(initCache(AsyncJsonValueMapper
						.redis(new RedisDataProvider(jedis, "nn_skins:%s", "nn_skins:(.ü)") {
							@Override
							public void put(@Nonnull String key, @Nonnull String value) {
								jedis.setex(formatKey(key), 3600, value);
							}
						})));
				//					SkinLoader.setSkinDataProvider(new RedisDataProvider<Object>(Object.class, pool, "nn_skins:%s", "nn_skins:(.*)") {
				//						@Override
				//						public void put(@NonNull String key, Object value) {
				//							try (Jedis jedis = pool.getResource()) {
				//								jedis.setex(key(key), 3600, getSerializer().serialize(value));
				//							}
				//						}
				//					});
			} catch (JedisConnectionException e) {
				pool.destroy();
				throw new RuntimeException("Failed to connect to Redis", e);
			}
		});
	}

	void initStorageRedis() {
		if (redisPass == null || redisPass.isEmpty()) { redisPass = null; }

		Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
			@Override
			public void run() {
				JedisPoolConfig config = new JedisPoolConfig();
				config.setMaxTotal(redisMaxConnections);
				final JedisPool pool = new JedisPool(config, redisHost, redisPort, 0, redisPass);
				try (final Jedis jedis = pool.getResource()) {
					jedis.ping();
					getLogger().info("Connected to Redis");

					((PluginNickManager) NickNamerAPI.getNickManager())
							.setNickDataProvider(initCache(AsyncStringValueMapper
									.redis(new RedisDataProvider(jedis, "nn_data:%s:nick", "nn_data:(.*):nick"))));
					//					((PluginNickManager) NickNamerAPI.getNickManager()).setNickDataProvider(wrapAsyncProvider(String.class, new RedisDataProvider<>(String.class, pool, "nn_data:%s:nick", "nn_data:(.*):nick")));
					((PluginNickManager) NickNamerAPI.getNickManager())
							.setSkinDataProvider(initCache(AsyncStringValueMapper
									.redis(new RedisDataProvider(jedis, "nn_data:%s:skin", "nn_data:(.*):skin"))));
					//					((PluginNickManager) NickNamerAPI.getNickManager()).setSkinDataProvider(wrapAsyncProvider(String.class, new RedisDataProvider<>(String.class, pool, "nn_data:%s:skin", "nn_data:(.*):skin")));
					SkinLoader.setSkinDataProvider(initCache(AsyncJsonValueMapper
							.redis(new RedisDataProvider(jedis, "nn_skins:%s", "nn_skins:(.ü)") {
								@Override
								public void put(@Nonnull String key, @Nonnull String value) {
									jedis.setex(formatKey(key), 3600, value);
								}
							})));
					//					SkinLoader.setSkinDataProvider(new RedisDataProvider<Object>(Object.class, pool, "nn_skins:%s", "nn_skins:(.*)") {
					//						@Override
					//						public void put(@NonNull String key, Object value) {
					//							try (Jedis jedis = pool.getResource()) {
					//								jedis.setex(key(key), 3600, getSerializer().serialize(value));
					//							}
					//						}
					//					});
				} catch (JedisConnectionException e) {
					pool.destroy();
					throw new RuntimeException("Failed to connect to Redis", e);
				}
			}
		});
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.initStorageRedis.runTaskAsynchronously.new Runnable with () -> {JedisPoolConfig config=new JedisPoolConfig(); in method package initStorageRedis() : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.LOWEST)
	public void on(final NickDisguiseEvent event) {
		if (event.isCancelled()) { return; }
		if (!disguiseNick) {
			event.setCancelled(true);
			return;
		}
		if (getAPI().isNicked(event.getDisguised().getUniqueId())) {
			event.setNick(getAPI().getNick(event.getDisguised().getUniqueId()));

			((PluginNickManager) getAPI()).refreshCachedNick(event.getDisguised().getUniqueId());
		} else {
			((PluginNickManager) getAPI()).getNick(event.getDisguised().getUniqueId(), nick -> {
				if (nick != null && !nick.equals(event.getDisguised().getName())) {
					getAPI().refreshPlayer(event.getDisguised().getUniqueId());
				}
			});
		}
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void on(final NickDisguiseEvent event) {
		if (event.isCancelled()) { return; }
		if (!disguiseNick) {
			event.setCancelled(true);
			return;
		}
		if (getAPI().isNicked(event.getDisguised().getUniqueId())) {
			event.setNick(getAPI().getNick(event.getDisguised().getUniqueId()));

			((PluginNickManager) getAPI()).refreshCachedNick(event.getDisguised().getUniqueId());
		} else {
			((PluginNickManager) getAPI()).getNick(event.getDisguised().getUniqueId(), new DataCallback<String>() {
				@Override
				public void provide(@Nullable String nick) {
					if (nick != null && !nick.equals(event.getDisguised().getName())) {
						getAPI().refreshPlayer(event.getDisguised().getUniqueId());
					}
				}
			});
		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.getNick.new DataCallback<String> with nick -> {if(nick != null && !nick.equals(event.getDisguised().getName())){getAPI().refreshPlayer(event.getDisguised().getUniqueId()); in method public on(event NickDisguiseEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.LOWEST)
	public void on(final SkinDisguiseEvent event) {
		if (event.isCancelled()) { return; }
		if (!disguiseSkin) {
			event.setCancelled(true);
			return;
		}
		if (getAPI().hasSkin(event.getDisguised().getUniqueId())) {
			event.setSkin(getAPI().getSkin(event.getDisguised().getUniqueId()));

			((PluginNickManager) getAPI()).refreshCachedSkin(event.getDisguised().getUniqueId());
			if (event.getSkin() != null) { SkinLoader.refreshCachedData(event.getSkin()); }
		} else {
			((PluginNickManager) getAPI()).getSkin(event.getDisguised().getUniqueId(), skin -> {
				if (skin != null && !skin.equals(event.getDisguised().getName())) {
					GameProfile skinProfile = SkinLoader.getSkinProfile(skin);
					if (skinProfile == null) {
						Bukkit.getScheduler().runTaskAsynchronously(NickNamerPlugin.instance, new Runnable() {
							@Override
							public void run() {
								SkinLoader.loadSkin(skin);
								Bukkit.getScheduler().runTaskLater(NickNamerPlugin.instance, new Runnable() {
									@Override
									public void run() {
										getAPI().refreshPlayer(event.getDisguised().getUniqueId());
									}
								}, 10);
							}
						});
					} else {
						getAPI().refreshPlayer(event.getDisguised().getUniqueId());
					}
				}
			});

		}
	}

	@EventHandler(priority = EventPriority.LOWEST)
	public void on(final SkinDisguiseEvent event) {
		if (event.isCancelled()) { return; }
		if (!disguiseSkin) {
			event.setCancelled(true);
			return;
		}
		if (getAPI().hasSkin(event.getDisguised().getUniqueId())) {
			event.setSkin(getAPI().getSkin(event.getDisguised().getUniqueId()));

			((PluginNickManager) getAPI()).refreshCachedSkin(event.getDisguised().getUniqueId());
			if (event.getSkin() != null) { SkinLoader.refreshCachedData(event.getSkin()); }
		} else {
			((PluginNickManager) getAPI()).getSkin(event.getDisguised().getUniqueId(), new DataCallback<String>() {
				@Override
				public void provide(@Nullable final String skin) {
					if (skin != null && !skin.equals(event.getDisguised().getName())) {
						GameProfile skinProfile = SkinLoader.getSkinProfile(skin);
						if (skinProfile == null) {
							Bukkit.getScheduler().runTaskAsynchronously(NickNamerPlugin.instance, new Runnable() {
								@Override
								public void run() {
									SkinLoader.loadSkin(skin);
									Bukkit.getScheduler().runTaskLater(NickNamerPlugin.instance, new Runnable() {
										@Override
										public void run() {
											getAPI().refreshPlayer(event.getDisguised().getUniqueId());
										}
									}, 10);
								}
							});
						} else {
							getAPI().refreshPlayer(event.getDisguised().getUniqueId());
						}
					}
				}
			});

		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.getSkin.new DataCallback<String> with skin -> {if(skin != null && !skin.equals(event.getDisguised().getName())){GameProfile skinProfile=SkinLoader.getSkinProfile(skin); in method public on(event SkinDisguiseEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final AsyncPlayerChatEvent event) {
		if (ChatReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, original -> {
				Player player = Bukkit.getPlayer(original);
				if (player != null) {
					boolean async = !getServer().isPrimaryThread();
					NameReplacementEvent replacementEvent = new ChatReplacementEvent(player, event.getRecipients(), message, original, original, async);
					Bukkit.getPluginManager().callEvent(replacementEvent);
					if (replacementEvent.isCancelled()) { return original; }
					return replacementEvent.getReplacement();
				}
				return original;
			}, true);
			event.setMessage(replacedMessage);
		}
	}

	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final AsyncPlayerChatEvent event) {
		if (ChatReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, new NameReplacer() {
				@Override
				public String replace(String original) {
					Player player = Bukkit.getPlayer(original);
					if (player != null) {
						boolean async = !getServer().isPrimaryThread();
						NameReplacementEvent replacementEvent = new ChatReplacementEvent(player, event.getRecipients(), message, original, original, async);
						Bukkit.getPluginManager().callEvent(replacementEvent);
						if (replacementEvent.isCancelled()) { return original; }
						return replacementEvent.getReplacement();
					}
					return original;
				}
			}, true);
			event.setMessage(replacedMessage);
		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.replacedMessage.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public on(event AsyncPlayerChatEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final PlayerJoinEvent event) {
		if (PlayerJoinReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getJoinMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, original -> {
				Player player = Bukkit.getPlayer(original);
				if (player != null) {
					PlayerJoinReplacementEvent replacementEvent = new PlayerJoinReplacementEvent(player, Bukkit.getOnlinePlayers(), message, original, original);
					Bukkit.getPluginManager().callEvent(replacementEvent);
					if (replacementEvent.isCancelled()) { return original; }
					return replacementEvent.getReplacement();
				}
				return original;
			}, true);
			event.setJoinMessage(replacedMessage);
		}

		if (randomJoinSkin && event.getPlayer().hasPermission("nicknamer.join.skin")) {
			Bukkit.getScheduler().runTaskLater(this, new Runnable() {
				@Override
				public void run() {
					String skin = null;
					for (PermissionAttachmentInfo info : event.getPlayer().getEffectivePermissions()) {
						if (info.getValue() && info.getPermission().startsWith("nicknamer.join.skin.")) {
							if (skin != null) {
								getLogger().warning(event.getPlayer().getName() + " has multiple join-skin permissions");
							}
							skin = info.getPermission().substring("nicknamer.join.skin.".length());
						}
					}
					if (skin == null) {
						event.getPlayer().chat("/randomSkin");
					} else {
						event.getPlayer().chat("/changeskin " + skin);
					}
				}
			}, 10);
		}
		if (randomJoinNick && event.getPlayer().hasPermission("nicknamer.join.nick")) {
			Bukkit.getScheduler().runTaskLater(this, new Runnable() {
				@Override
				public void run() {
					String name = null;
					for (PermissionAttachmentInfo info : event.getPlayer().getEffectivePermissions()) {
						if (info.getValue() && info.getPermission().startsWith("nicknamer.join.nick.")) {
							if (name != null) {
								getLogger().warning(event.getPlayer().getName() + " has multiple join-nick permissions");
							}
							name = info.getPermission().substring("nicknamer.join.nick.".length());
						}
					}
					if (name == null) {
						event.getPlayer().chat("/randomNick");
					} else {
						// Convert tp upper case
						String tempName = name;
						name = "";
						boolean toUpper = false;
						for (int i = 0; i < tempName.length(); i++) {
							char c = tempName.charAt(i);
							if (c == '^') {// found an identifier -> continue
								toUpper = true;
							} else if (toUpper) {// change following character to upper case
								name += Character.toUpperCase(c);
								toUpper = false;
							} else {// no changes
								name += c;
							}
						}
						if (toUpper) {
							getLogger().warning("Trailing upper-case identifier in " + event.getPlayer().getName() + "'s permission: " + tempName);
						}

						event.getPlayer().chat("/nickname " + name);
					}
				}
			}, 20);
		}

		if (event.getPlayer().hasPermission("nicknamer.updatecheck")) {
			spigetUpdate.checkForUpdate(new UpdateCallback() {
				@Override
				public void updateAvailable(String s, String s1, boolean b) {
					event.getPlayer().sendMessage("§aA new version for §6NickNamer §ais available (§7v" + s + "§a). Download it from https://r.spiget.org/5341");
				}

				@Override
				public void upToDate() {
				}
			});
		}
	}

	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final PlayerJoinEvent event) {
		if (PlayerJoinReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getJoinMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, new NameReplacer() {
				@Override
				public String replace(String original) {
					Player player = Bukkit.getPlayer(original);
					if (player != null) {
						PlayerJoinReplacementEvent replacementEvent = new PlayerJoinReplacementEvent(player, Bukkit.getOnlinePlayers(), message, original, original);
						Bukkit.getPluginManager().callEvent(replacementEvent);
						if (replacementEvent.isCancelled()) { return original; }
						return replacementEvent.getReplacement();
					}
					return original;
				}
			}, true);
			event.setJoinMessage(replacedMessage);
		}

		if (randomJoinSkin && event.getPlayer().hasPermission("nicknamer.join.skin")) {
			Bukkit.getScheduler().runTaskLater(this, new Runnable() {
				@Override
				public void run() {
					String skin = null;
					for (PermissionAttachmentInfo info : event.getPlayer().getEffectivePermissions()) {
						if (info.getValue() && info.getPermission().startsWith("nicknamer.join.skin.")) {
							if (skin != null) {
								getLogger().warning(event.getPlayer().getName() + " has multiple join-skin permissions");
							}
							skin = info.getPermission().substring("nicknamer.join.skin.".length());
						}
					}
					if (skin == null) {
						event.getPlayer().chat("/randomSkin");
					} else {
						event.getPlayer().chat("/changeskin " + skin);
					}
				}
			}, 10);
		}
		if (randomJoinNick && event.getPlayer().hasPermission("nicknamer.join.nick")) {
			Bukkit.getScheduler().runTaskLater(this, new Runnable() {
				@Override
				public void run() {
					String name = null;
					for (PermissionAttachmentInfo info : event.getPlayer().getEffectivePermissions()) {
						if (info.getValue() && info.getPermission().startsWith("nicknamer.join.nick.")) {
							if (name != null) {
								getLogger().warning(event.getPlayer().getName() + " has multiple join-nick permissions");
							}
							name = info.getPermission().substring("nicknamer.join.nick.".length());
						}
					}
					if (name == null) {
						event.getPlayer().chat("/randomNick");
					} else {
						// Convert tp upper case
						String tempName = name;
						name = "";
						boolean toUpper = false;
						for (int i = 0; i < tempName.length(); i++) {
							char c = tempName.charAt(i);
							if (c == '^') {// found an identifier -> continue
								toUpper = true;
							} else if (toUpper) {// change following character to upper case
								name += Character.toUpperCase(c);
								toUpper = false;
							} else {// no changes
								name += c;
							}
						}
						if (toUpper) {
							getLogger().warning("Trailing upper-case identifier in " + event.getPlayer().getName() + "'s permission: " + tempName);
						}

						event.getPlayer().chat("/nickname " + name);
					}
				}
			}, 20);
		}

		if (event.getPlayer().hasPermission("nicknamer.updatecheck")) {
			spigetUpdate.checkForUpdate(new UpdateCallback() {
				@Override
				public void updateAvailable(String s, String s1, boolean b) {
					event.getPlayer().sendMessage("§aA new version for §6NickNamer §ais available (§7v" + s + "§a). Download it from https://r.spiget.org/5341");
				}

				@Override
				public void upToDate() {
				}
			});
		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.replacedMessage.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public on(event PlayerJoinEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final PlayerQuitEvent event) {
		if (PlayerQuitReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getQuitMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, original -> {
				Player player = Bukkit.getPlayer(original);
				if (player != null) {
					PlayerQuitReplacementEvent replacementEvent = new PlayerQuitReplacementEvent(player, Bukkit.getOnlinePlayers(), message, original, original);
					Bukkit.getPluginManager().callEvent(replacementEvent);
					if (replacementEvent.isCancelled()) { return original; }
					return replacementEvent.getReplacement();
				}
				return original;
			}, true);
			event.setQuitMessage(replacedMessage);
		}
	}

	@EventHandler(priority = EventPriority.NORMAL)
	public void on(final PlayerQuitEvent event) {
		if (PlayerQuitReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			final String message = event.getQuitMessage();
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			String replacedMessage = NickNamerAPI.replaceNames(message, nickedPlayerNames, new NameReplacer() {
				@Override
				public String replace(String original) {
					Player player = Bukkit.getPlayer(original);
					if (player != null) {
						PlayerQuitReplacementEvent replacementEvent = new PlayerQuitReplacementEvent(player, Bukkit.getOnlinePlayers(), message, original, original);
						Bukkit.getPluginManager().callEvent(replacementEvent);
						if (replacementEvent.isCancelled()) { return original; }
						return replacementEvent.getReplacement();
					}
					return original;
				}
			}, true);
			event.setQuitMessage(replacedMessage);
		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.replacedMessage.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public on(event PlayerQuitEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


	@EventHandler(priority = EventPriority.NORMAL)
	public void on(PlayerChatTabCompleteEvent event) {
		if (ChatTabCompleteReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			for (ListIterator<String> iterator = ((List<String>) event.getTabCompletions()).listIterator(); iterator.hasNext(); ) {
				final String completion = iterator.next();
				String replacedCompletion = NickNamerAPI.replaceNames(completion, nickedPlayerNames, original -> {
					Player player = Bukkit.getPlayer(original);
					if (player != null) {
						ChatTabCompleteReplacementEvent replacementEvent = new ChatTabCompleteReplacementEvent(player, event.getPlayer(), completion, original, original);
						Bukkit.getPluginManager().callEvent(replacementEvent);
						if (replacementEvent.isCancelled()) { return original; }
						return replacementEvent.getReplacement();
					}
					return original;
				}, true);
				iterator.set(ChatColor.stripColor(replacedCompletion));
			}
		}
	}

	@EventHandler(priority = EventPriority.NORMAL)
	public void on(PlayerChatTabCompleteEvent event) {
		if (ChatTabCompleteReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
			Set<String> nickedPlayerNames = NickNamerAPI.getNickedPlayerNames();
			for (ListIterator<String> iterator = ((List<String>) event.getTabCompletions()).listIterator(); iterator.hasNext(); ) {
				final String completion = iterator.next();
				String replacedCompletion = NickNamerAPI.replaceNames(completion, nickedPlayerNames, new NameReplacer() {
					@Override
					public String replace(String original) {
						Player player = Bukkit.getPlayer(original);
						if (player != null) {
							ChatTabCompleteReplacementEvent replacementEvent = new ChatTabCompleteReplacementEvent(player, event.getPlayer(), completion, original, original);
							Bukkit.getPluginManager().callEvent(replacementEvent);
							if (replacementEvent.isCancelled()) { return original; }
							return replacementEvent.getReplacement();
						}
						return original;
					}
				}, true);
				iterator.set(ChatColor.stripColor(replacedCompletion));
			}
		}
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.NickNamerPlugin.on.replacedCompletion.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public on(event PlayerChatTabCompleteEvent) : void from class org.inventivetalent.nicknamer.NickNamerPlugin


    @SuppressWarnings("unchecked")
    protected void updateSelf(final Player player) {
        if (player == null || !player.isOnline()) { return; }
        GameProfile profile = ClassBuilder.getGameProfile(player);

        boolean async = !plugin.getServer().isPrimaryThread();
        NickNamerSelfUpdateEvent event = new NickNamerSelfUpdateEvent(player, isNicked(player.getUniqueId()) ? getNick(player.getUniqueId()) : player.getPlayerListName(), profile, player.getWorld().getDifficulty(), player.getGameMode(), async);
        Bukkit.getPluginManager().callEvent(event);
        if (event.isCancelled()) { return; }

        try {
            final Object removePlayer = ClassBuilder.buildPlayerInfoPacket(4, event.getGameProfile(), 0, event.getGameMode().ordinal(), event.getName());
            final Object addPlayer = ClassBuilder.buildPlayerInfoPacket(0, event.getGameProfile(), 0, event.getGameMode().ordinal(), event.getName());

            NickNamerAPI.packetListener.sendPacket(player, removePlayer);

            //TODO: might want to send two respawn packets to get rid of the chunk unloading weirdness
            //  (https://wiki.vg/Protocol#Respawn)
            //   -> tried that, turns out the client needs a chunk update right after the respawn packet, so we'd have to add that aswell

            final Object respawnPlayer;
            if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_13_R1)) {
                Object dimensionManagerKey;
                switch (player.getWorld().getEnvironment()) {
                    case NETHER:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("NETHER", "g").get(null);
                        break;
                    case THE_END:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("THE_END", "h").get(null);
                        break;
                    case NORMAL:
                    default:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("OVERWORLD", "f").get(null);
                        break;
                }

                Object difficulty = EnumDifficulty.getEnumConstants()[event.getDifficulty().ordinal()];

                Object gamemode = EnumGamemode.getDeclaredMethod("getById", int.class).invoke(null, event.getGameMode().getValue());
                Object type = MinecraftVersion.VERSION.olderThan(Minecraft.Version.v1_16_R1) ? ((Object[]) WorldType.getDeclaredField("types").get(null))[0] : null;
                long seedHash = MinecraftVersion.VERSION.olderThan(Minecraft.Version.v1_15_R1) ? (long) WorldData.getDeclaredMethod("c", Long.TYPE).invoke(null, player.getWorld().getSeed()) : -1;

                if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_16_R2)) {
                    Object nmsWorld = Minecraft.getHandle(player.getWorld());
                    Object dimensionManager = World.getDeclaredMethod("getDimensionManager").invoke(nmsWorld);
                    Object dimensionKey = World.getDeclaredMethod("getDimensionKey").invoke(nmsWorld);
                    boolean isFlatWorld = (boolean) WorldServer.getDeclaredMethod("isFlatWorld").invoke(nmsWorld);
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, ResourceKey, Long.TYPE, EnumGamemode, EnumGamemode, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE)
                            .newInstance(dimensionManager, dimensionKey, seedHash, gamemode, gamemode, false/*isDebugWorld*/, isFlatWorld, true/*keepAllPlayerData*/);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_16_R1)) {
                    Object nmsWorld = Minecraft.getHandle(player.getWorld());
                    Object typeKey = World.getDeclaredMethod("getTypeKey").invoke(nmsWorld);
                    Object dimensionKey = World.getDeclaredMethod("getDimensionKey").invoke(nmsWorld);
                    boolean isFlatWorld = (boolean) WorldServer.getDeclaredMethod("isFlatWorld").invoke(nmsWorld);
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(ResourceKey, ResourceKey, Long.TYPE, EnumGamemode, EnumGamemode, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE)
                            .newInstance(typeKey, dimensionKey, seedHash, gamemode, gamemode, false/*isDebugWorld*/, isFlatWorld, true/*keepAllPlayerData*/);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_15_R1)) {// https://wiki.vg/Protocol_History#19w36a - new hashed seed field in respawn packet
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, Long.TYPE, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, seedHash, type, gamemode);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_14_R1)) {
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, type, gamemode);
                } else {
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, EnumDifficulty, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, difficulty, type, gamemode);
                }

            } else {
                int dimension = player.getWorld().getEnvironment().getId();
                Object difficulty = EnumDifficulty.getDeclaredMethod("getById", int.class).invoke(null, event.getDifficulty().getValue());
                Object type = ((Object[]) WorldType.getDeclaredField("types").get(null))[0];
                Object gamemode = EnumGamemode.getDeclaredMethod("getById", int.class).invoke(null, event.getGameMode().getValue());

                respawnPlayer = PacketPlayOutRespawn
                        .getConstructor(int.class, EnumDifficulty, WorldType, EnumGamemode)
                        .newInstance(dimension, difficulty, type, gamemode);
            }

            final GameMode gameMode = player.getGameMode();
            final boolean allowFlight = player.getAllowFlight();
            final boolean flying = player.isFlying();
            final Location location = player.getLocation();
            final int level = player.getLevel();
            final float xp = player.getExp();
            final double maxHealth = player.getMaxHealth();
            final double health = player.getHealth();

            Bukkit.getScheduler().runTaskLater(plugin, () -> {
                NickNamerAPI.packetListener.sendPacket(player, respawnPlayer);

                player.setGameMode(gameMode);
                player.setAllowFlight(allowFlight);
                player.setFlying(flying);
                player.teleport(location);
                player.updateInventory();
                player.setLevel(level);
                player.setExp(xp);
                player.setMaxHealth(maxHealth);
                player.setHealth(health);

                NickNamerAPI.packetListener.sendPacket(player, addPlayer);
            }, 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @SuppressWarnings("unchecked")
    protected void updateSelf(final Player player) {
        if (player == null || !player.isOnline()) { return; }
        GameProfile profile = ClassBuilder.getGameProfile(player);

        boolean async = !plugin.getServer().isPrimaryThread();
        NickNamerSelfUpdateEvent event = new NickNamerSelfUpdateEvent(player, isNicked(player.getUniqueId()) ? getNick(player.getUniqueId()) : player.getPlayerListName(), profile, player.getWorld().getDifficulty(), player.getGameMode(), async);
        Bukkit.getPluginManager().callEvent(event);
        if (event.isCancelled()) { return; }

        try {
            final Object removePlayer = ClassBuilder.buildPlayerInfoPacket(4, event.getGameProfile(), 0, event.getGameMode().ordinal(), event.getName());
            final Object addPlayer = ClassBuilder.buildPlayerInfoPacket(0, event.getGameProfile(), 0, event.getGameMode().ordinal(), event.getName());

            NickNamerAPI.packetListener.sendPacket(player, removePlayer);

            //TODO: might want to send two respawn packets to get rid of the chunk unloading weirdness
            //  (https://wiki.vg/Protocol#Respawn)
            //   -> tried that, turns out the client needs a chunk update right after the respawn packet, so we'd have to add that aswell

            final Object respawnPlayer;
            if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_13_R1)) {
                Object dimensionManagerKey;
                switch (player.getWorld().getEnvironment()) {
                    case NETHER:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("NETHER", "g").get(null);
                        break;
                    case THE_END:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("THE_END", "h").get(null);
                        break;
                    case NORMAL:
                    default:
                        dimensionManagerKey = DimensionManagerFieldResolver.resolveAccessor("OVERWORLD", "f").get(null);
                        break;
                }

                Object difficulty = EnumDifficulty.getEnumConstants()[event.getDifficulty().ordinal()];

                Object gamemode = EnumGamemode.getDeclaredMethod("getById", int.class).invoke(null, event.getGameMode().getValue());
                Object type = MinecraftVersion.VERSION.olderThan(Minecraft.Version.v1_16_R1) ? ((Object[]) WorldType.getDeclaredField("types").get(null))[0] : null;
                long seedHash = MinecraftVersion.VERSION.olderThan(Minecraft.Version.v1_15_R1) ? (long) WorldData.getDeclaredMethod("c", Long.TYPE).invoke(null, player.getWorld().getSeed()) : -1;

                if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_16_R2)) {
                    Object nmsWorld = Minecraft.getHandle(player.getWorld());
                    Object dimensionManager = World.getDeclaredMethod("getDimensionManager").invoke(nmsWorld);
                    Object dimensionKey = World.getDeclaredMethod("getDimensionKey").invoke(nmsWorld);
                    boolean isFlatWorld = (boolean) WorldServer.getDeclaredMethod("isFlatWorld").invoke(nmsWorld);
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, ResourceKey, Long.TYPE, EnumGamemode, EnumGamemode, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE)
                            .newInstance(dimensionManager, dimensionKey, seedHash, gamemode, gamemode, false/*isDebugWorld*/, isFlatWorld, true/*keepAllPlayerData*/);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_16_R1)) {
                    Object nmsWorld = Minecraft.getHandle(player.getWorld());
                    Object typeKey = World.getDeclaredMethod("getTypeKey").invoke(nmsWorld);
                    Object dimensionKey = World.getDeclaredMethod("getDimensionKey").invoke(nmsWorld);
                    boolean isFlatWorld = (boolean) WorldServer.getDeclaredMethod("isFlatWorld").invoke(nmsWorld);
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(ResourceKey, ResourceKey, Long.TYPE, EnumGamemode, EnumGamemode, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE)
                            .newInstance(typeKey, dimensionKey, seedHash, gamemode, gamemode, false/*isDebugWorld*/, isFlatWorld, true/*keepAllPlayerData*/);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_15_R1)) {// https://wiki.vg/Protocol_History#19w36a - new hashed seed field in respawn packet
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, Long.TYPE, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, seedHash, type, gamemode);
                } else if (MinecraftVersion.VERSION.newerThan(Minecraft.Version.v1_14_R1)) {
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, type, gamemode);
                } else {
                    respawnPlayer = PacketPlayOutRespawn
                            .getConstructor(DimensionManager, EnumDifficulty, WorldType, EnumGamemode)
                            .newInstance(dimensionManagerKey, difficulty, type, gamemode);
                }

            } else {
                int dimension = player.getWorld().getEnvironment().getId();
                Object difficulty = EnumDifficulty.getDeclaredMethod("getById", int.class).invoke(null, event.getDifficulty().getValue());
                Object type = ((Object[]) WorldType.getDeclaredField("types").get(null))[0];
                Object gamemode = EnumGamemode.getDeclaredMethod("getById", int.class).invoke(null, event.getGameMode().getValue());

                respawnPlayer = PacketPlayOutRespawn
                        .getConstructor(int.class, EnumDifficulty, WorldType, EnumGamemode)
                        .newInstance(dimension, difficulty, type, gamemode);
            }

            final boolean flying = player.isFlying();
            final Location location = player.getLocation();
            final int level = player.getLevel();
            final float xp = player.getExp();
            final double maxHealth = player.getMaxHealth();
            final double health = player.getHealth();

            Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                @Override
                public void run() {
                    NickNamerAPI.packetListener.sendPacket(player, respawnPlayer);

                    player.setFlying(flying);
                    player.teleport(location);
                    player.updateInventory();
                    player.setLevel(level);
                    player.setExp(xp);
                    player.setMaxHealth(maxHealth);
                    player.setHealth(health);

                    NickNamerAPI.packetListener.sendPacket(player, addPlayer);
                }
            }, 5);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Replace Anonymous With Lambda org.inventivetalent.nicknamer.api.SimpleNickManager.updateSelf.runTaskLater.new Runnable with () -> {NickNamerAPI.packetListener.sendPacket(player,respawnPlayer); in method protected updateSelf(player Player) : void from class org.inventivetalent.nicknamer.api.SimpleNickManager


	@Nullable
	public static GameProfile loadSkinHandle(@Nonnull String owner) {
		GameProfile profile = getSkinProfileHandle(owner);
		if (profile == null && skinDataProvider instanceof AsyncCacheMapper.CachedDataProvider) {
			CompletableFuture<GameProfile> future = new CompletableFuture<>();
			((AsyncCacheMapper.CachedDataProvider<JsonObject>) skinDataProvider).get(owner, jsonObject -> future.complete(jsonToProfile(jsonObject)));
			try {
				profile = future.get(2, TimeUnit.SECONDS);
			} catch (InterruptedException | ExecutionException | TimeoutException e) {
				e.printStackTrace();
			}
			if (profile != null) {
				return profile;
			}
		}
		if (profile == null) {
			profile = getCachedProfile(owner);
		}
		return profile;
	}

	@Nullable
	public static GameProfile loadSkinHandle(@Nonnull String owner) {
		GameProfile profile = getSkinProfileHandle(owner);
		if (profile == null && skinDataProvider instanceof AsyncCacheMapper.CachedDataProvider) {
			CompletableFuture<GameProfile> future = new CompletableFuture<>();
			((AsyncCacheMapper.CachedDataProvider<JsonObject>) skinDataProvider).get(owner, new DataCallback<JsonObject>() {
				@Override
				public void provide(@Nullable JsonObject jsonObject) {
					System.out.println(jsonObject);
					future.complete(jsonToProfile(jsonObject));
				}
			});
			try {
				profile = future.get(2, TimeUnit.SECONDS);
			} catch (InterruptedException | ExecutionException | TimeoutException e) {
				e.printStackTrace();
			}
			if (profile != null) {
				return profile;
			}
		}
		if (profile == null) {
			profile = getCachedProfile(owner);
		}
		return profile;
	}

Replace Anonymous With Lambda org.inventivetalent.nicknamer.api.SkinLoader.loadSkinHandle.get.new DataCallback<JsonObject> with jsonObject -> future.complete(jsonToProfile(jsonObject)) in method public loadSkinHandle(owner String) : GameProfile from class org.inventivetalent.nicknamer.api.SkinLoader


    @Override
    @PacketOptions(forcePlayer = true)
    public void onReceive(final ReceivedPacket packet) {
        if (!NickNamerAPI.getNickManager().isSimple()) {
            if (packet.hasPlayer()) {
                if ("PacketPlayInChat".equals(packet.getPacketName())) {
                    if (ChatInReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        try {
                            final String message = (String) PacketPlayInChatFieldResolver.resolve("message", "a").get(packet.getPacket());
                            String replacedMessage = NickNamerAPI.replaceNames(message, NickNamerAPI.getNickedPlayerNames(), original -> {
                                Player player = Bukkit.getPlayer(original);
                                if (player != null) {
                                    boolean async = !getPlugin().getServer().isPrimaryThread();
                                    ChatInReplacementEvent replacementEvent = new ChatInReplacementEvent(player, packet.getPlayer(), message, original, original, async);
                                    Bukkit.getPluginManager().callEvent(replacementEvent);
                                    if (replacementEvent.isCancelled()) { return original; }
                                    return replacementEvent.getReplacement();
                                }
                                return original;
                            }, true);
                            if (replacedMessage != null) {
                                Object newPacket = ClassBuilder.buildPacketPlayInChat(replacedMessage);
                                packet.setPacket(newPacket);
                            }
                        } catch (Exception e) {
                            getPlugin().getLogger().log(Level.SEVERE, "", e);
                        }
                    }
                    if (ChatInReverseReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        try {
                            final String message = (String) PacketPlayInChatFieldResolver.resolve("message", "a").get(packet.getPacket());
                            String replacedMessage = NickNamerAPI.replaceNames(message, NickNamerAPI.getNickManager().getUsedNicks(), original -> {
                                Collection<UUID> playersWithNick = NickNamerAPI.getNickManager().getPlayersWithNick(original);
                                if (playersWithNick.size() > 0) {
                                    Player player = Bukkit.getPlayer(playersWithNick.iterator().next());
                                    if (player != null) {
                                        boolean async = !getPlugin().getServer().isPrimaryThread();
                                        ChatInReverseReplacementEvent replacementEvent = new ChatInReverseReplacementEvent(player, packet.getPlayer(), message, original, original, async);
                                        Bukkit.getPluginManager().callEvent(replacementEvent);
                                        if (replacementEvent.isCancelled()) { return original; }
                                        return replacementEvent.getReplacement();
                                    }
                                }
                                return original;
                            }, true);
                            if (replacedMessage != null) {
                                Object newPacket = ClassBuilder.buildPacketPlayInChat(replacedMessage);
                                packet.setPacket(newPacket);
                            }
                        } catch (Exception e) {
                            getPlugin().getLogger().log(Level.SEVERE, "", e);
                        }
                    }
                }
            }
        }
    }

    @Override
    @PacketOptions(forcePlayer = true)
    public void onReceive(final ReceivedPacket packet) {
        if (!NickNamerAPI.getNickManager().isSimple()) {
            if (packet.hasPlayer()) {
                if ("PacketPlayInChat".equals(packet.getPacketName())) {
                    if (ChatInReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        try {
                            final String message = (String) PacketPlayInChatFieldResolver.resolve("message", "a").get(packet.getPacket());
                            String replacedMessage = NickNamerAPI.replaceNames(message, NickNamerAPI.getNickedPlayerNames(), new NameReplacer() {
                                @Override
                                public String replace(String original) {
                                    Player player = Bukkit.getPlayer(original);
                                    if (player != null) {
                                        boolean async = !getPlugin().getServer().isPrimaryThread();
                                        ChatInReplacementEvent replacementEvent = new ChatInReplacementEvent(player, packet.getPlayer(), message, original, original, async);
                                        Bukkit.getPluginManager().callEvent(replacementEvent);
                                        if (replacementEvent.isCancelled()) { return original; }
                                        return replacementEvent.getReplacement();
                                    }
                                    return original;
                                }
                            }, true);
                            PacketPlayInChatFieldResolver.resolve("message", "a").set(packet.getPacket(), replacedMessage);
                        } catch (Exception e) {
                            getPlugin().getLogger().log(Level.SEVERE, "", e);
                        }
                    }
                    if (ChatInReverseReplacementEvent.getHandlerList().getRegisteredListeners().length > 0) {
                        try {
                            final String message = (String) PacketPlayInChatFieldResolver.resolve("message", "a").get(packet.getPacket());
                            String replacedMessage = NickNamerAPI.replaceNames(message, NickNamerAPI.getNickManager().getUsedNicks(), new NameReplacer() {
                                @Override
                                public String replace(String original) {
                                    Collection<UUID> playersWithNick = NickNamerAPI.getNickManager().getPlayersWithNick(original);
                                    if (playersWithNick.size() > 0) {
                                        Player player = Bukkit.getPlayer(playersWithNick.iterator().next());
                                        if (player != null) {
                                            boolean async = !getPlugin().getServer().isPrimaryThread();
                                            ChatInReverseReplacementEvent replacementEvent = new ChatInReverseReplacementEvent(player, packet.getPlayer(), message, original, original, async);
                                            Bukkit.getPluginManager().callEvent(replacementEvent);
                                            if (replacementEvent.isCancelled()) { return original; }
                                            return replacementEvent.getReplacement();
                                        }
                                    }
                                    return original;
                                }
                            }, true);
                            PacketPlayInChatFieldResolver.resolve("message", "a").set(packet.getPacket(), replacedMessage);
                        } catch (Exception e) {
                            getPlugin().getLogger().log(Level.SEVERE, "", e);
                        }
                    }
                }
            }
        }
    }

Replace Anonymous With Lambda org.inventivetalent.nicknamer.api.PacketListener.onReceive.replacedMessage.replaceNames.new NameReplacer with original -> {Player player=Bukkit.getPlayer(original); in method public onReceive(packet ReceivedPacket) : void from class org.inventivetalent.nicknamer.api.PacketListener


    public Bookmark(String url) throws MalformedURLException {
        this(url, new ArrayList<>());
    }

    public Bookmark(String url) throws MalformedURLException {
        this(url, new ArrayList<String>());
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public Bookmark(url String) from class at.ac.fhcampuswien.csdc21bb.group3.domain.Bookmark


	public static void main(String[] args) {
		try {
            for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
        	java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }

		// Launches the login view
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LoginView().setVisible(true);
            }
        });

	}

	public static void main(String[] args) {
		try {
            for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }

        EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LoginView().setVisible(true);
            }
        });

	}

Merge Catch [catch(ClassNotFoundException ex), catch(InstantiationException ex), catch(IllegalAccessException ex), catch(UnsupportedLookAndFeelException ex)] to catch(ClassNotFoundException|InstantiationException|IllegalAccessException|UnsupportedLookAndFeelException ex) in method public main(args String[]) : void from class loginScreen.MainLaunch


    public static <T> Collector<T, List<List<T>>, List<List<T>>> slidingCollector(int size, int step) {
        final int window = Math.max(size, step);

        return new Collector<>() {

            private final Queue<T> buffer = new ArrayDeque<>();
            private int totalIn = 0;

            @Override
            public Supplier<List<List<T>>> supplier() {
                return ArrayList::new;
            }

            @Override
            public BiConsumer<List<List<T>>, T> accumulator() {
                return (lists, t) -> {
                    buffer.offer(t);
                    ++totalIn;
                    if (buffer.size() == window) {
                        dumpCurrent(lists);
                        shiftBy(step);
                    }
                };
            }

            @Override
            public Function<List<List<T>>, List<List<T>>> finisher() {
                return lists -> {
                    if (!buffer.isEmpty()) {
                        final int totalOut = estimateTotalOut();
                        if (totalOut > lists.size()) {
                            dumpCurrent(lists);
                        }
                    }
                    return lists;
                };
            }

            private int estimateTotalOut() {
                return Math.max(0, (totalIn + step - size - 1) / step) + 1;
            }

            private void dumpCurrent(List<List<T>> lists) {
                final List<T> batch = buffer.stream().limit(size).collect(Collectors.toList());
                lists.add(batch);
            }

            private void shiftBy(int by) {
                for (int i = 0; i < by; i++) {
                    buffer.remove();
                }
            }

            @Override
            public BinaryOperator<List<List<T>>> combiner() {
                return (l1, l2) -> {
                    throw new UnsupportedOperationException("Combining not possible");
                };
            }

            @Override
            public Set<Characteristics> characteristics() {
                return EnumSet.noneOf(Characteristics.class);
            }
        };
    }

    public static <T> Collector<T, List<List<T>>, List<List<T>>> slidingCollector(int size, int step) {
        final int window = Math.max(size, step);

        return new Collector<T, List<List<T>>, List<List<T>>>() {

            private final Queue<T> buffer = new ArrayDeque<>();
            private int totalIn = 0;

            @Override
            public Supplier<List<List<T>>> supplier() {
                return ArrayList::new;
            }

            @Override
            public BiConsumer<List<List<T>>, T> accumulator() {
                return (lists, t) -> {
                    buffer.offer(t);
                    ++totalIn;
                    if (buffer.size() == window) {
                        dumpCurrent(lists);
                        shiftBy(step);
                    }
                };
            }

            @Override
            public Function<List<List<T>>, List<List<T>>> finisher() {
                return lists -> {
                    if (!buffer.isEmpty()) {
                        final int totalOut = estimateTotalOut();
                        if (totalOut > lists.size()) {
                            dumpCurrent(lists);
                        }
                    }
                    return lists;
                };
            }

            private int estimateTotalOut() {
                return Math.max(0, (totalIn + step - size - 1) / step) + 1;
            }

            private void dumpCurrent(List<List<T>> lists) {
                final List<T> batch = buffer.stream().limit(size).collect(Collectors.toList());
                lists.add(batch);
            }

            private void shiftBy(int by) {
                for (int i = 0; i < by; i++) {
                    buffer.remove();
                }
            }

            @Override
            public BinaryOperator<List<List<T>>> combiner() {
                return (l1, l2) -> {
                    throw new UnsupportedOperationException("Combining not possible");
                };
            }

            @Override
            public Set<Characteristics> characteristics() {
                return EnumSet.noneOf(Characteristics.class);
            }
        };
    }

Replace Generic With Diamond Collector<T,List<List<T>>,List<List<T>>> with Collector<> in method public slidingCollector(size int, step int) : Collector<T,List<List<T>>,List<List<T>>> from class rapaio.experiment.util.stream.SCollectors


    /**
     * Creates a new worker to do the image rendering in the background.
     */
    private void createBackgroundImage() {
        drawWorker = new SwingWorker<>() {
            @Override
            protected BufferedImage doInBackground() {
                if (figure == null) {
                    return currentImage;
                }
                return ImageUtility.buildImage(figure, getWidth(), getHeight());
            }

            @Override
            protected void done() {

                SwingUtilities.invokeLater(() -> {
                    try {
                        currentImage = get();
                        drawWorker = null;
                        revalidate();
                        repaint();
                    } catch (InterruptedException | ExecutionException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                });

            }
        };

        drawWorker.execute();
    }

    /**
     * Creates a new worker to do the image rendering in the background.
     */
    private void createBackgroundImage() {
        drawWorker = new SwingWorker<BufferedImage, Object>() {
            @Override
            protected BufferedImage doInBackground() {
                if (figure == null) {
                    return currentImage;
                }
                return ImageUtility.buildImage(figure, getWidth(), getHeight());
            }

            @Override
            protected void done() {

                SwingUtilities.invokeLater(() -> {
                    try {
                        currentImage = get();
                        drawWorker = null;
                        revalidate();
                        repaint();
                    } catch (InterruptedException | ExecutionException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                });

            }
        };

        drawWorker.execute();
    }

Replace Generic With Diamond SwingWorker<BufferedImage,Object> with SwingWorker<> in method private createBackgroundImage() : void from class rapaio.printer.local.FigurePanel


    static Collector<Integer, VarInt, Mapping> collector() {
        return new Collector<>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (list1, list2) -> {
                    IntIterator it = list2.iterator();
                    while (it.hasNext()) {
                        list1.addInt(it.nextInt());
                    }
                    return list1;
                };
            }

            @Override
            public Function<VarInt, Mapping> finisher() {
                return Mapping::wrap;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    static Collector<Integer, VarInt, Mapping> collector() {
        return new Collector<Integer, VarInt, Mapping>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (list1, list2) -> {
                    IntIterator it = list2.iterator();
                    while (it.hasNext()) {
                        list1.addInt(it.nextInt());
                    }
                    return list1;
                };
            }

            @Override
            public Function<VarInt, Mapping> finisher() {
                return Mapping::wrap;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Integer,VarInt,Mapping> with Collector<> in method public collector() : Collector<Integer,VarInt,Mapping> from class rapaio.data.Mapping


    public static Collector<Double, VarDouble, VarDouble> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarDouble> supplier() {
                return VarDouble::empty;
            }

            @Override
            public BiConsumer<VarDouble, Double> accumulator() {
                return VarDouble::addDouble;
            }

            @Override
            public BinaryOperator<VarDouble> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarDouble, VarDouble> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<Double, VarDouble, VarDouble> collector() {

        return new Collector<Double, VarDouble, VarDouble>() {
            @Override
            public Supplier<VarDouble> supplier() {
                return VarDouble::empty;
            }

            @Override
            public BiConsumer<VarDouble, Double> accumulator() {
                return VarDouble::addDouble;
            }

            @Override
            public BinaryOperator<VarDouble> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarDouble, VarDouble> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Double,VarDouble,VarDouble> with Collector<> in method public collector() : Collector<Double,VarDouble,VarDouble> from class rapaio.data.VarDouble


    public static Collector<? super Integer, VarInt, VarInt> collector() {
        return new Collector<>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarInt, VarInt> finisher() {
                return VarInt::copy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<? super Integer, VarInt, VarInt> collector() {
        return new Collector<Integer, VarInt, VarInt>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarInt, VarInt> finisher() {
                return VarInt::copy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Integer,VarInt,VarInt> with Collector<> in method public collector() : Collector<? super Integer,VarInt,VarInt> from class rapaio.data.VarInt


    public static Collector<Long, VarLong, VarLong> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarLong> supplier() {
                return VarLong::empty;
            }

            @Override
            public BiConsumer<VarLong, Long> accumulator() {
                return VarLong::addLong;
            }

            @Override
            public BinaryOperator<VarLong> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addLong(s.getLong()));
                    return x;
                };
            }

            @Override
            public Function<VarLong, VarLong> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<Long, VarLong, VarLong> collector() {

        return new Collector<Long, VarLong, VarLong>() {
            @Override
            public Supplier<VarLong> supplier() {
                return VarLong::empty;
            }

            @Override
            public BiConsumer<VarLong, Long> accumulator() {
                return VarLong::addLong;
            }

            @Override
            public BinaryOperator<VarLong> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addLong(s.getLong()));
                    return x;
                };
            }

            @Override
            public Function<VarLong, VarLong> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Long,VarLong,VarLong> with Collector<> in method public collector() : Collector<Long,VarLong,VarLong> from class rapaio.data.VarLong


    public static Collector<String, VarNominal, VarNominal> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarNominal> supplier() {
                return VarNominal::empty;
            }

            @Override
            public BiConsumer<VarNominal, String> accumulator() {
                return VarNominal::addLabel;
            }

            @Override
            public BinaryOperator<VarNominal> combiner() {
                return (left, right) -> (VarNominal) left.bindRows(right).copy();
            }

            @Override
            public Function<VarNominal, VarNominal> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<String, VarNominal, VarNominal> collector() {

        return new Collector<String, VarNominal, VarNominal>() {
            @Override
            public Supplier<VarNominal> supplier() {
                return VarNominal::empty;
            }

            @Override
            public BiConsumer<VarNominal, String> accumulator() {
                return VarNominal::addLabel;
            }

            @Override
            public BinaryOperator<VarNominal> combiner() {
                return (left, right) -> (VarNominal) left.bindRows(right).copy();
            }

            @Override
            public Function<VarNominal, VarNominal> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<String,VarNominal,VarNominal> with Collector<> in method public collector() : Collector<String,VarNominal,VarNominal> from class rapaio.data.VarNominal


    public static Collector<? super Integer, VarInt, VarInt> collector() {
        return new Collector<>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarInt, VarInt> finisher() {
                return VarInt::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<? super Integer, VarInt, VarInt> collector() {
        return new Collector<Integer, VarInt, VarInt>() {
            @Override
            public Supplier<VarInt> supplier() {
                return VarInt::empty;
            }

            @Override
            public BiConsumer<VarInt, Integer> accumulator() {
                return VarInt::addInt;
            }

            @Override
            public BinaryOperator<VarInt> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarInt, VarInt> finisher() {
                return VarInt::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }


    /**
     * Creates a new worker to do the image rendering in the background.
     */
    private void createBackgroundImage() {
        drawWorker = new SwingWorker<BufferedImage, Object>() {
            @Override
            protected BufferedImage doInBackground() throws Exception {
                if (figure == null) {
                    return currentImage;
                }
                return ImageUtility.buildImage(figure, getWidth(), getHeight());
            }

            @Override
            protected void done() {

                SwingUtilities.invokeLater(() -> {
                    try {
                        currentImage = get();
                        drawWorker = null;
                        revalidate();
                        repaint();
                    } catch (InterruptedException | ExecutionException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                });

            }
        };

        drawWorker.execute();
    }


    static Collector<Integer, IntList, Mapping> collector() {
        return new Collector<>() {
            @Override
            public Supplier<IntList> supplier() {
                return IntArrayList::new;
            }

            @Override
            public BiConsumer<IntList, Integer> accumulator() {
                return List::add;
            }

            @Override
            public BinaryOperator<IntList> combiner() {
                return (list1, list2) -> {
                    list1.addAll(list2);
                    return list1;
                };
            }

            @Override
            public Function<IntList, Mapping> finisher() {
                return Mapping::wrap;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    static Collector<Integer, IntList, Mapping> collector() {
        return new Collector<Integer, IntList, Mapping>() {
            @Override
            public Supplier<IntList> supplier() {
                return IntArrayList::new;
            }

            @Override
            public BiConsumer<IntList, Integer> accumulator() {
                return List::add;
            }

            @Override
            public BinaryOperator<IntList> combiner() {
                return (list1, list2) -> {
                    list1.addAll(list2);
                    return list1;
                };
            }

            @Override
            public Function<IntList, Mapping> finisher() {
                return Mapping::wrap;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Integer,IntList,Mapping> with Collector<> in method public collector() : Collector<Integer,IntList,Mapping> from class rapaio.data.Mapping


    public static Collector<String, VarNominal, VarNominal> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarNominal> supplier() {
                return VarNominal::empty;
            }

            @Override
            public BiConsumer<VarNominal, String> accumulator() {
                return VarNominal::addLabel;
            }

            @Override
            public BinaryOperator<VarNominal> combiner() {
                return (left, right) -> (VarNominal) left.bindRows(right).solidCopy();
            }

            @Override
            public Function<VarNominal, VarNominal> finisher() {
                return var -> var;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return EnumSet.of(Collector.Characteristics.CONCURRENT, Collector.Characteristics.IDENTITY_FINISH);
            }
        };
    }

    public static Collector<String, VarNominal, VarNominal> collector() {

        return new Collector<String, VarNominal, VarNominal>() {
            @Override
            public Supplier<VarNominal> supplier() {
                return VarNominal::empty;
            }

            @Override
            public BiConsumer<VarNominal, String> accumulator() {
                return FactorBase::addLabel;
            }

            @Override
            public BinaryOperator<VarNominal> combiner() {
                return (left, right) -> (VarNominal) left.bindRows(right);
            }

            @Override
            public Function<VarNominal, VarNominal> finisher() {
                return VarNominal::solidCopy;
            }

            @Override
            public Set<Collector.Characteristics> characteristics() {
                return EnumSet.of(Collector.Characteristics.CONCURRENT, Collector.Characteristics.IDENTITY_FINISH);
            }
        };
    }


    public static Collector<Double, VarFloat, VarFloat> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarFloat> supplier() {
                return SolidVarFloat::empty;
            }

            @Override
            public BiConsumer<VarFloat, Double> accumulator() {
                return VarFloat::addDouble;
            }

            @Override
            public BinaryOperator<VarFloat> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarFloat, VarFloat> finisher() {
                return VarFloat::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<Double, VarDouble, VarDouble> collector() {

        return new Collector<Double, VarDouble, VarDouble>() {
            @Override
            public Supplier<VarDouble> supplier() {
                return SolidVarDouble::empty;
            }

            @Override
            public BiConsumer<VarDouble, Double> accumulator() {
                return VarDouble::addDouble;
            }

            @Override
            public BinaryOperator<VarDouble> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarDouble, VarDouble> finisher() {
                return VarDouble::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Double,VarDouble,VarDouble> with Collector<> in method public collector() : Collector<Double,VarFloat,VarFloat> from class rapaio.data.solid.SolidVarFloat


    public static Collector<Double, VarDouble, VarDouble> collector() {

        return new Collector<>() {
            @Override
            public Supplier<VarDouble> supplier() {
                return SolidVarDouble::empty;
            }

            @Override
            public BiConsumer<VarDouble, Double> accumulator() {
                return VarDouble::addDouble;
            }

            @Override
            public BinaryOperator<VarDouble> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarDouble, VarDouble> finisher() {
                return VarDouble::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    public static Collector<Double, VarDouble, VarDouble> collector() {

        return new Collector<Double, VarDouble, VarDouble>() {
            @Override
            public Supplier<VarDouble> supplier() {
                return VarDouble::empty;
            }

            @Override
            public BiConsumer<VarDouble, Double> accumulator() {
                return VarDouble::addDouble;
            }

            @Override
            public BinaryOperator<VarDouble> combiner() {
                return (x, y) -> {
                    y.stream().forEach(s -> x.addDouble(s.getDouble()));
                    return x;
                };
            }

            @Override
            public Function<VarDouble, VarDouble> finisher() {
                return VarDouble::solidCopy;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Double,VarDouble,VarDouble> with Collector<> in method public collector() : Collector<Double,VarDouble,VarDouble> from class rapaio.data.solid.SolidVarDouble


    static Collector<Var, List<Var>, Frame> collector() {

        return new Collector<>() {
            @Override
            public Supplier<List<Var>> supplier() {
                return LinkedList::new;
            }

            @Override
            public BiConsumer<List<Var>, Var> accumulator() {
                return List::add;
            }

            @Override
            public BinaryOperator<List<Var>> combiner() {
                return (list1, list2) -> {
                    list1.addAll(list2);
                    return list1;
                };
            }

            @Override
            public Function<List<Var>, Frame> finisher() {
                return BoundFrame::byVars;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

    static Collector<Var, List<Var>, Frame> collector() {

        return new Collector<Var, List<Var>, Frame>() {
            @Override
            public Supplier<List<Var>> supplier() {
                return LinkedList::new;
            }

            @Override
            public BiConsumer<List<Var>, Var> accumulator() {
                return List::add;
            }

            @Override
            public BinaryOperator<List<Var>> combiner() {
                return (list1, list2) -> {
                    list1.addAll(list2);
                    return list1;
                };
            }

            @Override
            public Function<List<Var>, Frame> finisher() {
                return BoundFrame::byVars;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Var,List<Var>,Frame> with Collector<> in method public collector() : Collector<Var,List<Var>,Frame> from class rapaio.data.Frame