mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Trycatch Discord Activity (#424)
This commit is contained in:
+23
-11
@@ -7,19 +7,31 @@ public class DiscordActivity {
|
|||||||
private static int count = 50;
|
private static int count = 50;
|
||||||
|
|
||||||
public static void updateActivity() {
|
public static void updateActivity() {
|
||||||
if (JavaCord.token != null && !JavaCord.token.equals("")) {
|
try {
|
||||||
if (count == 0) {
|
if (JavaCord.token != null && !JavaCord.token.equals("")) {
|
||||||
if (PlayerHandler.getPlayerCount() != 1) {
|
if (count == 0) {
|
||||||
JavaCord.api.updateActivity(PlayerHandler.getPlayerCount() + " Players Online");
|
if (PlayerHandler.getPlayerCount() != 1) {
|
||||||
System.out.println("Discord Activity Updated");
|
JavaCord.api.updateActivity(PlayerHandler.getPlayerCount() + " Players Online");
|
||||||
count = 100;
|
System.out.println("Discord Activity Updated");
|
||||||
|
count = 100;
|
||||||
|
} else {
|
||||||
|
JavaCord.api.updateActivity(PlayerHandler.getPlayerCount() + " Player Online");
|
||||||
|
System.out.println("Discord Activity Updated");
|
||||||
|
count = 100;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
JavaCord.api.updateActivity(PlayerHandler.getPlayerCount() + " Player Online");
|
count--;
|
||||||
System.out.println("Discord Activity Updated");
|
|
||||||
count = 100;
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
count--;
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Could not set Discord activity: " + e);
|
||||||
|
System.out.println("Null checks");
|
||||||
|
try {
|
||||||
|
System.out.println("JavaCord.api: " + JavaCord.api);
|
||||||
|
System.out.println("PlayerHandler.getPlayerCount: " + PlayerHandler.getPlayerCount());
|
||||||
|
} catch (Exception e2) {
|
||||||
|
System.out.println(e2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user