Skip to content

Commit d7d3028

Browse files
Deprecate api-querying skull builder methods
1 parent 77afab1 commit d7d3028

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

invui-core/src/main/java/xyz/xenondevs/invui/item/builder/SkullBuilder.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public final class SkullBuilder extends AbstractItemBuilder<SkullBuilder> {
3535
* @param uuid The {@link UUID} of the skull owner.
3636
* @throws MojangApiException If the Mojang API returns an error.
3737
* @throws IOException If an I/O error occurs.
38+
* @deprecated Prefer using {@link SkullBuilder#SkullBuilder(HeadTexture)} with a hardcoded texture value instead of querying the Mojang API.
3839
*/
40+
@Deprecated
3941
public SkullBuilder(@NotNull UUID uuid) throws MojangApiException, IOException {
4042
this(HeadTexture.of(uuid));
4143
}
@@ -46,7 +48,9 @@ public SkullBuilder(@NotNull UUID uuid) throws MojangApiException, IOException {
4648
* @param username The username of the skull owner.
4749
* @throws MojangApiException If the Mojang API returns an error.
4850
* @throws IOException If an I/O error occurs.
51+
* @deprecated Prefer using {@link SkullBuilder#SkullBuilder(HeadTexture)} with a hardcoded texture value instead of querying the Mojang API.
4952
*/
53+
@Deprecated
5054
public SkullBuilder(@NotNull String username) throws MojangApiException, IOException {
5155
this(HeadTexture.of(username));
5256
}
@@ -140,7 +144,9 @@ public HeadTexture(@NotNull String textureValue) {
140144
* @throws MojangApiException If the Mojang API returns an error.
141145
* @throws IOException If an I/O error occurs.
142146
* @see HeadTexture#of(UUID)
147+
* @deprecated Prefer using {@link HeadTexture#HeadTexture(String)} with a hardcoded texture value instead of querying the Mojang API.
143148
*/
149+
@Deprecated
144150
public static @NotNull HeadTexture of(@NotNull OfflinePlayer offlinePlayer) throws MojangApiException, IOException {
145151
return of(offlinePlayer.getUniqueId());
146152
}
@@ -158,8 +164,9 @@ public HeadTexture(@NotNull String textureValue) {
158164
* @throws MojangApiException If the Mojang API returns an error.
159165
* @throws IOException If an I/O error occurs.
160166
* @see HeadTexture#of(UUID)
167+
* @deprecated Prefer using {@link HeadTexture#HeadTexture(String)} with a hardcoded texture value instead of querying the Mojang API.
161168
*/
162-
@SuppressWarnings("deprecation")
169+
@Deprecated
163170
public static @NotNull HeadTexture of(@NotNull String playerName) throws MojangApiException, IOException {
164171
if (Bukkit.getServer().getOnlineMode()) {
165172
// if the server is in online mode, the Minecraft UUID cache (usercache.json) can be used
@@ -190,7 +197,9 @@ public HeadTexture(@NotNull String textureValue) {
190197
* @return The {@link HeadTexture} of that player.
191198
* @throws MojangApiException If the Mojang API returns an error.
192199
* @throws IOException If an I/O error occurs.
200+
* @deprecated Prefer using {@link HeadTexture#HeadTexture(String)} with a hardcoded texture value instead of querying the Mojang API.
193201
*/
202+
@Deprecated
194203
public static @NotNull HeadTexture of(@NotNull UUID uuid) throws MojangApiException, IOException {
195204
try {
196205
return new HeadTexture(textureCache.get(uuid, () -> MojangApiUtils.getSkinData(uuid, false)[0]));
@@ -211,7 +220,10 @@ public HeadTexture(@NotNull String textureValue) {
211220
* This means that when {@link HeadTexture#of(OfflinePlayer)}, {@link HeadTexture#of(UUID)}
212221
* and {@link HeadTexture#of(String)} are called, these values will be pulled from the
213222
* Mojang API again.
223+
*
224+
* @deprecated Prefer using {@link HeadTexture#HeadTexture(String)} with a hardcoded texture value instead of querying the Mojang API.
214225
*/
226+
@Deprecated
215227
public static void invalidateCache() {
216228
uuidCache.invalidateAll();
217229
textureCache.invalidateAll();

invui-core/src/main/java/xyz/xenondevs/invui/util/MojangApiUtils.java

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.net.URL;
1111
import java.util.UUID;
1212

13+
@Deprecated
1314
public class MojangApiUtils {
1415

1516
private static final String SKIN_DATA_URL = "https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=%s";

0 commit comments

Comments
 (0)