mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
Don't return null, throw an exception
This commit is contained in:
parent
cfdb2a36c1
commit
3c98718387
1 changed files with 13 additions and 4 deletions
|
@ -77,8 +77,17 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||||
public User load(final String name) throws Exception
|
public User load(final String name) throws Exception
|
||||||
{
|
{
|
||||||
String sanitizedName = Util.sanitizeFileName(name);
|
String sanitizedName = Util.sanitizeFileName(name);
|
||||||
if (!sanitizedName.equals(name)) {
|
if (!sanitizedName.equals(name))
|
||||||
return getUser(sanitizedName);
|
{
|
||||||
|
User user = getUser(sanitizedName);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
throw new Exception("User not found!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (Player player : ess.getServer().getOnlinePlayers())
|
for (Player player : ess.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue