13
0
geforkt von Mirrors/Paper
Paper/paper-server/nms-patches/net/minecraft/server/players/NameReferencingFileConverter.patch

82 Zeilen
3.8 KiB
Diff

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -27,6 +27,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+// CraftBukkit end
+
public class NameReferencingFileConverter {
static final Logger LOGGER = LogManager.getLogger();
@@ -87,7 +92,7 @@
try {
gameprofilebanlist.load();
} catch (IOException ioexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.b().getName(), ioexception);
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.b().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -145,7 +150,7 @@
try {
ipbanlist.load();
} catch (IOException ioexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.b().getName(), ioexception);
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.b().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -186,7 +191,7 @@
try {
oplist.load();
} catch (IOException ioexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.b().getName(), ioexception);
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.b().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -230,7 +235,7 @@
try {
whitelist.load();
} catch (IOException ioexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.b().getName(), ioexception);
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.b().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -353,6 +358,30 @@
File file5 = new File(file, s2 + ".dat");
File file6 = new File(file4, s3 + ".dat");
+ // CraftBukkit start - Use old file name to seed lastKnownName
+ NBTTagCompound root = null;
+
+ try {
+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ if (root != null) {
+ if (!root.hasKey("bukkit")) {
+ root.set("bukkit", new NBTTagCompound());
+ }
+ NBTTagCompound data = root.getCompound("bukkit");
+ data.setString("lastKnownName", s2);
+
+ try {
+ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ // CraftBukkit end
+
NameReferencingFileConverter.a(file4);
if (!file5.renameTo(file6)) {
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);