Skip to content

Commit

Permalink
Better name fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Sep 18, 2024
1 parent 51eb890 commit fafb64d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.railwayteam.railways.compat.journeymap;

import com.mojang.authlib.GameProfile;
import com.railwayteam.railways.Railways;
import com.railwayteam.railways.annotation.event.MultiLoaderEvent;
import journeymap.client.api.IClientAPI;
Expand Down Expand Up @@ -189,13 +190,14 @@ public void onJoinWorld() {
}

public static String getNameFromUUID(UUID uuid) {
ClientPacketListener connection = Minecraft.getInstance().getConnection();
Minecraft mc = Minecraft.getInstance();
ClientPacketListener connection = mc.getConnection();
if (connection != null) {
PlayerInfo info = connection.getPlayerInfo(uuid);
if (info != null) {
return info.getProfile().getName();
}
}
return "Unknown Player";
return mc.getMinecraftSessionService().fillProfileProperties(new GameProfile(uuid, null), true).getName();
}
}

0 comments on commit fafb64d

Please sign in to comment.