diff --git a/src/main/java/de/oliver/fancynpcs/skins/cache/SkinCacheFile.java b/src/main/java/de/oliver/fancynpcs/skins/cache/SkinCacheFile.java index 056526ed..d8fed793 100644 --- a/src/main/java/de/oliver/fancynpcs/skins/cache/SkinCacheFile.java +++ b/src/main/java/de/oliver/fancynpcs/skins/cache/SkinCacheFile.java @@ -5,6 +5,7 @@ import de.oliver.fancynpcs.api.skins.SkinData; import java.io.IOException; +import java.util.Base64; public class SkinCacheFile implements SkinCache { @@ -16,9 +17,11 @@ public SkinCacheFile() { @Override public SkinCacheData getSkin(String identifier) { + String b64ID = Base64.getEncoder().encodeToString(identifier.getBytes()); + SkinCacheData skinCacheData = null; try { - skinCacheData = this.storage.get("skins/" + identifier, SkinCacheData.class); + skinCacheData = this.storage.get("skins/" + b64ID, SkinCacheData.class); } catch (IOException e) { FancyNpcs.getInstance().getFancyLogger().error("Failed to load skin cache"); FancyNpcs.getInstance().getFancyLogger().error(e); @@ -29,7 +32,7 @@ public SkinCacheData getSkin(String identifier) { } if (skinCacheData.isExpired()) { - this.storage.delete("skins/" + identifier); + this.storage.delete("skins/" + b64ID); return null; } @@ -41,7 +44,8 @@ public void addSkin(SkinData skin) { SkinCacheData skinCacheData = new SkinCacheData(skin, System.currentTimeMillis(), CACHE_TIME); try { - this.storage.set("skins/" + skin.getIdentifier(), skinCacheData); + String b64ID = Base64.getEncoder().encodeToString(skin.getIdentifier().getBytes()); + this.storage.set("skins/" + b64ID, skinCacheData); } catch (IOException e) { FancyNpcs.getInstance().getFancyLogger().error("Failed to save skin cache"); FancyNpcs.getInstance().getFancyLogger().error(e); @@ -50,6 +54,7 @@ public void addSkin(SkinData skin) { @Override public void removeSkin(String identifier) { - this.storage.delete("skins/" + identifier); + String b64ID = Base64.getEncoder().encodeToString(identifier.getBytes()); + this.storage.delete("skins/" + b64ID); } }