diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/players/OldUsersConverter.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/server/players/OldUsersConverter.java.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/players/OldUsersConverter.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/players/OldUsersConverter.java.patch new file mode 100644 index 0000000000..e69f8d4e5e --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/players/OldUsersConverter.java.patch @@ -0,0 +1,96 @@ +--- a/net/minecraft/server/players/OldUsersConverter.java ++++ b/net/minecraft/server/players/OldUsersConverter.java +@@ -63,9 +86,9 @@ + if (OLD_USERBANLIST.exists() && OLD_USERBANLIST.isFile()) { + if (userBanList.getFile().exists()) { + try { +- userBanList.load(); +- } catch (IOException var6) { +- LOGGER.warn("Could not load existing file {}", userBanList.getFile().getName(), var6); ++ gameprofilebanlist.load(); ++ } catch (IOException ioexception) { ++ OldUsersConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName()); // CraftBukkit - don't print stacktrace + } + } + +@@ -118,9 +144,9 @@ + if (OLD_IPBANLIST.exists() && OLD_IPBANLIST.isFile()) { + if (ipBanList.getFile().exists()) { + try { +- ipBanList.load(); +- } catch (IOException var11) { +- LOGGER.warn("Could not load existing file {}", ipBanList.getFile().getName(), var11); ++ ipbanlist.load(); ++ } catch (IOException ioexception) { ++ OldUsersConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName()); // CraftBukkit - don't print stacktrace + } + } + +@@ -154,9 +185,9 @@ + if (OLD_OPLIST.exists() && OLD_OPLIST.isFile()) { + if (serverOpList.getFile().exists()) { + try { +- serverOpList.load(); +- } catch (IOException var6) { +- LOGGER.warn("Could not load existing file {}", serverOpList.getFile().getName(), var6); ++ oplist.load(); ++ } catch (IOException ioexception) { ++ OldUsersConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName()); // CraftBukkit - don't print stacktrace + } + } + +@@ -198,9 +229,9 @@ + if (OLD_WHITELIST.exists() && OLD_WHITELIST.isFile()) { + if (userWhiteList.getFile().exists()) { + try { +- userWhiteList.load(); +- } catch (IOException var6) { +- LOGGER.warn("Could not load existing file {}", userWhiteList.getFile().getName(), var6); ++ whitelist.load(); ++ } catch (IOException ioexception) { ++ OldUsersConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName()); // CraftBukkit - don't print stacktrace + } + } + +@@ -310,11 +346,36 @@ + } + } + +- private void movePlayerFile(File file3, String oldFileName, String newFileName) { +- File file4 = new File(worldPlayersDirectory, oldFileName + ".dat"); +- File file5 = new File(file3, newFileName + ".dat"); +- OldUsersConverter.ensureDirectoryExists(file3); +- if (!file4.renameTo(file5)) { ++ private void movePlayerFile(File file, String oldFileName, String newFileName) { ++ File file5 = new File(file, oldFileName + ".dat"); ++ File file6 = new File(file, newFileName + ".dat"); ++ ++ // CraftBukkit start - Use old file name to seed lastKnownName ++ CompoundTag root = null; ++ ++ try { ++ root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap()); ++ } catch (Exception exception) { ++ exception.printStackTrace(); ++ } ++ ++ if (root != null) { ++ if (!root.contains("bukkit")) { ++ root.put("bukkit", new CompoundTag()); ++ } ++ CompoundTag data = root.getCompound("bukkit"); ++ data.putString("lastKnownName", oldFileName); ++ ++ try { ++ NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2)); ++ } catch (Exception exception) { ++ exception.printStackTrace(); ++ } ++ } ++ // CraftBukkit end ++ ++ OldUsersConverter.ensureDirectoryExists(file); ++ if (!file5.renameTo(file6)) { + throw new OldUsersConverter.ConversionError("Could not convert file for " + oldFileName); + } + } |