diff --git a/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java index b63213e8c0..60f272c0fe 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java @@ -14,6 +14,7 @@ import de.hysky.skyblocker.skyblock.profileviewer.inventory.InventoryPage; import de.hysky.skyblocker.skyblock.profileviewer.skills.SkillsPage; import de.hysky.skyblocker.skyblock.profileviewer.slayers.SlayersPage; +import de.hysky.skyblocker.utils.ApiAuthentication; import de.hysky.skyblocker.utils.ApiUtils; import de.hysky.skyblocker.utils.Http; import de.hysky.skyblocker.utils.ProfileUtils; @@ -61,6 +62,7 @@ public class ProfileViewerScreen extends Screen { private JsonObject hypixelProfile; private JsonObject playerProfile; private boolean profileNotFound = false; + private String errorMessage = "No Profile"; private int activePage = 0; private static final String[] PAGE_NAMES = {"Skills", "Slayers", "Dungeons", "Inventories", "Collections"}; @@ -121,7 +123,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { profileViewerPages[activePage].markWidgetsAsVisible(); profileViewerPages[activePage].render(context, mouseX, mouseY, delta, rootX + 93, rootY + 7); } else { - context.drawText(textRenderer, profileNotFound ? "No Profile" : "Loading...", rootX + 180, rootY + 80, Color.WHITE.getRGB(), true); + context.drawCenteredTextWithShadow(textRenderer, profileNotFound ? errorMessage : "Loading...", rootX + 200, rootY + 80, Color.WHITE.getRGB()); } } @@ -144,6 +146,7 @@ private CompletableFuture fetchPlayerData(String username) { this.playerProfile = hypixelProfile.getAsJsonObject("members").get(ApiUtils.name2Uuid(username)).getAsJsonObject(); } } catch (Exception e) { + this.errorMessage = ApiAuthentication.getToken() == null ? "Invalid Skyblocker token" : "Skyblock profile not found"; this.profileNotFound = true; LOGGER.warn("[Skyblocker Profile Viewer] Error while looking for profile", e); } @@ -153,7 +156,9 @@ private CompletableFuture fetchPlayerData(String username) { String stringifiedUuid = ApiUtils.name2Uuid(username); if (stringifiedUuid.isEmpty()) { + // "Player not found" doesn't fit on the screen lol this.playerName = "User not found"; + this.errorMessage = "Player UUID not found"; this.profileNotFound = true; } @@ -181,7 +186,9 @@ public boolean isInvisibleTo(PlayerEntity player) { }; entity.setCustomNameVisible(false); }).exceptionally(ex -> { + // "Player not found" doesn't fit on the screen lol this.playerName = "User not found"; + this.errorMessage = "Player skin not found"; this.profileNotFound = true; return null; }).join();