CommandHelper

CommandHelper

46.5k Downloads

Feature: have player() accept uuid

LadyCailinBot opened this issue ยท 7 comments

commented

CMDHELPER-3100 - Reported by phanaticd

The player() function should be able to accept a UUID and return a player name. I believe it should be really easy to add with this: Bukkit.getPlayer(uuid).getName();

commented

Comment by phanaticd

yea I know I messed that up :L

commented

Comment by PseudoKnight

The reason this isn't getting traction is that player() already accepts UUIDs for online players, and getting a player name for an offline player is unreliable unless you query Mojang. This would make it entirely inappropriate for player(). Now, Bukkit has a method to get the last known name, I think, but this isn't guaranteed to be accurate and I think it expires after 30 days too. This is accessible in the usercache or player profile files if you want to grab it yourself.

commented

Comment by phanaticd

by the way this would be for offline players too so it would be similar to puuid()

commented

Comment by PseudoKnight

Not sure if player() is the appropriate function for this. It's always been used for online players and in places where only online players can be used. Not sure, though. There's also get_player_from_entity_id(), which needs to be updated anyway, or deprecated along with entity_id if we decide to use player() or something.

commented

Comment by jb_aero

Btw @PhanaticD , that line of code only works on Online players.

commented

Comment by phanaticd

yea I know thats why I requested this because I was trying for an offline player and I wanted to use it to get their username

commented

Comment by PseudoKnight

He's saying Bukkit.getPlayer(uuid) only works for online players. Players are always online (with exceptions?). You'd have to get OfflinePlayer or something.