mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-09 18:07:37 +01:00
Don't return null, throw an exception
This commit is contained in:
parent
cfdb2a36c1
commit
3c98718387
@ -77,8 +77,17 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
public User load(final String name) throws Exception
|
||||
{
|
||||
String sanitizedName = Util.sanitizeFileName(name);
|
||||
if (!sanitizedName.equals(name)) {
|
||||
return getUser(sanitizedName);
|
||||
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())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user