@Override public User getOfflineUser(final String name) { final User user = userMap.getUser(name); if (user != null && user.getBase() instanceof OfflinePlayer) { ((OfflinePlayer)user.getBase()).setName(name); } return user; }
@Override public User getUser(final Object base) { if (base instanceof Player) { return getUser((Player)base); } if (base instanceof String) { final User user = userMap.getUser((String)base); if (user != null && user.getBase() instanceof OfflinePlayer) { ((OfflinePlayer)user.getBase()).setName((String)base); } return user; } return null; }
private <T extends Player> User getUser(final T base) { if (base == null) { return null; } if (base instanceof User) { return (User)base; } User user = userMap.getUser(base.getName()); if (user == null) { user = new User(base, this); } else { user.update(base); } return user; }