mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 05:42:23 +00:00
Revert lots of multithreading for better threaded saving and data synchronization
This commit is contained in:
1 parent
6f1914c002
commit
49fab85291
6 files changed
+19
-20
No files matched your search
@@ -15,7 +15,7 @@ import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
import noppes.npcs.util.CustomNPCsThreader;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -100,7 +100,7 @@ public class BankData {
|
||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.PlayerBankSmall, npc, slot, bank.id, 0);
|
||||
}
|
||||
final ItemStack item = currency;
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
CustomNPCsThreader.runTack(() -> {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("MaxSlots", bank.getMaxSlots());
|
||||
compound.setInteger("UnlockedSlots", unlockedSlots);
|
||||
|
||||
@@ -19,12 +19,14 @@ import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.util.CustomNPCsScheduler;
|
||||
import noppes.npcs.util.CustomNPCsThreader;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import static noppes.npcs.util.CustomNPCsThreader.playerDataThread;
|
||||
|
||||
public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public PlayerDialogData dialogData = new PlayerDialogData(this);
|
||||
public PlayerBankData bankData = new PlayerBankData(this);
|
||||
@@ -302,8 +304,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public synchronized void save() {
|
||||
final NBTTagCompound compound = getNBT();
|
||||
final String filename = uuid + ".json";
|
||||
|
||||
CustomNPCsScheduler.runTack(() -> {
|
||||
playerDataThread.execute(() -> {
|
||||
try {
|
||||
File saveDir = PlayerDataController.instance.getSaveDir();
|
||||
File file = new File(saveDir, filename + "_new");
|
||||
@@ -316,8 +317,7 @@ public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
|
||||
PlayerDataController.instance.putPlayerMap(playername, uuid);
|
||||
});
|
||||
PlayerDataController.instance.putPlayerMap(playername, uuid);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user