Upstream has released updates that appears to apply and compile correctly Paper Changes: 81706e626 Make the shutdown thread try to shutdown on main 891824509 Prevent opening inventories when frozen e6d395cc8 Port 04-Util.patch from Tuinity (#3136) 59453f667 Fix incorrectly loading chunks on a cancelled interact event bdcc31caa Let invalid positioned entities clean up previous chunk by the chunkCheck
34 lines
1.7 KiB
Diff
34 lines
1.7 KiB
Diff
From 762872dee25c7fc2d5bda396a7678f8a40988a24 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/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
index 350ac42d6..65cc7b205 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
|
@@ -165,7 +165,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() )
|
|
@@ -176,7 +177,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.20.1
|
|
|