<commit_before>package protocolsupport.protocol.storage;

import java.net.InetAddress;
import java.util.concurrent.TimeUnit;

import org.bukkit.Bukkit;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import protocolsupport.utils.Utils;

public class ThrottleTracker {

	private static final long time = Bukkit.getConnectionThrottle();

	private static final Cache<InetAddress, Boolean> tracker = CacheBuilder.newBuilder()
	.concurrencyLevel(Utils.getRawJavaPropertyValue("io.netty.eventLoopThreads", Runtime.getRuntime().availableProcessors(), Utils.Converter.STRING_TO_INT))
	.expireAfterWrite(time, TimeUnit.MILLISECONDS)
	.build();

	public static boolean isEnabled() {
		return time > 0;
	}

	public static boolean throttle(InetAddress address) {
		boolean result = tracker.getIfPresent(address) != null;
		tracker.put(address, Boolean.TRUE);
		return result;
	}

}
<commit_msg>Fix throttle tracker<commit_after>package protocolsupport.protocol.storage;

import java.net.InetAddress;
import java.util.concurrent.TimeUnit;

import org.bukkit.Bukkit;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import protocolsupport.utils.Utils;

public class ThrottleTracker {

	private static final long time = Bukkit.getConnectionThrottle();

	private static final Cache<InetAddress, Boolean> tracker = CacheBuilder.newBuilder()
	.concurrencyLevel(Utils.getRawJavaPropertyValue("io.netty.eventLoopThreads", Runtime.getRuntime().availableProcessors(), Utils.Converter.STRING_TO_INT))
	.expireAfterWrite(time > 0 ? time : 1, TimeUnit.MILLISECONDS)
	.build();

	public static boolean isEnabled() {
		return time > 0;
	}

	public static boolean throttle(InetAddress address) {
		boolean result = tracker.getIfPresent(address) != null;
		tracker.put(address, Boolean.TRUE);
		return result;
	}

}

{'fraction_non_alphanumeric': 0.10483870967741936, 'fraction_numerical': 0.002150537634408602, 'mean_word_length': 5.9700374531835205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5898096', 'n_tokens_mistral': 596, 'n_tokens_neox': 570, 'n_words': 117}