mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-24 23:03:00 +02:00
37 lines
1.9 KiB
Diff
37 lines
1.9 KiB
Diff
From 9c2208b1035d9f2f5da33bee4c1b5c4f6a185769 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 c80673770c..65813c84ed 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
@@ -178,7 +178,8 @@ public class WorldNBTStorage implements IPlayerFileData {
|
|
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, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
|
if ( file.exists() )
|
|
@@ -189,7 +190,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
|
}
|
|
// 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
|
|
|