|
15 | 15 | import meteordevelopment.discordipc.RichPresence; |
16 | 16 | import net.minecraft.client.util.math.MatrixStack; |
17 | 17 |
|
| 18 | +import java.io.BufferedReader; |
| 19 | +import java.io.IOException; |
| 20 | +import java.io.InputStreamReader; |
| 21 | +import java.net.MalformedURLException; |
| 22 | +import java.net.URL; |
18 | 23 | import java.time.Instant; |
| 24 | +import java.util.Objects; |
19 | 25 | import java.util.concurrent.ExecutorService; |
20 | 26 | import java.util.concurrent.Executors; |
21 | 27 |
|
@@ -66,7 +72,7 @@ void setState() { |
66 | 72 | RichPresence rp = new RichPresence(); |
67 | 73 | rp.setDetails(details.getValue()); |
68 | 74 | rp.setState(state.getValue()); |
69 | | - rp.setLargeImage("big", "discord.gg/wRMaDcMceR"); |
| 75 | + rp.setLargeImage("big", Objects.requireNonNull(getlatestdiscord())); |
70 | 76 | rp.setSmallImage("smol", "not 0x150"); |
71 | 77 | rp.setStart(startTime); |
72 | 78 | DiscordIPC.setActivity(rp); |
@@ -111,4 +117,27 @@ public void onWorldRender(MatrixStack matrices) { |
111 | 117 | public void onHudRender() { |
112 | 118 |
|
113 | 119 | } |
| 120 | + |
| 121 | + private String getlatestdiscord(){ |
| 122 | + String text = null; |
| 123 | + try { |
| 124 | + |
| 125 | + URL url = new URL("https://pastebin.com/raw/qD2CJRZs"); |
| 126 | + |
| 127 | + // read text returned by server |
| 128 | + BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); |
| 129 | + |
| 130 | + String line; |
| 131 | + while ((line = in.readLine()) != null) { |
| 132 | + text = line; |
| 133 | + } |
| 134 | + in.close(); |
| 135 | + |
| 136 | + } catch (MalformedURLException e) { |
| 137 | + throw new RuntimeException(e); |
| 138 | + } catch (IOException e) { |
| 139 | + throw new RuntimeException(e); |
| 140 | + } |
| 141 | + return text; |
| 142 | + } |
114 | 143 | } |
0 commit comments