mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-05 10:23:15 +01:00
37 lines
1.8 KiB
Diff
37 lines
1.8 KiB
Diff
From cc2837fdaeed0fca50be843b79f967c30d054d77 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
|
<tsao-chi@the-lingo.org>
|
|
Date: Thu, 2 Apr 2020 11:29:08 +0800
|
|
Subject: [PATCH] Akarin Avoid double I/O operation on load player file
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/WorldNBTStorage.java | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
index 9517fb046..c18224691 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
@@ -64,7 +64,8 @@ public class WorldNBTStorage {
|
|
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
|
// Spigot Start
|
|
boolean usingWrongFile = false;
|
|
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
|
|
+ boolean normalFile = file.exists() && file.isFile(); // Akarin - ensures normal file
|
|
+ if ( org.bukkit.Bukkit.getOnlineMode() && !normalFile ) // Paper - Check online mode first // Akarin - ensures normal file
|
|
{
|
|
file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
|
if ( file.exists() )
|
|
@@ -75,7 +76,7 @@ public class WorldNBTStorage {
|
|
}
|
|
// Spigot End
|
|
|
|
- if (file.exists() && file.isFile()) {
|
|
+ if (normalFile) { // Akarin - avoid double I/O operation
|
|
nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file)));
|
|
}
|
|
// Spigot Start
|
|
--
|
|
2.25.1.windows.1
|
|
|