From f7b1ef85602ad8b162630cabbaf55fdde50fefb4 Mon Sep 17 00:00:00 2001 From: RappyTV Date: Mon, 22 Jul 2024 21:04:13 +0200 Subject: [PATCH] Fix weird graphic when GlobalIcon equals GlobalIcon#NONE --- .../java/com/rappytv/globaltags/types/GlobalIcon.java | 8 +++++++- .../java/com/rappytv/globaltags/types/GlobalRole.java | 2 ++ .../java/com/rappytv/globaltags/types/PlayerInfo.java | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/rappytv/globaltags/types/GlobalIcon.java b/api/src/main/java/com/rappytv/globaltags/types/GlobalIcon.java index edd10b81..f3f12301 100644 --- a/api/src/main/java/com/rappytv/globaltags/types/GlobalIcon.java +++ b/api/src/main/java/com/rappytv/globaltags/types/GlobalIcon.java @@ -2,6 +2,7 @@ import net.labymod.api.client.gui.icon.Icon; import net.labymod.api.client.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; @SuppressWarnings("unused") public enum GlobalIcon { @@ -33,7 +34,12 @@ public enum GlobalIcon { )); } + /** + * Get the {@link Icon} of the {@link GlobalIcon} + * @return The {@link Icon} or null if the {@link GlobalIcon} equals {@link GlobalIcon#NONE} + */ + @Nullable public Icon getIcon() { - return icon; + return this != NONE ? icon : null; } } diff --git a/api/src/main/java/com/rappytv/globaltags/types/GlobalRole.java b/api/src/main/java/com/rappytv/globaltags/types/GlobalRole.java index 9a6dc731..267f1d1d 100644 --- a/api/src/main/java/com/rappytv/globaltags/types/GlobalRole.java +++ b/api/src/main/java/com/rappytv/globaltags/types/GlobalRole.java @@ -2,6 +2,7 @@ import net.labymod.api.client.gui.icon.Icon; import net.labymod.api.client.resources.ResourceLocation; +import org.jetbrains.annotations.NotNull; public enum GlobalRole { ADMIN("purple"), @@ -18,6 +19,7 @@ public enum GlobalRole { )); } + @NotNull public Icon getIcon() { return icon; } diff --git a/api/src/main/java/com/rappytv/globaltags/types/PlayerInfo.java b/api/src/main/java/com/rappytv/globaltags/types/PlayerInfo.java index 51439df7..460c875b 100644 --- a/api/src/main/java/com/rappytv/globaltags/types/PlayerInfo.java +++ b/api/src/main/java/com/rappytv/globaltags/types/PlayerInfo.java @@ -103,6 +103,7 @@ public GlobalIcon getGlobalIcon() { /** * Returns the global icon of the player. See {@link GlobalIcon#getIcon()} */ + @Nullable public Icon getIcon() { return getGlobalIcon().getIcon(); }