summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-03-03 09:01:07 +0000
committerKHobbits <rob@khobbits.co.uk>2014-03-03 09:01:07 +0000
commitff06a55ea5190598ba96ca8e56484aeb9de9b5f6 (patch)
tree50134f13e9d7a36486a72dae6297a6d9e0f6628f
parentb38485dce055e0a0bab4b52c88ceca0dcb35b2b9 (diff)
downloadEssentials-ff06a55ea5190598ba96ca8e56484aeb9de9b5f6.tar
Essentials-ff06a55ea5190598ba96ca8e56484aeb9de9b5f6.tar.gz
Essentials-ff06a55ea5190598ba96ca8e56484aeb9de9b5f6.tar.lz
Essentials-ff06a55ea5190598ba96ca8e56484aeb9de9b5f6.tar.xz
Essentials-ff06a55ea5190598ba96ca8e56484aeb9de9b5f6.zip
User loading cleanup
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/UserMap.java20
2 files changed, 7 insertions, 16 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 1383c65d9..36c36c602 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -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)
{
diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java
index c96dd0343..2b2f26a1a 100644
--- a/Essentials/src/com/earth2me/essentials/UserMap.java
+++ b/Essentials/src/com/earth2me/essentials/UserMap.java
@@ -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);