| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | --- a/net/minecraft/server/players/NameReferencingFileConverter.java
 | 
					
						
							|  |  |  | +++ b/net/minecraft/server/players/NameReferencingFileConverter.java
 | 
					
						
							|  |  |  | @@ -27,6 +27,11 @@
 | 
					
						
							|  |  |  |  import org.apache.logging.log4j.LogManager; | 
					
						
							|  |  |  |  import org.apache.logging.log4j.Logger; | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  | +// CraftBukkit start
 | 
					
						
							|  |  |  | +import net.minecraft.nbt.NBTCompressedStreamTools;
 | 
					
						
							|  |  |  | +import net.minecraft.nbt.NBTTagCompound;
 | 
					
						
							|  |  |  | +// CraftBukkit end
 | 
					
						
							|  |  |  | +
 | 
					
						
							|  |  |  |  public class NameReferencingFileConverter { | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |      private static final Logger LOGGER = LogManager.getLogger(); | 
					
						
							|  |  |  | @@ -85,7 +90,7 @@
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  try { | 
					
						
							|  |  |  |                      gameprofilebanlist.load(); | 
					
						
							| 
									
										
										
										
											2020-06-25 10:00:00 +10: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
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  } | 
					
						
							|  |  |  |              } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | @@ -143,7 +148,7 @@
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  try { | 
					
						
							|  |  |  |                      ipbanlist.load(); | 
					
						
							| 
									
										
										
										
											2020-06-25 10:00:00 +10: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
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  } | 
					
						
							|  |  |  |              } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | @@ -184,7 +189,7 @@
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  try { | 
					
						
							|  |  |  |                      oplist.load(); | 
					
						
							| 
									
										
										
										
											2020-06-25 10:00:00 +10: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
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  } | 
					
						
							|  |  |  |              } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | @@ -228,7 +233,7 @@
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  try { | 
					
						
							|  |  |  |                      whitelist.load(); | 
					
						
							| 
									
										
										
										
											2020-06-25 10:00:00 +10: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
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |                  } | 
					
						
							|  |  |  |              } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 |  |  | @@ -351,6 +356,30 @@
 | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  |                          File file5 = new File(file, s2 + ".dat"); | 
					
						
							|  |  |  |                          File file6 = new File(file4, s3 + ".dat"); | 
					
						
							| 
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 |  |  |   | 
					
						
							|  |  |  | +                        // CraftBukkit start - Use old file name to seed lastKnownName
 | 
					
						
							|  |  |  | +                        NBTTagCompound root = null;
 | 
					
						
							|  |  |  | +
 | 
					
						
							|  |  |  | +                        try {
 | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  | +                            root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5));
 | 
					
						
							| 
									
										
										
										
											2015-02-26 22:41:06 +00: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-26 08:00:00 +11:00
										 |  |  | +                            data.setString("lastKnownName", s2);
 | 
					
						
							| 
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 |  |  | +
 | 
					
						
							|  |  |  | +                            try {
 | 
					
						
							|  |  |  | +                                NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
 | 
					
						
							|  |  |  | +                            } catch (Exception exception) {
 | 
					
						
							|  |  |  | +                                exception.printStackTrace();
 | 
					
						
							|  |  |  | +                            }
 | 
					
						
							|  |  |  | +                       }
 | 
					
						
							|  |  |  | +                        // CraftBukkit end
 | 
					
						
							|  |  |  | +
 | 
					
						
							| 
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 |  |  |                          NameReferencingFileConverter.b(file4); | 
					
						
							|  |  |  |                          if (!file5.renameTo(file6)) { | 
					
						
							|  |  |  |                              throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2); |