From 0000000000000000000000000000000000000000 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] Avoid double I/O operation on load player file


diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
index 4d30ca69dd303f1d76c8e6292021deda97851773..d9c2c7a20953fc3bcdd07d70233ccf6e3748b14b 100644
--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
@@ -56,7 +56,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() )
@@ -67,7 +68,7 @@ public class WorldNBTStorage {
             }
             // Spigot End
 
-            if (file.exists() && file.isFile()) {
+            if (normalFile) { // Akarin - avoid double I/O operation
                 nbttagcompound = NBTCompressedStreamTools.a(file);
             }
             // Spigot Start
