From d341829214683e1dfb9009da1120f3dae290a8f1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:14:03 +0100 Subject: Added LorenzUtils.getPlayerUuid --- .../hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt index 2c21a10a5..4eac3e0bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/EliteFarmingWeight.kt @@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.utils.TimeUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import net.minecraft.client.Minecraft import net.minecraftforge.event.world.WorldEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent @@ -208,7 +207,7 @@ class EliteFarmingWeight { } private suspend fun loadLeaderboardPosition() = try { - val uuid = Minecraft.getMinecraft().thePlayer.uniqueID.toString().replace("-", "") + val uuid = LorenzUtils.getPlayerUuid() val showNext = if (isEtaEnabled()) "?showNext=true" else "" val url = "https://elitebot.dev/api/leaderboard/rank/weight/farming/$uuid/$profileId$showNext" val result = withContext(Dispatchers.IO) { APIUtil.getJSONResponse(url) }.asJsonObject @@ -228,15 +227,8 @@ class EliteFarmingWeight { -1 } - private fun UUID.uuidToString(): String { - return "$this" - } - private suspend fun loadWeight(localProfile: String) { - val thePlayer = Minecraft.getMinecraft().thePlayer - val uniqueID = thePlayer.uniqueID - val abc = uniqueID.uuidToString() - val uuid = abc.replace("-", "") + val uuid = LorenzUtils.getPlayerUuid() val url = "https://elitebot.dev/api/weight/$uuid" try { -- cgit