Use getOfflinePlayer(UUID) when retrieving groups. Fixes #361

We were previously using getOfflinePlayer(String), which was not only
blocking, but also being rate limited
This commit is contained in:
eueln 2015-04-14 15:44:14 -04:00
parent 7b522be2c7
commit 8354c95a14

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID;
public abstract class MCommand<T extends MPlugin> { public abstract class MCommand<T extends MPlugin> {
@ -299,7 +300,7 @@ public abstract class MCommand<T extends MPlugin> {
String lastSeen = player.isOnline() ? ChatColor.GREEN + "Online" : (System.currentTimeMillis() - player.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); String lastSeen = player.isOnline() ? ChatColor.GREEN + "Online" : (System.currentTimeMillis() - player.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
String balance = Econ.isSetup() ? Econ.getFriendlyBalance(player) : "no balance"; String balance = Econ.isSetup() ? Econ.getFriendlyBalance(player) : "no balance";
String power = player.getPowerRounded() + "/" + player.getPowerMaxRounded(); String power = player.getPowerRounded() + "/" + player.getPowerMaxRounded();
String group = P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(player.getName())); String group = P.p.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(player.getId())));
return s.replace("{balance}", balance).replace("{lastSeen}", lastSeen).replace("{power}", power).replace("{group}", group); return s.replace("{balance}", balance).replace("{lastSeen}", lastSeen).replace("{power}", power).replace("{group}", group);
} }