Yatopia/patches/server/0010-Player-saving-async-FileIO.patch

211 lines
10 KiB
Diff
Raw Normal View History

2020-07-17 18:05:50 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2020-06-27 17:50:15 +02:00
From: tr7zw <tr7zw@live.de>
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
Date: Fri, 31 Jul 2020 22:39:45 -0500
Subject: [PATCH] Player-saving-async-FileIO
2020-06-27 17:50:15 +02:00
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
2020-08-28 11:00:07 +02:00
index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..20b97d1e68132a9f1b62dece5c26da80e67347b7 100644
2020-06-27 17:50:15 +02:00
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -50,6 +50,7 @@ public class AdvancementDataPlayer {
2020-06-27 17:50:15 +02:00
@Nullable
private Advancement l;
private boolean m = true;
+ public static java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia
2020-06-27 17:50:15 +02:00
2020-07-25 17:16:49 +02:00
// Paper start - fix advancement data player leakage
2020-07-16 22:05:14 +02:00
final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap();
@@ -228,6 +229,15 @@ public class AdvancementDataPlayer {
2020-06-27 17:50:15 +02:00
jsonelement.getAsJsonObject().addProperty("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
+ // Yatopia start - replace whole logic
2020-08-28 11:00:07 +02:00
+ saveThread.execute(() -> {
+ try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), Charsets.UTF_8.newEncoder())) {
+ AdvancementDataPlayer.b.toJson(jsonelement, writer);
+ } catch (Throwable e) {
+ AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, e);
+ }
+ });
+ /*
2020-06-27 17:50:15 +02:00
try {
FileOutputStream fileoutputstream = new FileOutputStream(this.f);
Throwable throwable = null;
@@ -275,7 +285,7 @@ public class AdvancementDataPlayer {
} catch (IOException ioexception) {
AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception);
2020-06-27 17:50:15 +02:00
}
-
+ */ // Yatopia end
2020-06-27 17:50:15 +02:00
}
public boolean grantCriteria(Advancement advancement, String s) {
2020-06-27 17:50:15 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index ce4ebc96c01f3dacf4e4d0569d86f52140440d43..a52c0391b171c8a57de75f87c534ce1e0e78c44a 100644
2020-06-27 17:50:15 +02:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -700,11 +700,20 @@ public abstract class EntityHuman extends EntityLiving {
2020-06-27 17:50:15 +02:00
}
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+ // Yatopia start
2020-06-27 17:50:15 +02:00
+ private NBTTagList inventorySnapshot = null;
+ private NBTTagList enderchestSnapshot = null;
+ public void takeSnapshot() {
+ inventorySnapshot = this.inventory.a(new NBTTagList());
+ enderchestSnapshot = this.enderChest.g();
2020-06-27 17:50:15 +02:00
+ }
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+ // Yatopia end
+
2020-06-27 17:50:15 +02:00
@Override
public void saveData(NBTTagCompound nbttagcompound) {
super.saveData(nbttagcompound);
nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
- nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
+ nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null; // Yatopia
2020-06-27 17:50:15 +02:00
nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex);
nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
nbttagcompound.setFloat("XpP", this.exp);
@@ -714,7 +723,7 @@ public abstract class EntityHuman extends EntityLiving {
2020-06-27 17:50:15 +02:00
nbttagcompound.setInt("Score", this.getScore());
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
- nbttagcompound.set("EnderItems", this.enderChest.g());
+ nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.g()); enderchestSnapshot = null; // Yatopia
2020-06-27 17:50:15 +02:00
if (!this.getShoulderEntityLeft().isEmpty()) {
nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft());
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
2020-08-31 11:24:45 +02:00
index 334fd6fe58f53ad8989ac4ddf523b156a8dd264d..8bec2ac5e78f28e879db69e1673b0cd90f5abc31 100644
2020-06-27 17:50:15 +02:00
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
2020-08-31 11:24:45 +02:00
@@ -1283,6 +1283,28 @@ public abstract class PlayerList {
2020-06-27 17:50:15 +02:00
if (team != null) scoreboard.removeTeam(team);
}
// Paper end
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+
+ // Yatopia start - make sure all saves are done
2020-06-27 17:50:15 +02:00
+ try {
+ playerFileData.saveThread.shutdown();
+ boolean done = playerFileData.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) {
+ LOGGER.error("Players did not save completely!");
+ }
+ ServerStatisticManager.saveThread.shutdown();
+ done = ServerStatisticManager.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) {
+ LOGGER.error("Stats did not save completely!");
+ }
+ AdvancementDataPlayer.saveThread.shutdown();
+ done = AdvancementDataPlayer.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) {
+ LOGGER.error("Advancements did not save completely!");
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+ // Yatopia end
2020-06-27 17:50:15 +02:00
}
// Paper end
2020-08-31 11:24:45 +02:00
@@ -1320,13 +1342,13 @@ public abstract class PlayerList {
2020-06-27 17:50:15 +02:00
File file = this.server.a(SavedFile.STATS).toFile();
File file1 = new File(file, uuid + ".json");
- if (!file1.exists()) {
+ /*if (!file1.exists()) { // Yatopia - don't check for old stats files with sync file IO
2020-06-27 17:50:15 +02:00
File file2 = new File(file, displayName + ".json"); // CraftBukkit
if (file2.exists() && file2.isFile()) {
file2.renameTo(file1);
}
- }
+ }*/ // Yatopia
2020-06-27 17:50:15 +02:00
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
// this.o.put(uuid, serverstatisticmanager); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
2020-08-28 11:00:07 +02:00
index 3c3b87e37cbf69c223da007e8b7eb646ec83691e..ef20b3e43eb9598e79ee3ded40f50ae0cc100872 100644
2020-06-27 17:50:15 +02:00
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
@@ -30,6 +30,7 @@ public class ServerStatisticManager extends StatisticManager {
2020-06-27 17:50:15 +02:00
private final File d;
private final Set<Statistic<?>> e = Sets.newHashSet();
private int f = -300;
+ public static java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia
2020-06-27 17:50:15 +02:00
public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
this.c = minecraftserver;
@@ -41,6 +42,7 @@ public class ServerStatisticManager extends StatisticManager {
2020-06-27 17:50:15 +02:00
this.a.put( wrapper, entry.getValue().intValue() );
}
// Spigot end
2020-08-28 11:00:07 +02:00
+ saveThread.execute(() -> { // Yatopia
2020-06-27 17:50:15 +02:00
if (file.isFile()) {
try {
this.a(minecraftserver.getDataFixer(), org.apache.commons.io.FileUtils.readFileToString(file));
@@ -50,17 +52,20 @@ public class ServerStatisticManager extends StatisticManager {
2020-06-27 17:50:15 +02:00
ServerStatisticManager.LOGGER.error("Couldn't parse statistics file {}", file, jsonparseexception);
}
}
-
+ }); // Yatopia
2020-06-27 17:50:15 +02:00
}
public void save() {
if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+ // Yatopia start
2020-06-27 17:50:15 +02:00
+ String str = this.b();
2020-08-28 11:00:07 +02:00
+ saveThread.execute(() -> {
2020-06-27 17:50:15 +02:00
try {
- org.apache.commons.io.FileUtils.writeStringToFile(this.d, this.b());
+ org.apache.commons.io.FileUtils.writeStringToFile(this.d, str);
} catch (IOException ioexception) {
ServerStatisticManager.LOGGER.error("Couldn't save stats", ioexception);
}
-
+ }); // Yatopia end
2020-06-27 17:50:15 +02:00
}
@Override
@@ -111,7 +116,7 @@ public class ServerStatisticManager extends StatisticManager {
2020-06-27 17:50:15 +02:00
if (nbttagcompound2.hasKeyOfType(s2, 99)) {
SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> {
- this.a.put(statistic, nbttagcompound2.getInt(s2));
+ this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // Yatopia
2020-06-27 17:50:15 +02:00
}, () -> {
ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2);
});
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
2020-08-28 11:00:07 +02:00
index a959672f5857b987001252c3fd7ace9e83e07c9b..d8969f7f5244548452e5d12325e6fa735ecd3a00 100644
2020-06-27 17:50:15 +02:00
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -17,6 +17,7 @@ public class WorldNBTStorage {
2020-06-27 17:50:15 +02:00
private static final Logger LOGGER = LogManager.getLogger();
private final File playerDir;
protected final DataFixer a;
+ public java.util.concurrent.ExecutorService saveThread = java.util.concurrent.Executors.newSingleThreadExecutor(); // Yatopia
2020-06-27 17:50:15 +02:00
public WorldNBTStorage(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer) {
this.a = datafixer;
@@ -26,6 +27,8 @@ public class WorldNBTStorage {
2020-06-27 17:50:15 +02:00
public void save(EntityHuman entityhuman) {
if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
+ entityhuman.takeSnapshot(); // Yatopia
2020-08-28 11:00:07 +02:00
+ saveThread.execute(() -> { // Yatopia
2020-06-27 17:50:15 +02:00
try {
NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir);
@@ -38,7 +41,7 @@ public class WorldNBTStorage {
2020-06-27 17:50:15 +02:00
} catch (Exception exception) {
WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
}
-
+ }); // Yatopia
}
@Nullable