@Override public User load(final String stringUUID) throws Exception { UUID uuid = UUID.fromString(stringUUID); Player player = ess.getServer().getPlayer(uuid); if (player != null) { final User user = new User(player, ess); trackUUID(uuid, user.getName(), true); return user; } final File userFile = getUserFileFromID(uuid); if (userFile.exists()) { player = new OfflinePlayer(uuid, ess.getServer()); final User user = new User(player, ess); ((OfflinePlayer) player).setName(user.getLastAccountName()); trackUUID(uuid, user.getName(), false); return user; } throw new Exception("User not found!"); }
public User getUser(final String name) { try { final String sanitizedName = StringUtil.safeString(name); if (names.containsKey(sanitizedName)) { final UUID uuid = names.get(sanitizedName); return getUser(uuid); } final File userFile = getUserFileFromString(sanitizedName); if (userFile.exists()) { ess.getLogger().info("Importing user " + name + " to usermap."); User user = new User(new OfflinePlayer(sanitizedName, ess.getServer()), ess); trackUUID(user.getBase().getUniqueId(), user.getName(), true); return user; } return null; } catch (UncheckedExecutionException ex) { return null; } }