<commit_before>package com.aaomidi.dev.lilybook.engine;


import com.aaomidi.dev.lilybook.LilyBook;
import com.aaomidi.dev.lilybook.engine.objects.LilyPlayer;
import com.aaomidi.dev.lilybook.engine.objects.ProxyPlayers;
import com.aaomidi.dev.lilybook.engine.objects.ProxyStaff;
import com.google.common.collect.MapMaker;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Pattern;

public class Caching {
    @Getter
    private static ConcurrentMap<String, ProxyPlayers> networkPlayersMap;
    @Getter
    private static ConcurrentMap<String, ProxyStaff> networkStaffMap;
    @Getter
    private static ConcurrentMap<String, LilyPlayer> lilyPlayersMap;
    private static Pattern pattern;
    private final LilyBook instance;

    public Caching(LilyBook instance) {
        this.instance = instance;
        this.init();
    }

    public static void proxyPlayersManagement(String message, String sender) {
        String[] messageArray = pattern.split(message);
        ArrayList<String> players = new ArrayList<>(Arrays.asList(messageArray));
        Character action = players.get(0).charAt(0);
        players.remove(0);
        switch (action) {
            case '+':
                if (players.size() > 0) {
                    if (!networkPlayersMap.containsKey(sender)) {
                        networkPlayersMap.put(sender, new ProxyPlayers(sender));
                    }
                    ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                    for (String playerName : players) {
                        proxyPlayers.addPlayer(playerName);
                    }
                    return;
                }
            case '-':
                if (players.size() > 0) {
                    if (!networkPlayersMap.containsKey(sender)) {
                        networkPlayersMap.put(sender, new ProxyPlayers(sender));
                    }
                    ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                    for (String playerName : players) {
                        proxyPlayers.removePlayer(playerName);
                    }
                    return;
                }
            case '!':
                if (!networkPlayersMap.containsKey(sender)) {
                    networkPlayersMap.put(sender, new ProxyPlayers(sender));
                }
                ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                proxyPlayers.resetPlayers();
                if (players.size() > 0) {
                    for (String playerName : players) {
                        proxyPlayers.addPlayer(playerName);
                    }
                    // return;
                }
        }
    }

    public static void proxyStaffManagement(String message, String sender) {
        String[] messageArray = pattern.split(message);
        ArrayList<String> players = new ArrayList<>(Arrays.asList(messageArray));
        Character action = players.get(0).charAt(0);
        players.remove(0);
        switch (action) {
            case '+':
                if (players.size() > 0) {
                    if (!networkStaffMap.containsKey(sender)) {
                        networkStaffMap.put(sender, new ProxyStaff(sender));
                    }
                    ProxyStaff proxyStaff = networkStaffMap.get(sender);
                    for (String playerName : players) {
                        proxyStaff.addStaff(playerName);
                    }
                }
            case '-':
                if (players.size() > 0) {

                    if (!networkStaffMap.containsKey(sender)) {
                        networkStaffMap.put(sender, new ProxyStaff(sender));
                    }
                    ProxyStaff proxyStaff = networkStaffMap.get(sender);
                    for (String playerName : players) {
                        proxyStaff.removeStaff(playerName);
                    }
                }
            case '!':
                if (!networkStaffMap.containsKey(sender)) {
                    networkStaffMap.put(sender, new ProxyStaff(sender));
                }
                ProxyStaff proxyStaff = networkStaffMap.get(sender);
                proxyStaff.resetStaff();
                if (players.size() > 0) {
                    for (String playerName : players) {
                        proxyStaff.addStaff(playerName);
                    }
                }

        }
    }

    public void init() {
        networkPlayersMap = new MapMaker().concurrencyLevel(3).makeMap();
        networkStaffMap = new MapMaker().concurrencyLevel(3).makeMap();
        lilyPlayersMap = new MapMaker().concurrencyLevel(3).makeMap();
        pattern = Pattern.compile(":");
    }

    public void cleanUp(String playerName) {
        lilyPlayersMap.remove(playerName);
    }

}<commit_msg>Thanks @DarkSeraphim for pointing this out.<commit_after>package com.aaomidi.dev.lilybook.engine;


import com.aaomidi.dev.lilybook.LilyBook;
import com.aaomidi.dev.lilybook.engine.objects.LilyPlayer;
import com.aaomidi.dev.lilybook.engine.objects.ProxyPlayers;
import com.aaomidi.dev.lilybook.engine.objects.ProxyStaff;
import com.google.common.collect.MapMaker;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentMap;

public class Caching {
    @Getter
    private static ConcurrentMap<String, ProxyPlayers> networkPlayersMap;
    @Getter
    private static ConcurrentMap<String, ProxyStaff> networkStaffMap;
    @Getter
    private static ConcurrentMap<String, LilyPlayer> lilyPlayersMap;
    private final LilyBook instance;

    public Caching(LilyBook instance) {
        this.instance = instance;
        this.init();
    }

    public static void proxyPlayersManagement(String message, String sender) {
        String[] messageArray = message.split(":");
        ArrayList<String> players = new ArrayList<>(Arrays.asList(messageArray));
        Character action = players.get(0).charAt(0);
        players.remove(0);
        switch (action) {
            case '+':
                if (players.size() > 0) {
                    if (!networkPlayersMap.containsKey(sender)) {
                        networkPlayersMap.put(sender, new ProxyPlayers(sender));
                    }
                    ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                    for (String playerName : players) {
                        proxyPlayers.addPlayer(playerName);
                    }
                    return;
                }
            case '-':
                if (players.size() > 0) {
                    if (!networkPlayersMap.containsKey(sender)) {
                        networkPlayersMap.put(sender, new ProxyPlayers(sender));
                    }
                    ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                    for (String playerName : players) {
                        proxyPlayers.removePlayer(playerName);
                    }
                    return;
                }
            case '!':
                if (!networkPlayersMap.containsKey(sender)) {
                    networkPlayersMap.put(sender, new ProxyPlayers(sender));
                }
                ProxyPlayers proxyPlayers = networkPlayersMap.get(sender);
                proxyPlayers.resetPlayers();
                if (players.size() > 0) {
                    for (String playerName : players) {
                        proxyPlayers.addPlayer(playerName);
                    }
                    // return;
                }
        }
    }

    public static void proxyStaffManagement(String message, String sender) {
        String[] messageArray = message.split(":");
        ArrayList<String> players = new ArrayList<>(Arrays.asList(messageArray));
        Character action = players.get(0).charAt(0);
        players.remove(0);
        switch (action) {
            case '+':
                if (players.size() > 0) {
                    if (!networkStaffMap.containsKey(sender)) {
                        networkStaffMap.put(sender, new ProxyStaff(sender));
                    }
                    ProxyStaff proxyStaff = networkStaffMap.get(sender);
                    for (String playerName : players) {
                        proxyStaff.addStaff(playerName);
                    }
                }
            case '-':
                if (players.size() > 0) {

                    if (!networkStaffMap.containsKey(sender)) {
                        networkStaffMap.put(sender, new ProxyStaff(sender));
                    }
                    ProxyStaff proxyStaff = networkStaffMap.get(sender);
                    for (String playerName : players) {
                        proxyStaff.removeStaff(playerName);
                    }
                }
            case '!':
                if (!networkStaffMap.containsKey(sender)) {
                    networkStaffMap.put(sender, new ProxyStaff(sender));
                }
                ProxyStaff proxyStaff = networkStaffMap.get(sender);
                proxyStaff.resetStaff();
                if (players.size() > 0) {
                    for (String playerName : players) {
                        proxyStaff.addStaff(playerName);
                    }
                }

        }
    }

    public void init() {
        networkPlayersMap = new MapMaker().concurrencyLevel(3).makeMap();
        networkStaffMap = new MapMaker().concurrencyLevel(3).makeMap();
        lilyPlayersMap = new MapMaker().concurrencyLevel(3).makeMap();
    }

    public void cleanUp(String playerName) {
        lilyPlayersMap.remove(playerName);
    }

}
{'fraction_non_alphanumeric': 0.09648581997533909, 'fraction_numerical': 0.0030826140567200987, 'mean_word_length': 1.636240520043337, 'pattern_counts': {'":': 3, '<': 17, '<?xml version=': 0, '>': 29, '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': '934549', 'n_tokens_mistral': 2601, 'n_tokens_neox': 2335, 'n_words': 443}