mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Fix double names in /balancetop and show display name in balancetop
This commit is contained in:
parent
5a092f0e99
commit
5bb7d82fca
@ -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()
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user