File tree Expand file tree Collapse file tree 12 files changed +28
-146
lines changed
src/main/kotlin/com/lambda Expand file tree Collapse file tree 12 files changed +28
-146
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,6 @@ package com.lambda.module
2020import com.lambda.core.Loadable
2121import com.lambda.util.reflections.getInstances
2222
23- /* *
24- * The [ModuleRegistry] object is responsible for managing all [Module] instances in the system.
25- */
2623object ModuleRegistry : Loadable {
2724 override val priority = 1
2825
Original file line number Diff line number Diff line change @@ -53,15 +53,13 @@ import kotlin.time.Duration.Companion.seconds
5353
5454@Suppress(" JavaIoSerializableObjectMustHaveReadResolve" )
5555object CapeManager : ConcurrentHashMap<UUID, String>(), Loadable {
56- // We want to cache images to reduce class B requests
5756 private val images = capes.walk()
5857 .filter { it.extension == " png" }
5958 .associate { it.nameWithoutExtension to NativeImageBackedTexture ({ it.nameWithoutExtension }, read(it.inputStream())) }
6059 .onEach { (key, value) -> mc.textureManager.registerTexture(key.asIdentifier, value) }
6160
6261 private val fetchQueue = mutableListOf<UUID >()
6362
64- // We want to cache the cape list to reduce class B requests
6563 val capeList = runBlocking {
6664 capes.resolveFile(" capes.txt" )
6765 .isOlderThan(24 .hours) {
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ import java.util.*
3030 *
3131 * Example:
3232 * - id: ab24f5d6-dcf1-45e4-897e-b50a7c5e7422
33- *
34- * @return results of cape
3533 */
3634suspend fun getCape (uuid : UUID ) = runCatching {
3735 LambdaHttp .get(" $apiUrl /api/$apiVersion /cape?id=$uuid " ).body<Cape >()
Original file line number Diff line number Diff line change @@ -33,8 +33,6 @@ import java.util.*
3333 * - id: ab24f5d6-dcf1-45e4-897e-b50a7c5e7422
3434 * - id: 4f332cd7-cf93-427e-a282-53f45f6bb113
3535 * - id: fdee323e-7f0c-4c15-8d1c-0f277442342a
36- *
37- * @return results of capes
3836 */
3937suspend fun getCapes (vararg uuid : UUID ) = getCapes(uuid.toList())
4038
@@ -45,8 +43,6 @@ suspend fun getCapes(vararg uuid: UUID) = getCapes(uuid.toList())
4543 * - id: ab24f5d6-dcf1-45e4-897e-b50a7c5e7422
4644 * - id: 4f332cd7-cf93-427e-a282-53f45f6bb113
4745 * - id: fdee323e-7f0c-4c15-8d1c-0f277442342a
48- *
49- * @return results of capes
5046 */
5147suspend fun getCapes (uuids : List <UUID >) = runCatching {
5248 LambdaHttp .get(" $apiUrl /api/$apiVersion /capes" ) {
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ import io.ktor.http.*
3131 *
3232 * Example:
3333 * - token: OTk1MTU1NzcyMzYxMTQ2NDM4
34- *
35- * @return result of [Authentication]
3634 */
3735suspend fun linkDiscord (discordToken : String ) = runCatching {
3836 LambdaHttp .post(" ${apiUrl} /api/$apiVersion /link/discord" ) {
Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ import io.ktor.http.*
3131 * Example:
3232 * - username: Notch
3333 * - hash: 069a79f444e94726a5befca90e38aaf5
34- *
35- * @return result of [Authentication]
3634 */
3735suspend fun login (username : String , hash : String ) = runCatching {
3836 LambdaHttp .post(" ${apiUrl} /api/$apiVersion /login" ) {
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ import io.ktor.http.*
2929 *
3030 * Example:
3131 * - id: galaxy
32- *
33- * @return nothing
3432 */
3533suspend fun setCape (id : String ) = runCatching {
3634 val resp = LambdaHttp .put(" $apiUrl /api/$apiVersion /cape?id=$id " ) {
Original file line number Diff line number Diff line change @@ -20,18 +20,12 @@ package com.lambda.network.api.v1.models
2020import com.google.gson.annotations.SerializedName
2121
2222data class Authentication (
23- // The access token to use for the API
24- // example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
2523 @SerializedName(" access_token" )
2624 val accessToken : String ,
2725
28- // The duration of the token (in seconds).
29- // example: 3600
3026 @SerializedName(" expires_in" )
3127 val expiresIn : Long ,
3228
33- // The type of the token.
34- // example: Bearer
3529 @SerializedName(" token_type" )
3630 val tokenType : String ,
3731) {
Original file line number Diff line number Diff line change @@ -21,18 +21,12 @@ import com.google.gson.annotations.SerializedName
2121import java.util.*
2222
2323data class Player (
24- // The player's name.
25- // example: Notch
2624 @SerializedName(" name" )
2725 val name : String ,
2826
29- // The player's UUID.
30- // example: 069a79f4-44e9-4726-a5be-fca90e38aaf5
3127 @SerializedName(" id" )
3228 val uuid : UUID ,
3329
34- // The player's Discord ID.
35- // example: "385441179069579265"
3630 @SerializedName(" discord_id" )
3731 val discordId : String ,
3832
Original file line number Diff line number Diff line change @@ -28,8 +28,6 @@ import java.util.*
2828 *
2929 * Example:
3030 * - name: jeb_
31- *
32- * @return result of [GameProfile]
3331 */
3432suspend fun getProfile (name : String ) = runCatching {
3533 LambdaHttp .get(" https://api.mojang.com/users/profiles/minecraft/$name " ).body<GameProfile >()
@@ -40,8 +38,6 @@ suspend fun getProfile(name: String) = runCatching {
4038 *
4139 * Example:
4240 * - name: ab24f5d6-dcf1-45e4-897e-b50a7c5e7422
43- *
44- * @return result of [GameProfile]
4541 */
4642suspend fun getProfile (uuid : UUID ) = runCatching {
4743 LambdaHttp .get(" https://api.minecraftservices.com/minecraft/profile/lookup/$uuid " ).body<GameProfile >()
You can’t perform that action at this time.
0 commit comments