Skip to content

Commit

Permalink
Support custom icons in tag preview
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Oct 26, 2024
1 parent 75c38c3 commit 096b807
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.rappytv.globaltags.api.GlobalTagAPI;
import com.rappytv.globaltags.api.Util;
import com.rappytv.globaltags.config.subconfig.TagSubConfig;
import com.rappytv.globaltags.wrapper.enums.GlobalIcon;
import com.rappytv.globaltags.wrapper.model.PlayerInfo;
import net.labymod.api.Laby;
import net.labymod.api.Textures.SpriteCommon;
Expand Down Expand Up @@ -92,16 +93,20 @@ public void initialize(boolean refetched) {
)
: api.translateColorCodes(config.tag().get())
).addId("text");
String iconUrl = config.icon().get().getIconUrl();
if (iconUrl != null)

if (config.icon().get() != GlobalIcon.NONE) {
String iconUrl = config.icon().get() == GlobalIcon.CUSTOM && info.getGlobalIconHash() != null
? api.getUrls().getCustomIcon(api.getClientUUID(), info.getGlobalIconHash())
: api.getUrls().getDefaultIcon(config.icon().get());
this.addEntryInitialized(
new IconWidget(Icon.url(iconUrl))
.addId("icon")
);
}
this.addEntryInitialized(tag);
if (info.getHighestRole() != null)
if (info.getHighestRoleIcon() != null)
this.addEntryInitialized(
new IconWidget(Icon.url(info.getHighestRole().getIconUrl()))
new IconWidget(Icon.url(info.getHighestRoleIcon()))
.addId("staff-icon")
);
}
Expand Down

0 comments on commit 096b807

Please sign in to comment.