summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-12-19 12:39:23 +0100
committersnowleo <schneeleo@gmail.com>2011-12-19 12:39:23 +0100
commit5bb7d82fca1e600107de1b6a588241e600aaf55e (patch)
treed401f891bea9588d05c74eebd0b94ea710c7439f
parent5a092f0e9929e82cf4f5792b9744bca5c0ecc1ca (diff)
downloadEssentials-5bb7d82fca1e600107de1b6a588241e600aaf55e.tar
Essentials-5bb7d82fca1e600107de1b6a588241e600aaf55e.tar.gz
Essentials-5bb7d82fca1e600107de1b6a588241e600aaf55e.tar.lz
Essentials-5bb7d82fca1e600107de1b6a588241e600aaf55e.tar.xz
Essentials-5bb7d82fca1e600107de1b6a588241e600aaf55e.zip
Fix double names in /balancetop and show display name in balancetop
-rw-r--r--Essentials/src/com/earth2me/essentials/UserMap.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java2
2 files changed, 8 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java
index 467c2693b..f6b75c3a5 100644
--- a/Essentials/src/com/earth2me/essentials/UserMap.java
+++ b/Essentials/src/com/earth2me/essentials/UserMap.java
@@ -47,7 +47,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
continue;
}
final String name = string.substring(0, string.length() - 4);
- keys.add(name.toLowerCase(Locale.ENGLISH));
+ keys.add(Util.sanitizeFileName(name));
}
}
});
@@ -55,14 +55,14 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public boolean userExists(final String name)
{
- return keys.contains(name.toLowerCase(Locale.ENGLISH));
+ return keys.contains(Util.sanitizeFileName(name));
}
public User getUser(final String name)
{
try
{
- return users.get(name.toLowerCase(Locale.ENGLISH));
+ return users.get(Util.sanitizeFileName(name));
}
catch (ExecutionException ex)
{
@@ -81,14 +81,14 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
if (player.getName().equalsIgnoreCase(name))
{
- keys.add(name.toLowerCase(Locale.ENGLISH));
+ keys.add(Util.sanitizeFileName(name));
return new User(player, ess);
}
}
final File userFile = getUserFile(name);
if (userFile.exists())
{
- keys.add(name.toLowerCase(Locale.ENGLISH));
+ keys.add(Util.sanitizeFileName(name));
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
@@ -102,8 +102,8 @@ public class UserMap extends CacheLoader<String, User> implements IConf
public void removeUser(final String name)
{
- keys.remove(name.toLowerCase(Locale.ENGLISH));
- users.invalidate(name.toLowerCase(Locale.ENGLISH));
+ keys.remove(Util.sanitizeFileName(name));
+ users.invalidate(Util.sanitizeFileName(name));
}
public Set<String> getAllUniqueUsers()
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
index 5f73f84c2..672f1c6ca 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java
@@ -112,7 +112,7 @@ public class Commandbalancetop extends EssentialsCommand
final User user = ess.getUserMap().getUser(u);
if (user != null)
{
- balances.put(u, user.getMoney());
+ balances.put(user.getDisplayName(), user.getMoney());
}
}