Fix cache image task from last commit and make it work with reloading

This commit is contained in:
Camotoy 2022-01-31 09:57:43 -05:00
parent 36afd3f2ec
commit 7853e8c93f
No known key found for this signature in database
GPG Key ID: 7EEFB66FE798081F
2 changed files with 6 additions and 7 deletions

View File

@ -154,7 +154,6 @@ public class GeyserImpl implements GeyserApi {
ItemTranslator.init(); ItemTranslator.init();
MessageTranslator.init(); MessageTranslator.init();
MinecraftLocale.init(); MinecraftLocale.init();
SkinProvider.init();
start(); start();
@ -197,6 +196,8 @@ public class GeyserImpl implements GeyserApi {
ScoreboardUpdater.init(); ScoreboardUpdater.init();
SkinProvider.registerCacheImageTask(this);
ResourcePack.loadPacks(); ResourcePack.loadPacks();
if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) { if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) {

View File

@ -115,10 +115,12 @@ public class SkinProvider {
WEARING_CUSTOM_SKULL = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkull\"}}", wearingCustomSkull, false); WEARING_CUSTOM_SKULL = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkull\"}}", wearingCustomSkull, false);
String wearingCustomSkullSlim = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json"), StandardCharsets.UTF_8); String wearingCustomSkullSlim = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json"), StandardCharsets.UTF_8);
WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false); WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false);
}
public static void registerCacheImageTask(GeyserImpl geyser) {
// Schedule Daily Image Expiry if we are caching them // Schedule Daily Image Expiry if we are caching them
if (GeyserImpl.getInstance().getConfig().getCacheImages() > 0) { if (geyser.getConfig().getCacheImages() > 0) {
GeyserImpl.getInstance().getScheduledThread().scheduleAtFixedRate(() -> { geyser.getScheduledThread().scheduleAtFixedRate(() -> {
File cacheFolder = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").toFile(); File cacheFolder = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").toFile();
if (!cacheFolder.exists()) { if (!cacheFolder.exists()) {
return; return;
@ -819,8 +821,4 @@ public class SkinProvider {
}; };
} }
} }
public static void init() {
// no-op
}
} }