This repository was archived by the owner on Dec 12, 2025. It is now read-only.
forked from kami-blue/cape-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataClasses.kt
More file actions
73 lines (63 loc) · 1.77 KB
/
DataClasses.kt
File metadata and controls
73 lines (63 loc) · 1.77 KB
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
63
64
65
66
67
68
69
70
71
72
package com.lambda.capeapi
import com.google.gson.annotations.SerializedName
import java.util.*
data class CapeUser(
val id: Long,
val capes: ArrayList<Cape>,
@SerializedName("is_premium")
var isPremium: Boolean = false
) {
override fun equals(other: Any?): Boolean {
return this === other
|| other is CapeUser
&& other.id == this.id
&& other.capes == capes
}
override fun hashCode(): Int {
return 31 * id.hashCode() + capes.hashCode()
}
}
data class Cape(
@SerializedName("cape_uuid")
val capeUUID: String = UUID.randomUUID().toString().substring(0, 5),
@SerializedName("player_uuid")
var playerUUID: UUID? = null,
val type: CapeType,
var color: CapeColor = type.color
) {
override fun equals(other: Any?): Boolean {
return this === other
|| other is Cape
&& other.capeUUID == capeUUID
&& other.type == other.type
}
override fun hashCode(): Int {
return 31 * capeUUID.hashCode() + type.hashCode()
}
}
data class CapeColor(
val primary: String,
val border: String
) {
override fun toString(): String {
return "#$primary, #$border"
}
}
data class PlayerProfile(
@SerializedName("uuid", alternate = ["UUID"])
val uuid: UUID,
@SerializedName("name", alternate = ["Name"])
val name: String
) {
override fun equals(other: Any?): Boolean {
return this === other
|| other is PlayerProfile
&& other.uuid == uuid
}
override fun hashCode(): Int {
return uuid.hashCode()
}
}
enum class CapeType(val realName: String, val imageKey: String, val color: CapeColor) {
CONTRIBUTOR("Contributor", "github", CapeColor("272727", "363636"))
}