forked from MilkFox2002/Thermos
-
Notifications
You must be signed in to change notification settings - Fork 10
/
minecraft
62 lines (62 loc) · 1.53 KB
/
minecraft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
+package com.mojang.authlib.minecraft;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+
+public final class MinecraftProfileTexture {
+ public static final Set<Type> PROFILE_TEXTURE_TYPES = Collections.unmodifiableSet(EnumSet.allOf(Type.class));
+ public static final int PROFILE_TEXTURE_COUNT = PROFILE_TEXTURE_TYPES.size();
+
+ // Instance
+ private final String url;
+ private final String hash;
+
+ public MinecraftProfileTexture(String url) {
+ this(url, baseName(url));
+ }
+
+ public MinecraftProfileTexture(String url, String hash) {
+ this.url = url;
+ this.hash = hash;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("MinecraftProfileTexture{url='%s',hash=%s}", url, hash);
+ }
+
+ @SuppressWarnings("unused")
+ public String getHash() {
+ return hash;
+ }
+
+ @SuppressWarnings({ "unused", "SameReturnValue" })
+ public String getMetadata(String key) {
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ public String getUrl() {
+ return url;
+ }
+
+ private static String baseName(String url) {
+ String name = url.substring(url.lastIndexOf('/') + 1);
+
+ // Remove index
+ int extensionIndex = name.lastIndexOf('.');
+ if (extensionIndex >= 0) {
+ name = name.substring(0, extensionIndex);
+ }
+
+ // We're done
+ return name;
+ }
+
+ public enum Type {
+ SKIN,
+ CAPE,
+ ELYTRA
+ }
+}