From 4c5594d243585b6d58d85a0ec2bcb0f1fd9611ae Mon Sep 17 00:00:00 2001 From: Bella Date: Mon, 16 Dec 2019 10:57:56 -0500 Subject: [PATCH] add donators to rpc --- assets/donators.json | 41 +++++++++++++++++++ .../java/me/zeroeightsix/kami/KamiMod.java | 5 ++- .../module/modules/bewwawho/util/Donator.java | 34 +++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 assets/donators.json create mode 100644 src/main/java/me/zeroeightsix/kami/module/modules/bewwawho/util/Donator.java diff --git a/assets/donators.json b/assets/donators.json new file mode 100644 index 00000000..38a7f8c8 --- /dev/null +++ b/assets/donators.json @@ -0,0 +1,41 @@ +[ + { + "uuid": "47f78584-c76c-4191-92fd-8c943af13054" + }, + { + "uuid": "8eea2cfc-9ebb-41dd-a77f-007404d98d4b" + }, + { + "uuid": "071c6502-2cac-49a7-b316-b57866c69f83" + }, + { + "uuid": "f6d096cb-b784-4c05-9f4f-a0af9e397d98" + }, + { + "uuid": "c1ca957e-fb26-4ea0-b339-20802fcf2d33" + }, + { + "uuid": "6ebdb21b-cf9c-40be-8357-18f872af4010" + }, + { + "uuid": "13ffb8cf-a576-45ee-898d-47ce897f5968" + }, + { + "uuid": "bf6c551f-fd57-4eed-b2c7-0444d71ada0c" + }, + { + "uuid": "a24f24b9-c0e2-4444-b64c-cb75dfe0cfc8" + }, + { + "uuid": "550edc4e-8e55-47f5-96a5-c54e9c9fa964" + }, + { + "uuid": "7a0d7fb8-2955-4b8e-a09f-d6859536c531" + }, + { + "uuid": "c9625a76-ac02-4a4c-b5df-cf6a5209cdc7" + }, + { + "uuid": "65781e1c-1318-4fa4-8133-28f309fe5f59" + } +] diff --git a/src/main/java/me/zeroeightsix/kami/KamiMod.java b/src/main/java/me/zeroeightsix/kami/KamiMod.java index 0a9e7ae6..5d7b37b3 100644 --- a/src/main/java/me/zeroeightsix/kami/KamiMod.java +++ b/src/main/java/me/zeroeightsix/kami/KamiMod.java @@ -19,6 +19,7 @@ import me.zeroeightsix.kami.module.Module; import me.zeroeightsix.kami.module.ModuleManager; import me.zeroeightsix.kami.module.modules.bewwawho.capes.Capes; import me.zeroeightsix.kami.module.modules.bewwawho.misc.BlueDiscordRPC; +import me.zeroeightsix.kami.module.modules.bewwawho.util.Donator; import me.zeroeightsix.kami.setting.Setting; import me.zeroeightsix.kami.setting.Settings; import me.zeroeightsix.kami.setting.SettingsRegister; @@ -49,7 +50,7 @@ import java.util.Optional; /** * Created by 086 on 7/11/2017. - * Updated by S-B99 on 15/12/19 + * Updated by S-B99 on 16/12/19 */ @Mod( modid = KamiMod.MODID, @@ -99,7 +100,7 @@ public class KamiMod { @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { - for (Capes.CapeUser user : Capes.INSTANCE.capeUser) { + for (Donator.DonatorUser user : Donator.INSTANCE.donatorUsers) { if (user.uuid.equalsIgnoreCase(Minecraft.getMinecraft().session.getProfile().getId().toString())) { DiscordPresence.presence.smallImageKey = "donator2"; DiscordPresence.presence.smallImageText = "donator uwu"; diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/bewwawho/util/Donator.java b/src/main/java/me/zeroeightsix/kami/module/modules/bewwawho/util/Donator.java new file mode 100644 index 00000000..f1025e2e --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/bewwawho/util/Donator.java @@ -0,0 +1,34 @@ +package me.zeroeightsix.kami.module.modules.bewwawho.util; + +import com.google.gson.Gson; +import me.zeroeightsix.kami.KamiMod; + +import javax.net.ssl.HttpsURLConnection; +import java.io.InputStreamReader; +import java.net.URL; + +/*** + * @author S-B99 + */ +public class Donator { + + public static Donator INSTANCE; + public DonatorUser[] donatorUsers; + + public class DonatorUser { + public String uuid; + } + + public Donator() { + INSTANCE = this; + try { + HttpsURLConnection connection = (HttpsURLConnection) new URL("https://raw.githubusercontent.com/S-B99/KAMI/features-master/assets/capes.json").openConnection(); + connection.connect(); + this.donatorUsers = new Gson().fromJson(new InputStreamReader(connection.getInputStream()), DonatorUser[].class); + connection.disconnect(); + } catch (Exception e) { + KamiMod.log.error("Failed to load capes"); + e.printStackTrace(); + } + } +}