9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-06 15:51:31 +00:00

optimize chunk map (#438)

* rebase

* optimize LivingEntity#travel

* cleanup

* Replace fluid height map

* reuse array list in Entity#collide

* cleanup

* fix fire and liquid collision shape

* fix checkInside

* inline betweenClosed

* cleanup

* optimize getOnPos

* optimize equals in getOnPos

* update mainSupportingBlockPos on dirty

* cleanup

* rename

* merge same patch

* rebase and remove properly

* [ci skip] cleanup

* rebase and rebuild

* fix async locator

* remove async locator

* cleanup

* rebase

---------

Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
This commit is contained in:
hayanesuru
2025-08-20 03:48:26 +09:00
committed by GitHub
parent 55de442b70
commit 23b7b02eee
163 changed files with 2158 additions and 146 deletions

View File

@@ -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 f967560da343867fdc1c380a42874b0796633777..3b516f57854f6482b3748d0c3a037fdeacfe78ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -200,7 +200,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
private CompoundTag getData() {
// This method does not use the problem reporter
- return this.storage.load(this.profile.getName(), this.profile.getId().toString(), ProblemReporter.DISCARDING).orElse(null);
+ return this.storage.load(this.profile.getName(), this.profile.getId().toString(), this.profile.getId(), ProblemReporter.DISCARDING).orElse(null); // Leaf - Async playerdata saving
}
private CompoundTag getBukkitData() {
@@ -750,16 +750,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
}