Paper/nms-patches/NameReferencingFileConverter.patch

70 lines
3.5 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
2020-06-25 02:00:00 +02:00
@@ -80,7 +80,7 @@
try {
gameprofilebanlist.load();
2020-06-25 02:00:00 +02:00
} 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
}
}
2020-06-25 02:00:00 +02:00
@@ -138,7 +138,7 @@
try {
ipbanlist.load();
2020-06-25 02:00:00 +02:00
} 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
}
}
2020-06-25 02:00:00 +02:00
@@ -179,7 +179,7 @@
try {
oplist.load();
2020-06-25 02:00:00 +02:00
} 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
}
}
2020-06-25 02:00:00 +02:00
@@ -223,7 +223,7 @@
try {
whitelist.load();
2020-06-25 02:00:00 +02:00
} 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
}
}
2020-06-25 02:00:00 +02:00
@@ -346,6 +346,30 @@
2018-12-25 22:00:00 +01:00
File file5 = new File(file, s2 + ".dat");
File file6 = new File(file4, s3 + ".dat");
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start - Use old file name to seed lastKnownName
+ NBTTagCompound root = null;
+
+ try {
2018-12-25 22:00:00 +01:00
+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5));
2015-02-26 23:41:06 +01:00
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ if (root != null) {
+ if (!root.hasKey("bukkit")) {
+ root.set("bukkit", new NBTTagCompound());
+ }
+ NBTTagCompound data = root.getCompound("bukkit");
2018-12-25 22:00:00 +01:00
+ data.setString("lastKnownName", s2);
2015-02-26 23:41:06 +01:00
+
+ try {
+ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ // CraftBukkit end
+
2018-12-25 22:00:00 +01:00
NameReferencingFileConverter.b(file4);
if (!file5.renameTo(file6)) {
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);