Skip to content

Commit

Permalink
Fix weird graphic when GlobalIcon equals GlobalIcon#NONE
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Jul 22, 2024
1 parent b151d4b commit f7b1ef8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -18,6 +19,7 @@ public enum GlobalRole {
));
}

@NotNull
public Icon getIcon() {
return icon;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit f7b1ef8

Please sign in to comment.