3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/PlayerDatFileConverter.patch
2014-11-28 11:23:19 +00:00

34 Zeilen
1.3 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerDatFileConverter.java 2014-11-28 11:22:56.146823158 +0000
+++ src/main/java/net/minecraft/server/PlayerDatFileConverter.java 2014-11-28 11:01:54.000000000 +0000
@@ -47,6 +47,30 @@
private void a(File file, String s, String s1) {
File file1 = new File(this.d, s + ".dat");
File file2 = new File(file, s1 + ".dat");
+
+ // CraftBukkit start - Use old file name to seed lastKnownName
+ NBTTagCompound root = null;
+
+ try {
+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1));
+ } 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", s);
+
+ try {
+ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ // CraftBukkit end
NameReferencingFileConverter.a(file);
if (!file1.renameTo(file2)) {