aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch')
-rw-r--r--patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch b/patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch
new file mode 100644
index 0000000000..57e1d5a7c4
--- /dev/null
+++ b/patch-remap/og/net/minecraft/server/players/NameReferencingFileConverter.patch
@@ -0,0 +1,82 @@
+--- a/net/minecraft/server/players/NameReferencingFileConverter.java
++++ b/net/minecraft/server/players/NameReferencingFileConverter.java
+@@ -27,6 +27,12 @@
+ import net.minecraft.world.level.storage.SavedFile;
+ import org.slf4j.Logger;
+
++// CraftBukkit start
++import net.minecraft.nbt.NBTCompressedStreamTools;
++import net.minecraft.nbt.NBTReadLimiter;
++import net.minecraft.nbt.NBTTagCompound;
++// CraftBukkit end
++
+ public class NameReferencingFileConverter {
+
+ static final Logger LOGGER = LogUtils.getLogger();
+@@ -85,7 +91,7 @@
+ try {
+ gameprofilebanlist.load();
+ } catch (IOException ioexception) {
+- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName(), ioexception);
++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
+ }
+ }
+
+@@ -143,7 +149,7 @@
+ try {
+ ipbanlist.load();
+ } catch (IOException ioexception) {
+- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName(), ioexception);
++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
+ }
+ }
+
+@@ -184,7 +190,7 @@
+ try {
+ oplist.load();
+ } catch (IOException ioexception) {
+- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName(), ioexception);
++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName()); // CraftBukkit - don't print stacktrace
+ }
+ }
+
+@@ -228,7 +234,7 @@
+ try {
+ whitelist.load();
+ } catch (IOException ioexception) {
+- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName(), ioexception);
++ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName()); // CraftBukkit - don't print stacktrace
+ }
+ }
+
+@@ -347,6 +353,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.readCompressed(new java.io.FileInputStream(file5), NBTReadLimiter.unlimitedHeap());
++ } catch (Exception exception) {
++ exception.printStackTrace();
++ }
++
++ if (root != null) {
++ if (!root.contains("bukkit")) {
++ root.put("bukkit", new NBTTagCompound());
++ }
++ NBTTagCompound data = root.getCompound("bukkit");
++ data.putString("lastKnownName", s2);
++
++ try {
++ NBTCompressedStreamTools.writeCompressed(root, new java.io.FileOutputStream(file2));
++ } catch (Exception exception) {
++ exception.printStackTrace();
++ }
++ }
++ // CraftBukkit end
++
+ NameReferencingFileConverter.ensureDirectoryExists(file4);
+ if (!file5.renameTo(file6)) {
+ throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);