From d3a93bfb5edb3b075b56971f59ff391e5d110797 Mon Sep 17 00:00:00 2001 From: Pilad Date: Tue, 7 May 2024 15:39:28 +0500 Subject: [PATCH] The file is not called anywhere? This file doesn't seem to be used anywhere. Maybe it's worth removing? --- .../gtPlusPlus/core/common/CommonProxy.java | 3 - .../core/util/player/PlayerCache.java | 66 ------------------- 2 files changed, 69 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/core/util/player/PlayerCache.java diff --git a/src/main/java/gtPlusPlus/core/common/CommonProxy.java b/src/main/java/gtPlusPlus/core/common/CommonProxy.java index ab7090351b..70062a5f00 100644 --- a/src/main/java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/main/java/gtPlusPlus/core/common/CommonProxy.java @@ -36,7 +36,6 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.player.PlayerCache; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; @@ -101,8 +100,6 @@ public void init(final FMLInitializationEvent e) { } public void postInit(final FMLPostInitializationEvent e) { - Logger.INFO("Cleaning up, doing postInit."); - PlayerCache.initCache(); // Make Burnables burnable if (!CORE.burnables.isEmpty()) { diff --git a/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java b/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java deleted file mode 100644 index a403756c77..0000000000 --- a/src/main/java/gtPlusPlus/core/util/player/PlayerCache.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.core.util.player; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Properties; -import java.util.UUID; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; - -public class PlayerCache { - - private static final File cache = new File("PlayerCache.dat"); - - public static void initCache() { - if (CORE.PlayerCache == null) { - if (cache.exists()) { - CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap(); - Logger.INFO("Loaded PlayerCache.dat"); - } - if (CORE.PlayerCache == null) { - Logger.INFO("Failed to load PlayerCache.dat"); - PlayerCache.createPropertiesFile("PLAYER_", "DATA"); - } - } - } - - public static void createPropertiesFile(final String playerName, final String playerUUIDasString) { - try { - final Properties props = new Properties(); - props.setProperty(playerName + " ", playerUUIDasString); - final OutputStream out = new FileOutputStream(cache); - props.store(out, "Player Cache."); - Logger.INFO("PlayerCache.dat created for future use."); - out.close(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - - public static HashMap readPropertiesFileAsMap() { - HashMap map = null; - try { - final FileInputStream fis = new FileInputStream(cache); - final ObjectInputStream ois = new ObjectInputStream(fis); - map = (HashMap) ois.readObject(); - ois.close(); - fis.close(); - } catch (final IOException ioe) { - ioe.printStackTrace(); - return null; - } catch (final ClassNotFoundException c) { - Logger.INFO("Class not found"); - c.printStackTrace(); - return null; - } - Logger.WARNING("Deserialized PlayerCache.."); - return map; - } - -}