Skip to content

Commit 443853a

Browse files
authored
Merge pull request #42 from Global-Tags/development
Renew self when redeeming code, add method to get role icon visibility
2 parents ec53233 + 61746b7 commit 443853a

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/main/java/com/rappytv/globaltags/wrapper/http/ApiHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public void getInfo(@NotNull UUID uuid, @NotNull Consumer<ApiResponse<PlayerInfo
145145
body.icon,
146146
body.referrals,
147147
body.roleIcon,
148+
body.hideRoleIcon,
148149
body.roles,
149150
body.permissions,
150151
body.ban
@@ -704,7 +705,9 @@ public void redeemGiftCode(@NotNull String code, @NotNull Consumer<ApiResponse<G
704705
consumer.accept(new ApiResponse<>(false, null, response.getError()));
705706
return;
706707
}
707-
consumer.accept(new ApiResponse<>(true, response.getData(), null));
708+
this.api.getCache().renewSelf((info) ->
709+
consumer.accept(new ApiResponse<>(true, response.getData(), null))
710+
);
708711
});
709712
}
710713

src/main/java/com/rappytv/globaltags/wrapper/http/schemas/PlayerInfoSchema.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class PlayerInfoSchema {
1010
public PlayerInfo.Icon icon;
1111
public PlayerInfo.ReferralInfo referrals;
1212
public String roleIcon;
13+
public boolean hideRoleIcon;
1314
public String[] roles;
1415
public String[] permissions;
1516
public BanInfo ban;

src/main/java/com/rappytv/globaltags/wrapper/model/PlayerInfo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class PlayerInfo<T> {
2727
private final Icon icon;
2828
private final ReferralInfo referralInfo;
2929
private final String roleIcon;
30+
private final boolean hideRoleIcon;
3031
private final List<String> roles;
3132
private final Map<GlobalPermission, Boolean> permissions;
3233
private final BanInfo banInfo;
@@ -41,6 +42,7 @@ public class PlayerInfo<T> {
4142
* @param icon The player's global icon as a string
4243
* @param referralInfo The player's referral info
4344
* @param roleIcon The player's role icon
45+
* @param hideRoleIcon If the player's role icon is hidden
4446
* @param roles The player's roles
4547
* @param permissions The player's permissions
4648
* @param banInfo The player's {@link BanInfo}
@@ -53,6 +55,7 @@ public PlayerInfo(
5355
@NotNull Icon icon,
5456
ReferralInfo referralInfo,
5557
@Nullable String roleIcon,
58+
boolean hideRoleIcon,
5659
@NotNull String[] roles,
5760
@NotNull String[] permissions,
5861
@Nullable BanInfo banInfo
@@ -65,6 +68,7 @@ public PlayerInfo(
6568
this.icon = icon;
6669
this.referralInfo = referralInfo;
6770
this.roleIcon = roleIcon;
71+
this.hideRoleIcon = hideRoleIcon;
6872
this.roles = List.of(roles);
6973
this.permissions = new HashMap<>();
7074
List<GlobalPermission> playerPermissions = new ArrayList<>();
@@ -224,6 +228,14 @@ public String getRoleIcon() {
224228
return this.roleIcon;
225229
}
226230

231+
/**
232+
* Checks if the player has their role icon hidden
233+
* @return if the player's role icon is hidden or not
234+
*/
235+
public boolean isRoleIconHidden() {
236+
return this.hideRoleIcon;
237+
}
238+
227239
/**
228240
* Gets all roles assigned to the player.
229241
*

0 commit comments

Comments
 (0)