mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
Remove Static from CachedPlayerData so it doesnt cross through worlds
This commit is contained in:
1 parent
3dc99dcf2c
commit
d545e4ba89
2 files changed
+5
-5
No files matched your search
@@ -30,8 +30,8 @@ import static noppes.npcs.util.CustomNPCsThreader.playerDataThread;
|
||||
|
||||
public class PlayerDataController {
|
||||
public static PlayerDataController instance;
|
||||
public static HashMap<String, String> nameUUIDs;
|
||||
private static final CacheHashMap<String, CacheHashMap.CachedObject<PlayerData>> playerDataCache = new CacheHashMap<>(60 * 60 * 1000);
|
||||
public HashMap<String, String> nameUUIDs;
|
||||
private final CacheHashMap<String, CacheHashMap.CachedObject<PlayerData>> playerDataCache = new CacheHashMap<>(60 * 60 * 1000);
|
||||
|
||||
public PlayerDataController(){
|
||||
instance = this;
|
||||
@@ -249,13 +249,13 @@ public class PlayerDataController {
|
||||
return new NBTTagCompound();
|
||||
}
|
||||
|
||||
public static void putPlayerDataCache(final String uuid, final PlayerData playerCompound) {
|
||||
public void putPlayerDataCache(final String uuid, final PlayerData playerCompound) {
|
||||
synchronized (playerDataCache) {
|
||||
playerDataCache.put(uuid, new CacheHashMap.CachedObject<>(playerCompound));
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayerData getPlayerDataCache(final String uuid) {
|
||||
public PlayerData getPlayerDataCache(final String uuid) {
|
||||
synchronized (playerDataCache) {
|
||||
if (!playerDataCache.containsKey(uuid)) {
|
||||
return null;
|
||||
|
||||
@@ -220,7 +220,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
filename = uuid + ".json";
|
||||
}
|
||||
PlayerDataController.instance.putPlayerMap(playername, uuid);
|
||||
PlayerDataController.putPlayerDataCache(uuid, this);
|
||||
PlayerDataController.instance.putPlayerDataCache(uuid, this);
|
||||
CustomNPCsThreader.playerDataThread.execute(() -> {
|
||||
try {
|
||||
File saveDir = PlayerDataController.instance.getSaveDir();
|
||||
|
||||
Reference in new issue
Block a user