3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/nms-patches/NameReferencingFileConverter.patch
2019-04-25 12:00:00 +10:00

91 Zeilen
4.6 KiB
Diff

--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
@@ -81,8 +81,9 @@
if (gameprofilebanlist.c().exists()) {
try {
gameprofilebanlist.load();
- } catch (FileNotFoundException filenotfoundexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.c().getName());
}
}
@@ -139,8 +140,9 @@
if (ipbanlist.c().exists()) {
try {
ipbanlist.load();
- } catch (FileNotFoundException filenotfoundexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.c().getName());
}
}
@@ -180,8 +182,9 @@
if (oplist.c().exists()) {
try {
oplist.load();
- } catch (FileNotFoundException filenotfoundexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", oplist.c().getName());
}
}
@@ -224,8 +227,9 @@
if (whitelist.c().exists()) {
try {
whitelist.load();
- } catch (FileNotFoundException filenotfoundexception) {
- NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
+ NameReferencingFileConverter.LOGGER.warn("Could not load existing file {}", whitelist.c().getName());
}
}
@@ -343,6 +347,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.b(file4);
if (!file5.renameTo(file6)) {
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);
@@ -464,7 +492,7 @@
private static File getPlayersFolder(MinecraftServer minecraftserver) {
String s = minecraftserver.getWorld();
- File file = new File(s);
+ File file = new File(MinecraftServer.getServer().server.getWorldContainer(), s); // CraftBukkit - Respect container setting
return new File(file, "players");
}