From 1b446698398c648b38311975a6cfd54859ea5cfe Mon Sep 17 00:00:00 2001 From: Cow Date: Sun, 5 Jul 2020 05:42:45 +0200 Subject: Renamed mod to Cowlection Bumped version to 1.8.9-0.7.0 --- .../olli/cowmoonication/handler/PlayerCache.java | 47 ---------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/main/java/eu/olli/cowmoonication/handler/PlayerCache.java (limited to 'src/main/java/eu/olli/cowmoonication/handler/PlayerCache.java') diff --git a/src/main/java/eu/olli/cowmoonication/handler/PlayerCache.java b/src/main/java/eu/olli/cowmoonication/handler/PlayerCache.java deleted file mode 100644 index fd1062d..0000000 --- a/src/main/java/eu/olli/cowmoonication/handler/PlayerCache.java +++ /dev/null @@ -1,47 +0,0 @@ -package eu.olli.cowmoonication.handler; - -import com.google.common.collect.EvictingQueue; -import eu.olli.cowmoonication.Cowmoonication; - -import java.util.SortedSet; -import java.util.TreeSet; - -public class PlayerCache { - @SuppressWarnings("UnstableApiUsage") - private final EvictingQueue nameCache = EvictingQueue.create(50); - @SuppressWarnings("UnstableApiUsage") - private final EvictingQueue bestFriendCache = EvictingQueue.create(50); - private final Cowmoonication main; - - public PlayerCache(Cowmoonication main) { - this.main = main; - } - - public void add(String name) { - // remove old entry (if exists) to 'push' name to the end of the queue - nameCache.remove(name); - nameCache.add(name); - } - - public void addBestFriend(String name) { - // remove old entry (if exists) to 'push' name to the end of the queue - bestFriendCache.remove(name); - bestFriendCache.add(name); - } - - public void removeBestFriend(String name) { - bestFriendCache.remove(name); - } - - public SortedSet getAllNamesSorted() { - SortedSet nameList = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); - nameList.addAll(bestFriendCache); - nameList.addAll(nameCache); - return nameList; - } - - public void clearAllCaches() { - nameCache.clear(); - bestFriendCache.clear(); - } -} -- cgit