Cache Life Config

This commit is contained in:
Kam committed 2023-06-03 17:23:40 -04:00
1 parent b21e79b5bb
commit 4f101f05a8
2 files changed
+14 -1

No files matched your search

@@ -2,10 +2,11 @@ package noppes.npcs.client;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.renderer.ImageData;
import noppes.npcs.config.ConfigClient;
import noppes.npcs.util.CacheHashMap;
public class ClientCacheHandler {
private static final CacheHashMap<String, CacheHashMap.CachedObject<ImageData>> imageDataCache = new CacheHashMap<>(10*60*1000);
private static final CacheHashMap<String, CacheHashMap.CachedObject<ImageData>> imageDataCache = new CacheHashMap<>((long) ConfigClient.CacheLife * 60 * 1000);
public static ImageData getImageData(String directory) {
synchronized (imageDataCache) {
@@ -13,9 +13,17 @@ public class ConfigClient
{
public static Configuration config;
public final static String GENERAL = "General";
public final static String VISUAL = "Visual";
public final static String QUESTING = "Questing";
/**
* General Properties
**/
public static Property CacheLifeProperty;
public static int CacheLife = 10;
/**
* Visual Properties
**/
@@ -51,6 +59,10 @@ public class ConfigClient
{
config.load();
// General
CacheLifeProperty = config.get(GENERAL, "Cache Life", 10, "How long should downloaded imagery data be saved client side? (In minutes)");
CacheLife = CacheLifeProperty.getInt(10);
// Visual
EnableChatBubblesProperty = config.get(VISUAL, "Enable Chat Bubbles", true, "Enable/Disable Chat Bubbles");
EnableChatBubbles = EnableChatBubblesProperty.getBoolean(true);