Added support for UUID-based player lookups in 1.7.5+

You could argue that ShadowRanger's conversion of everything to UUID is better, but that would result in us having to contact Mojang's servers simply to fetch a player by UUID for versions < 1.7.5. It seems excessive (not to mention that uncached contact can result in rate limiting) when the server itself will not remember who they are across name changes. If they can re-obtain everything in their inventory, they can re-run /ac.
This commit is contained in:
Jikoo
2016-11-26 15:31:53 -05:00
parent d7eec528e4
commit 8a6b98614f
21 changed files with 286 additions and 2 deletions

View File

@@ -59,4 +59,14 @@ public class PlayerDataManager implements IPlayerDataManager {
return player.getName();
}
@Override
public OfflinePlayer getPlayerByID(String identifier) {
OfflinePlayer player = Bukkit.getOfflinePlayer(identifier);
// Ensure player is a real player, otherwise return null
if (player == null || !player.hasPlayedBefore() && !player.isOnline()) {
return null;
}
return player;
}
}