--- a/net/minecraft/server/players/OldUsersConverter.java
+++ b/net/minecraft/server/players/OldUsersConverter.java
@@ -13,6 +13,7 @@
 import java.text.ParseException;
 import java.util.Collection;
 import java.util.Date;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -20,6 +21,9 @@
 import java.util.UUID;
 import javax.annotation.Nullable;
 import net.minecraft.core.UUIDUtil;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.NbtAccounter;
+import net.minecraft.nbt.NbtIo;
 import net.minecraft.server.MinecraftServer;
 import net.minecraft.server.dedicated.DedicatedServer;
 import net.minecraft.util.StringUtil;
@@ -27,20 +31,27 @@
 import org.slf4j.Logger;
 
 public class OldUsersConverter {
+
     static final Logger LOGGER = LogUtils.getLogger();
     public static final File OLD_IPBANLIST = new File("banned-ips.txt");
     public static final File OLD_USERBANLIST = new File("banned-players.txt");
     public static final File OLD_OPLIST = new File("ops.txt");
     public static final File OLD_WHITELIST = new File("white-list.txt");
 
+    public OldUsersConverter() {}
+
     static List<String> readOldListFormat(File file, Map<String, String[]> valueMap) throws IOException {
         List<String> list = Files.readLines(file, StandardCharsets.UTF_8);
+        Iterator iterator = list.iterator();
 
-        for (String string : list) {
-            string = string.trim();
-            if (!string.startsWith("#") && string.length() >= 1) {
-                String[] strings = string.split("\\|");
-                valueMap.put(strings[0].toLowerCase(Locale.ROOT), strings);
+        while (iterator.hasNext()) {
+            String s = (String) iterator.next();
+
+            s = s.trim();
+            if (!s.startsWith("#") && s.length() >= 1) {
+                String[] astring = s.split("\\|");
+
+                valueMap.put(astring[0].toLowerCase(Locale.ROOT), astring);
             }
         }
 
@@ -48,62 +59,79 @@
     }
 
     private static void lookupPlayers(MinecraftServer server, Collection<String> bannedPlayers, ProfileLookupCallback callback) {
-        String[] strings = bannedPlayers.stream().filter(playerName -> !StringUtil.isNullOrEmpty(playerName)).toArray(String[]::new);
-        if (server.usesAuthentication()) {
-            server.getProfileRepository().findProfilesByNames(strings, callback);
+        String[] astring = (String[]) bannedPlayers.stream().filter((s) -> {
+            return !StringUtil.isNullOrEmpty(s);
+        }).toArray((i) -> {
+            return new String[i];
+        });
+
+        if (server.usesAuthentication() ||
+            (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now.  // Paper - Add setting for proxy online mode status
+            server.getProfileRepository().findProfilesByNames(astring, callback);
         } else {
-            for (String string : strings) {
-                callback.onProfileLookupSucceeded(UUIDUtil.createOfflineProfile(string));
+            String[] astring1 = astring;
+            int i = astring.length;
+
+            for (int j = 0; j < i; ++j) {
+                String s = astring1[j];
+
+                callback.onProfileLookupSucceeded(UUIDUtil.createOfflineProfile(s));
             }
         }
+
     }
 
-    public static boolean convertUserBanlist(MinecraftServer server) {
-        final UserBanList userBanList = new UserBanList(PlayerList.USERBANLIST_FILE);
-        if (OLD_USERBANLIST.exists() && OLD_USERBANLIST.isFile()) {
-            if (userBanList.getFile().exists()) {
+    public static boolean convertUserBanlist(final MinecraftServer server) {
+        final UserBanList gameprofilebanlist = new UserBanList(PlayerList.USERBANLIST_FILE);
+
+        if (OldUsersConverter.OLD_USERBANLIST.exists() && OldUsersConverter.OLD_USERBANLIST.isFile()) {
+            if (gameprofilebanlist.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
                 }
             }
 
             try {
                 final Map<String, String[]> map = Maps.newHashMap();
-                readOldListFormat(OLD_USERBANLIST, map);
-                ProfileLookupCallback profileLookupCallback = new ProfileLookupCallback() {
-                    public void onProfileLookupSucceeded(GameProfile gameProfile) {
-                        server.getProfileCache().add(gameProfile);
-                        String[] strings = map.get(gameProfile.getName().toLowerCase(Locale.ROOT));
-                        if (strings == null) {
-                            OldUsersConverter.LOGGER.warn("Could not convert user banlist entry for {}", gameProfile.getName());
+
+                OldUsersConverter.readOldListFormat(OldUsersConverter.OLD_USERBANLIST, map);
+                ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
+                    public void onProfileLookupSucceeded(GameProfile gameprofile) {
+                        server.getProfileCache().add(gameprofile);
+                        String[] astring = (String[]) map.get(gameprofile.getName().toLowerCase(Locale.ROOT));
+
+                        if (astring == null) {
+                            OldUsersConverter.LOGGER.warn("Could not convert user banlist entry for {}", gameprofile.getName());
                             throw new OldUsersConverter.ConversionError("Profile not in the conversionlist");
                         } else {
-                            Date date = strings.length > 1 ? OldUsersConverter.parseDate(strings[1], null) : null;
-                            String string = strings.length > 2 ? strings[2] : null;
-                            Date date2 = strings.length > 3 ? OldUsersConverter.parseDate(strings[3], null) : null;
-                            String string2 = strings.length > 4 ? strings[4] : null;
-                            userBanList.add(new UserBanListEntry(gameProfile, date, string, date2, string2));
+                            Date date = astring.length > 1 ? OldUsersConverter.parseDate(astring[1], (Date) null) : null;
+                            String s = astring.length > 2 ? astring[2] : null;
+                            Date date1 = astring.length > 3 ? OldUsersConverter.parseDate(astring[3], (Date) null) : null;
+                            String s1 = astring.length > 4 ? astring[4] : null;
+
+                            gameprofilebanlist.add(new UserBanListEntry(gameprofile, date, s, date1, s1));
                         }
                     }
 
-                    public void onProfileLookupFailed(String string, Exception exception) {
-                        OldUsersConverter.LOGGER.warn("Could not lookup user banlist entry for {}", string, exception);
+                    public void onProfileLookupFailed(String s, Exception exception) {
+                        OldUsersConverter.LOGGER.warn("Could not lookup user banlist entry for {}", s, exception);
                         if (!(exception instanceof ProfileNotFoundException)) {
-                            throw new OldUsersConverter.ConversionError("Could not request user " + string + " from backend systems", exception);
+                            throw new OldUsersConverter.ConversionError("Could not request user " + s + " from backend systems", exception);
                         }
                     }
                 };
-                lookupPlayers(server, map.keySet(), profileLookupCallback);
-                userBanList.save();
-                renameOldFile(OLD_USERBANLIST);
+
+                OldUsersConverter.lookupPlayers(server, map.keySet(), profilelookupcallback);
+                gameprofilebanlist.save();
+                OldUsersConverter.renameOldFile(OldUsersConverter.OLD_USERBANLIST);
                 return true;
-            } catch (IOException var4) {
-                LOGGER.warn("Could not read old user banlist to convert it!", (Throwable)var4);
+            } catch (IOException ioexception1) {
+                OldUsersConverter.LOGGER.warn("Could not read old user banlist to convert it!", ioexception1);
                 return false;
-            } catch (OldUsersConverter.ConversionError var5) {
-                LOGGER.error("Conversion failed, please try again later", (Throwable)var5);
+            } catch (OldUsersConverter.ConversionError namereferencingfileconverter_fileconversionexception) {
+                OldUsersConverter.LOGGER.error("Conversion failed, please try again later", namereferencingfileconverter_fileconversionexception);
                 return false;
             }
         } else {
@@ -112,34 +140,39 @@
     }
 
     public static boolean convertIpBanlist(MinecraftServer server) {
-        IpBanList ipBanList = new IpBanList(PlayerList.IPBANLIST_FILE);
-        if (OLD_IPBANLIST.exists() && OLD_IPBANLIST.isFile()) {
-            if (ipBanList.getFile().exists()) {
+        IpBanList ipbanlist = new IpBanList(PlayerList.IPBANLIST_FILE);
+
+        if (OldUsersConverter.OLD_IPBANLIST.exists() && OldUsersConverter.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
                 }
             }
 
             try {
                 Map<String, String[]> map = Maps.newHashMap();
-                readOldListFormat(OLD_IPBANLIST, map);
 
-                for (String string : map.keySet()) {
-                    String[] strings = map.get(string);
-                    Date date = strings.length > 1 ? parseDate(strings[1], null) : null;
-                    String string2 = strings.length > 2 ? strings[2] : null;
-                    Date date2 = strings.length > 3 ? parseDate(strings[3], null) : null;
-                    String string3 = strings.length > 4 ? strings[4] : null;
-                    ipBanList.add(new IpBanListEntry(string, date, string2, date2, string3));
+                OldUsersConverter.readOldListFormat(OldUsersConverter.OLD_IPBANLIST, map);
+                Iterator iterator = map.keySet().iterator();
+
+                while (iterator.hasNext()) {
+                    String s = (String) iterator.next();
+                    String[] astring = (String[]) map.get(s);
+                    Date date = astring.length > 1 ? OldUsersConverter.parseDate(astring[1], (Date) null) : null;
+                    String s1 = astring.length > 2 ? astring[2] : null;
+                    Date date1 = astring.length > 3 ? OldUsersConverter.parseDate(astring[3], (Date) null) : null;
+                    String s2 = astring.length > 4 ? astring[4] : null;
+
+                    ipbanlist.add(new IpBanListEntry(s, date, s1, date1, s2));
                 }
 
-                ipBanList.save();
-                renameOldFile(OLD_IPBANLIST);
+                ipbanlist.save();
+                OldUsersConverter.renameOldFile(OldUsersConverter.OLD_IPBANLIST);
                 return true;
-            } catch (IOException var10) {
-                LOGGER.warn("Could not parse old ip banlist to convert it!", (Throwable)var10);
+            } catch (IOException ioexception1) {
+                OldUsersConverter.LOGGER.warn("Could not parse old ip banlist to convert it!", ioexception1);
                 return false;
             }
         } else {
@@ -147,41 +180,43 @@
         }
     }
 
-    public static boolean convertOpsList(MinecraftServer server) {
-        final ServerOpList serverOpList = new ServerOpList(PlayerList.OPLIST_FILE);
-        if (OLD_OPLIST.exists() && OLD_OPLIST.isFile()) {
-            if (serverOpList.getFile().exists()) {
+    public static boolean convertOpsList(final MinecraftServer server) {
+        final ServerOpList oplist = new ServerOpList(PlayerList.OPLIST_FILE);
+
+        if (OldUsersConverter.OLD_OPLIST.exists() && OldUsersConverter.OLD_OPLIST.isFile()) {
+            if (oplist.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
                 }
             }
 
             try {
-                List<String> list = Files.readLines(OLD_OPLIST, StandardCharsets.UTF_8);
-                ProfileLookupCallback profileLookupCallback = new ProfileLookupCallback() {
-                    public void onProfileLookupSucceeded(GameProfile gameProfile) {
-                        server.getProfileCache().add(gameProfile);
-                        serverOpList.add(new ServerOpListEntry(gameProfile, server.getOperatorUserPermissionLevel(), false));
+                List<String> list = Files.readLines(OldUsersConverter.OLD_OPLIST, StandardCharsets.UTF_8);
+                ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
+                    public void onProfileLookupSucceeded(GameProfile gameprofile) {
+                        server.getProfileCache().add(gameprofile);
+                        oplist.add(new ServerOpListEntry(gameprofile, server.getOperatorUserPermissionLevel(), false));
                     }
 
-                    public void onProfileLookupFailed(String string, Exception exception) {
-                        OldUsersConverter.LOGGER.warn("Could not lookup oplist entry for {}", string, exception);
+                    public void onProfileLookupFailed(String s, Exception exception) {
+                        OldUsersConverter.LOGGER.warn("Could not lookup oplist entry for {}", s, exception);
                         if (!(exception instanceof ProfileNotFoundException)) {
-                            throw new OldUsersConverter.ConversionError("Could not request user " + string + " from backend systems", exception);
+                            throw new OldUsersConverter.ConversionError("Could not request user " + s + " from backend systems", exception);
                         }
                     }
                 };
-                lookupPlayers(server, list, profileLookupCallback);
-                serverOpList.save();
-                renameOldFile(OLD_OPLIST);
+
+                OldUsersConverter.lookupPlayers(server, list, profilelookupcallback);
+                oplist.save();
+                OldUsersConverter.renameOldFile(OldUsersConverter.OLD_OPLIST);
                 return true;
-            } catch (IOException var4) {
-                LOGGER.warn("Could not read old oplist to convert it!", (Throwable)var4);
+            } catch (IOException ioexception1) {
+                OldUsersConverter.LOGGER.warn("Could not read old oplist to convert it!", ioexception1);
                 return false;
-            } catch (OldUsersConverter.ConversionError var5) {
-                LOGGER.error("Conversion failed, please try again later", (Throwable)var5);
+            } catch (OldUsersConverter.ConversionError namereferencingfileconverter_fileconversionexception) {
+                OldUsersConverter.LOGGER.error("Conversion failed, please try again later", namereferencingfileconverter_fileconversionexception);
                 return false;
             }
         } else {
@@ -189,41 +224,43 @@
         }
     }
 
-    public static boolean convertWhiteList(MinecraftServer server) {
-        final UserWhiteList userWhiteList = new UserWhiteList(PlayerList.WHITELIST_FILE);
-        if (OLD_WHITELIST.exists() && OLD_WHITELIST.isFile()) {
-            if (userWhiteList.getFile().exists()) {
+    public static boolean convertWhiteList(final MinecraftServer server) {
+        final UserWhiteList whitelist = new UserWhiteList(PlayerList.WHITELIST_FILE);
+
+        if (OldUsersConverter.OLD_WHITELIST.exists() && OldUsersConverter.OLD_WHITELIST.isFile()) {
+            if (whitelist.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
                 }
             }
 
             try {
-                List<String> list = Files.readLines(OLD_WHITELIST, StandardCharsets.UTF_8);
-                ProfileLookupCallback profileLookupCallback = new ProfileLookupCallback() {
-                    public void onProfileLookupSucceeded(GameProfile gameProfile) {
-                        server.getProfileCache().add(gameProfile);
-                        userWhiteList.add(new UserWhiteListEntry(gameProfile));
+                List<String> list = Files.readLines(OldUsersConverter.OLD_WHITELIST, StandardCharsets.UTF_8);
+                ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
+                    public void onProfileLookupSucceeded(GameProfile gameprofile) {
+                        server.getProfileCache().add(gameprofile);
+                        whitelist.add(new UserWhiteListEntry(gameprofile));
                     }
 
-                    public void onProfileLookupFailed(String string, Exception exception) {
-                        OldUsersConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", string, exception);
+                    public void onProfileLookupFailed(String s, Exception exception) {
+                        OldUsersConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", s, exception);
                         if (!(exception instanceof ProfileNotFoundException)) {
-                            throw new OldUsersConverter.ConversionError("Could not request user " + string + " from backend systems", exception);
+                            throw new OldUsersConverter.ConversionError("Could not request user " + s + " from backend systems", exception);
                         }
                     }
                 };
-                lookupPlayers(server, list, profileLookupCallback);
-                userWhiteList.save();
-                renameOldFile(OLD_WHITELIST);
+
+                OldUsersConverter.lookupPlayers(server, list, profilelookupcallback);
+                whitelist.save();
+                OldUsersConverter.renameOldFile(OldUsersConverter.OLD_WHITELIST);
                 return true;
-            } catch (IOException var4) {
-                LOGGER.warn("Could not read old whitelist to convert it!", (Throwable)var4);
+            } catch (IOException ioexception1) {
+                OldUsersConverter.LOGGER.warn("Could not read old whitelist to convert it!", ioexception1);
                 return false;
-            } catch (OldUsersConverter.ConversionError var5) {
-                LOGGER.error("Conversion failed, please try again later", (Throwable)var5);
+            } catch (OldUsersConverter.ConversionError namereferencingfileconverter_fileconversionexception) {
+                OldUsersConverter.LOGGER.error("Conversion failed, please try again later", namereferencingfileconverter_fileconversionexception);
                 return false;
             }
         } else {
@@ -232,104 +269,152 @@
     }
 
     @Nullable
-    public static UUID convertMobOwnerIfNecessary(MinecraftServer server, String name) {
+    public static UUID convertMobOwnerIfNecessary(final MinecraftServer server, String name) {
         if (!StringUtil.isNullOrEmpty(name) && name.length() <= 16) {
             Optional<UUID> optional = server.getProfileCache().get(name).map(GameProfile::getId);
+
             if (optional.isPresent()) {
-                return optional.get();
+                return (UUID) optional.get();
             } else if (!server.isSingleplayer() && server.usesAuthentication()) {
                 final List<GameProfile> list = Lists.newArrayList();
-                ProfileLookupCallback profileLookupCallback = new ProfileLookupCallback() {
-                    public void onProfileLookupSucceeded(GameProfile gameProfile) {
-                        server.getProfileCache().add(gameProfile);
-                        list.add(gameProfile);
+                ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
+                    public void onProfileLookupSucceeded(GameProfile gameprofile) {
+                        server.getProfileCache().add(gameprofile);
+                        list.add(gameprofile);
                     }
 
-                    public void onProfileLookupFailed(String string, Exception exception) {
-                        OldUsersConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", string, exception);
+                    public void onProfileLookupFailed(String s1, Exception exception) {
+                        OldUsersConverter.LOGGER.warn("Could not lookup user whitelist entry for {}", s1, exception);
                     }
                 };
-                lookupPlayers(server, Lists.newArrayList(name), profileLookupCallback);
-                return !list.isEmpty() ? list.get(0).getId() : null;
+
+                OldUsersConverter.lookupPlayers(server, Lists.newArrayList(new String[]{name}), profilelookupcallback);
+                return !list.isEmpty() ? ((GameProfile) list.get(0)).getId() : null;
             } else {
                 return UUIDUtil.createOfflinePlayerUUID(name);
             }
         } else {
             try {
                 return UUID.fromString(name);
-            } catch (IllegalArgumentException var5) {
+            } catch (IllegalArgumentException illegalargumentexception) {
                 return null;
             }
         }
     }
 
-    public static boolean convertPlayers(DedicatedServer minecraftServer) {
-        final File file = getWorldPlayersDirectory(minecraftServer);
-        final File file2 = new File(file.getParentFile(), "playerdata");
-        final File file3 = new File(file.getParentFile(), "unknownplayers");
+    public static boolean convertPlayers(final DedicatedServer minecraftServer) {
+        final File file = OldUsersConverter.getWorldPlayersDirectory(minecraftServer);
+        final File file1 = new File(file.getParentFile(), "playerdata");
+        final File file2 = new File(file.getParentFile(), "unknownplayers");
+
         if (file.exists() && file.isDirectory()) {
-            File[] files = file.listFiles();
+            File[] afile = file.listFiles();
             List<String> list = Lists.newArrayList();
+            File[] afile1 = afile;
+            int i = afile.length;
 
-            for (File file4 : files) {
-                String string = file4.getName();
-                if (string.toLowerCase(Locale.ROOT).endsWith(".dat")) {
-                    String string2 = string.substring(0, string.length() - ".dat".length());
-                    if (!string2.isEmpty()) {
-                        list.add(string2);
+            for (int j = 0; j < i; ++j) {
+                File file3 = afile1[j];
+                String s = file3.getName();
+
+                if (s.toLowerCase(Locale.ROOT).endsWith(".dat")) {
+                    String s1 = s.substring(0, s.length() - ".dat".length());
+
+                    if (!s1.isEmpty()) {
+                        list.add(s1);
                     }
                 }
             }
 
             try {
-                final String[] strings = list.toArray(new String[list.size()]);
-                ProfileLookupCallback profileLookupCallback = new ProfileLookupCallback() {
-                    public void onProfileLookupSucceeded(GameProfile gameProfile) {
-                        minecraftServer.getProfileCache().add(gameProfile);
-                        UUID uUID = gameProfile.getId();
-                        this.movePlayerFile(file2, this.getFileNameForProfile(gameProfile.getName()), uUID.toString());
+                final String[] astring = (String[]) list.toArray(new String[list.size()]);
+                ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() {
+                    public void onProfileLookupSucceeded(GameProfile gameprofile) {
+                        minecraftServer.getProfileCache().add(gameprofile);
+                        UUID uuid = gameprofile.getId();
+
+                        this.movePlayerFile(file1, this.getFileNameForProfile(gameprofile.getName()), uuid.toString());
                     }
 
-                    public void onProfileLookupFailed(String string, Exception exception) {
-                        OldUsersConverter.LOGGER.warn("Could not lookup user uuid for {}", string, exception);
+                    public void onProfileLookupFailed(String s2, Exception exception) {
+                        OldUsersConverter.LOGGER.warn("Could not lookup user uuid for {}", s2, exception);
                         if (exception instanceof ProfileNotFoundException) {
-                            String string2 = this.getFileNameForProfile(string);
-                            this.movePlayerFile(file3, string2, string2);
+                            String s3 = this.getFileNameForProfile(s2);
+
+                            this.movePlayerFile(file2, s3, s3);
                         } else {
-                            throw new OldUsersConverter.ConversionError("Could not request user " + string + " from backend systems", exception);
+                            throw new OldUsersConverter.ConversionError("Could not request user " + s2 + " from backend systems", exception);
                         }
                     }
 
                     private void movePlayerFile(File playerDataFolder, String fileName, String uuid) {
-                        File file = new File(file, fileName + ".dat");
-                        File file2 = new File(playerDataFolder, uuid + ".dat");
+                        File file5 = new File(file, fileName + ".dat");
+                        File file6 = new File(playerDataFolder, uuid + ".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) {
+                            // Paper start
+                            io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception);
+                            exception.printStackTrace();
+                            com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception);
+                            // Paper end
+                        }
+
+                        if (root != null) {
+                            if (!root.contains("bukkit")) {
+                                root.put("bukkit", new CompoundTag());
+                            }
+                            CompoundTag data = root.getCompound("bukkit");
+                            data.putString("lastKnownName", fileName);
+
+                            try {
+                                NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
+                            } catch (Exception exception) {
+                                // Paper start
+                                io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception);
+                                exception.printStackTrace();
+                                com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception);
+                                // Paper end
+                            }
+                       }
+                        // CraftBukkit end
+
                         OldUsersConverter.ensureDirectoryExists(playerDataFolder);
-                        if (!file.renameTo(file2)) {
+                        if (!file5.renameTo(file6)) {
                             throw new OldUsersConverter.ConversionError("Could not convert file for " + fileName);
                         }
                     }
 
-                    private String getFileNameForProfile(String string) {
-                        String string2 = null;
+                    private String getFileNameForProfile(String s2) {
+                        String s3 = null;
+                        String[] astring1 = astring;
+                        int k = astring1.length;
 
-                        for (String string3 : strings) {
-                            if (string3 != null && string3.equalsIgnoreCase(string)) {
-                                string2 = string3;
+                        for (int l = 0; l < k; ++l) {
+                            String s4 = astring1[l];
+
+                            if (s4 != null && s4.equalsIgnoreCase(s2)) {
+                                s3 = s4;
                                 break;
                             }
                         }
 
-                        if (string2 == null) {
-                            throw new OldUsersConverter.ConversionError("Could not find the filename for " + string + " anymore");
+                        if (s3 == null) {
+                            throw new OldUsersConverter.ConversionError("Could not find the filename for " + s2 + " anymore");
                         } else {
-                            return string2;
+                            return s3;
                         }
                     }
                 };
-                lookupPlayers(minecraftServer, Lists.newArrayList(strings), profileLookupCallback);
+
+                OldUsersConverter.lookupPlayers(minecraftServer, Lists.newArrayList(astring), profilelookupcallback);
                 return true;
-            } catch (OldUsersConverter.ConversionError var12) {
-                LOGGER.error("Conversion failed, please try again later", (Throwable)var12);
+            } catch (OldUsersConverter.ConversionError namereferencingfileconverter_fileconversionexception) {
+                OldUsersConverter.LOGGER.error("Conversion failed, please try again later", namereferencingfileconverter_fileconversionexception);
                 return false;
             }
         } else {
@@ -348,50 +433,56 @@
     }
 
     public static boolean serverReadyAfterUserconversion(MinecraftServer server) {
-        boolean bl = areOldUserlistsRemoved();
-        return bl && areOldPlayersConverted(server);
+        boolean flag = OldUsersConverter.areOldUserlistsRemoved();
+
+        flag = flag && OldUsersConverter.areOldPlayersConverted(server);
+        return flag;
     }
 
     private static boolean areOldUserlistsRemoved() {
-        boolean bl = false;
-        if (OLD_USERBANLIST.exists() && OLD_USERBANLIST.isFile()) {
-            bl = true;
+        boolean flag = false;
+
+        if (OldUsersConverter.OLD_USERBANLIST.exists() && OldUsersConverter.OLD_USERBANLIST.isFile()) {
+            flag = true;
         }
 
-        boolean bl2 = false;
-        if (OLD_IPBANLIST.exists() && OLD_IPBANLIST.isFile()) {
-            bl2 = true;
+        boolean flag1 = false;
+
+        if (OldUsersConverter.OLD_IPBANLIST.exists() && OldUsersConverter.OLD_IPBANLIST.isFile()) {
+            flag1 = true;
         }
 
-        boolean bl3 = false;
-        if (OLD_OPLIST.exists() && OLD_OPLIST.isFile()) {
-            bl3 = true;
+        boolean flag2 = false;
+
+        if (OldUsersConverter.OLD_OPLIST.exists() && OldUsersConverter.OLD_OPLIST.isFile()) {
+            flag2 = true;
         }
 
-        boolean bl4 = false;
-        if (OLD_WHITELIST.exists() && OLD_WHITELIST.isFile()) {
-            bl4 = true;
+        boolean flag3 = false;
+
+        if (OldUsersConverter.OLD_WHITELIST.exists() && OldUsersConverter.OLD_WHITELIST.isFile()) {
+            flag3 = true;
         }
 
-        if (!bl && !bl2 && !bl3 && !bl4) {
+        if (!flag && !flag1 && !flag2 && !flag3) {
             return true;
         } else {
-            LOGGER.warn("**** FAILED TO START THE SERVER AFTER ACCOUNT CONVERSION!");
-            LOGGER.warn("** please remove the following files and restart the server:");
-            if (bl) {
-                LOGGER.warn("* {}", OLD_USERBANLIST.getName());
+            OldUsersConverter.LOGGER.warn("**** FAILED TO START THE SERVER AFTER ACCOUNT CONVERSION!");
+            OldUsersConverter.LOGGER.warn("** please remove the following files and restart the server:");
+            if (flag) {
+                OldUsersConverter.LOGGER.warn("* {}", OldUsersConverter.OLD_USERBANLIST.getName());
             }
 
-            if (bl2) {
-                LOGGER.warn("* {}", OLD_IPBANLIST.getName());
+            if (flag1) {
+                OldUsersConverter.LOGGER.warn("* {}", OldUsersConverter.OLD_IPBANLIST.getName());
             }
 
-            if (bl3) {
-                LOGGER.warn("* {}", OLD_OPLIST.getName());
+            if (flag2) {
+                OldUsersConverter.LOGGER.warn("* {}", OldUsersConverter.OLD_OPLIST.getName());
             }
 
-            if (bl4) {
-                LOGGER.warn("* {}", OLD_WHITELIST.getName());
+            if (flag3) {
+                OldUsersConverter.LOGGER.warn("* {}", OldUsersConverter.OLD_WHITELIST.getName());
             }
 
             return false;
@@ -399,14 +490,15 @@
     }
 
     private static boolean areOldPlayersConverted(MinecraftServer server) {
-        File file = getWorldPlayersDirectory(server);
-        if (!file.exists() || !file.isDirectory() || file.list().length <= 0 && file.delete()) {
-            return true;
-        } else {
-            LOGGER.warn("**** DETECTED OLD PLAYER DIRECTORY IN THE WORLD SAVE");
-            LOGGER.warn("**** THIS USUALLY HAPPENS WHEN THE AUTOMATIC CONVERSION FAILED IN SOME WAY");
-            LOGGER.warn("** please restart the server and if the problem persists, remove the directory '{}'", file.getPath());
+        File file = OldUsersConverter.getWorldPlayersDirectory(server);
+
+        if (file.exists() && file.isDirectory() && (file.list().length > 0 || !file.delete())) {
+            OldUsersConverter.LOGGER.warn("**** DETECTED OLD PLAYER DIRECTORY IN THE WORLD SAVE");
+            OldUsersConverter.LOGGER.warn("**** THIS USUALLY HAPPENS WHEN THE AUTOMATIC CONVERSION FAILED IN SOME WAY");
+            OldUsersConverter.LOGGER.warn("** please restart the server and if the problem persists, remove the directory '{}'", file.getPath());
             return false;
+        } else {
+            return true;
         }
     }
 
@@ -415,22 +507,25 @@
     }
 
     private static void renameOldFile(File file) {
-        File file2 = new File(file.getName() + ".converted");
-        file.renameTo(file2);
+        File file1 = new File(file.getName() + ".converted");
+
+        file.renameTo(file1);
     }
 
     static Date parseDate(String dateString, Date fallback) {
-        Date date;
+        Date date1;
+
         try {
-            date = BanListEntry.DATE_FORMAT.parse(dateString);
-        } catch (ParseException var4) {
-            date = fallback;
+            date1 = BanListEntry.DATE_FORMAT.parse(dateString);
+        } catch (ParseException parseexception) {
+            date1 = fallback;
         }
 
-        return date;
+        return date1;
     }
 
-    static class ConversionError extends RuntimeException {
+    private static class ConversionError extends RuntimeException {
+
         ConversionError(String message, Throwable cause) {
             super(message, cause);
         }
