2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
|
|
|
|
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -28,6 +28,11 @@
|
2022-02-28 16:00:00 +01:00
|
|
|
import net.minecraft.world.level.storage.SavedFile;
|
|
|
|
import org.slf4j.Logger;
|
2021-03-15 23:00:00 +01:00
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import net.minecraft.nbt.NBTCompressedStreamTools;
|
|
|
|
+import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
|
|
|
public class NameReferencingFileConverter {
|
|
|
|
|
2022-02-28 16:00:00 +01:00
|
|
|
static final Logger LOGGER = LogUtils.getLogger();
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -88,7 +93,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
try {
|
|
|
|
gameprofilebanlist.load();
|
2020-06-25 02:00:00 +02:00
|
|
|
} catch (IOException ioexception) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- 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
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -146,7 +151,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
try {
|
|
|
|
ipbanlist.load();
|
2020-06-25 02:00:00 +02:00
|
|
|
} catch (IOException ioexception) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- 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
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -187,7 +192,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
try {
|
|
|
|
oplist.load();
|
2020-06-25 02:00:00 +02:00
|
|
|
} catch (IOException ioexception) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- 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
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -231,7 +236,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
try {
|
|
|
|
whitelist.load();
|
2020-06-25 02:00:00 +02:00
|
|
|
} catch (IOException ioexception) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- 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
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-06 16:00:00 +02:00
|
|
|
@@ -354,6 +359,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 {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ root = NBTCompressedStreamTools.readCompressed(new java.io.FileInputStream(file5));
|
2015-02-26 23:41:06 +01:00
|
|
|
+ } catch (Exception exception) {
|
|
|
|
+ exception.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (root != null) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!root.contains("bukkit")) {
|
|
|
|
+ root.put("bukkit", new NBTTagCompound());
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
|
|
|
+ NBTTagCompound data = root.getCompound("bukkit");
|
2021-11-21 23:00:00 +01:00
|
|
|
+ data.putString("lastKnownName", s2);
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
|
|
|
+ try {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ NBTCompressedStreamTools.writeCompressed(root, new java.io.FileOutputStream(file2));
|
2015-02-26 23:41:06 +01:00
|
|
|
+ } catch (Exception exception) {
|
|
|
|
+ exception.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
NameReferencingFileConverter.ensureDirectoryExists(file4);
|
2018-12-25 22:00:00 +01:00
|
|
|
if (!file5.renameTo(file6)) {
|
|
|
|
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);
|