mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-05-06 15:50:43 +00:00
User loading cleanup
This commit is contained in:
parent
b0e165546e
commit
9ec0ca25a5
2 changed files with 7 additions and 16 deletions
|
@ -632,12 +632,14 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
|||
return null;
|
||||
}
|
||||
|
||||
//This will return null if there is not a match.
|
||||
@Override
|
||||
public User getUser(final String base)
|
||||
{
|
||||
return getOfflineUser((String)base);
|
||||
}
|
||||
|
||||
//This will return null if there is not a match.
|
||||
@Override
|
||||
public User getOfflineUser(final String name)
|
||||
{
|
||||
|
@ -649,6 +651,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
|
|||
return user;
|
||||
}
|
||||
|
||||
//This will create a new user if there is not a match.
|
||||
@Override
|
||||
public User getUser(final Player base)
|
||||
{
|
||||
|
|
|
@ -78,24 +78,12 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||
}
|
||||
|
||||
@Override
|
||||
public User load(final String name) throws Exception
|
||||
public User load(final String sanitizedName) throws Exception
|
||||
{
|
||||
String sanitizedName = StringUtil.sanitizeFileName(name);
|
||||
if (!sanitizedName.equals(name))
|
||||
{
|
||||
User user = getUser(sanitizedName);
|
||||
if (user == null)
|
||||
{
|
||||
throw new Exception("User not found!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return user;
|
||||
}
|
||||
}
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(name))
|
||||
String sanitizedPlayer = StringUtil.sanitizeFileName(player.getName());
|
||||
if (sanitizedPlayer.equalsIgnoreCase(sanitizedName))
|
||||
{
|
||||
keys.add(sanitizedName);
|
||||
return new User(player, ess);
|
||||
|
|
Loading…
Reference in a new issue