mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 08:29:28 +00:00
Readd Leaves protocols
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hayanesuru <mc@jvavav.com>
|
||||
Date: Fri, 28 Mar 2025 21:19:19 +0800
|
||||
Subject: [PATCH] Async playerdata saving
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
index ecd9e392e9e026cbeac4c65bfdb7467f971ca92d..ce27ab19b3b2bc4f5de7b5f6b13f3f5786a61f84 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -196,7 +196,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
}
|
||||
|
||||
private CompoundTag getData() {
|
||||
- return this.storage.load(this.profile.getName(), this.profile.getId().toString()).orElse(null);
|
||||
+ return this.storage.load(this.profile.getName(), this.profile.getId().toString(), this.profile.getId()).orElse(null); // Leaf - Async playerdata saving
|
||||
}
|
||||
|
||||
private CompoundTag getBukkitData() {
|
||||
@@ -746,16 +746,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
* @param compoundTag
|
||||
*/
|
||||
private void save(CompoundTag compoundTag) {
|
||||
- File playerDir = server.console.playerDataStorage.getPlayerDir();
|
||||
- try {
|
||||
- File tempFile = File.createTempFile(this.getUniqueId()+"-", ".dat", playerDir);
|
||||
- net.minecraft.nbt.NbtIo.writeCompressed(compoundTag, tempFile.toPath());
|
||||
- File playerDataFile = new File(playerDir, this.getUniqueId()+".dat");
|
||||
- File playerDataFileOld = new File(playerDir, this.getUniqueId()+".dat_old");
|
||||
- net.minecraft.Util.safeReplaceFile(playerDataFile.toPath(), tempFile.toPath(), playerDataFileOld.toPath());
|
||||
- } catch (java.io.IOException e) {
|
||||
- e.printStackTrace();
|
||||
- }
|
||||
+ server.console.playerDataStorage.save(this.getName(), this.getUniqueId(), this.getUniqueId().toString(), compoundTag); // Leaf - Async playerdata saving
|
||||
}
|
||||
// Purpur end - OfflinePlayer API
|
||||
}
|
||||
Reference in New Issue
Block a user