Created
May 22, 2020 08:33
-
-
Save riftrsps/7ce5a76c05c095d3c795e70629da788c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import club.minnced.discord.rpc.DiscordEventHandlers; | |
import club.minnced.discord.rpc.DiscordRPC; | |
import club.minnced.discord.rpc.DiscordRichPresence; | |
public class DiscordPresenceMinn { | |
public static void launch() { | |
DiscordRPC lib = DiscordRPC.INSTANCE; | |
String applicationId = "REDACTED"; | |
String steamId = ""; | |
DiscordEventHandlers handlers = new DiscordEventHandlers(); | |
handlers.ready = (user) -> System.out.println("Ready!"); | |
lib.Discord_Initialize(applicationId, handlers, true, steamId); | |
DiscordRichPresence presence = new DiscordRichPresence(); | |
presence.startTimestamp = System.currentTimeMillis() / 1000; // epoch second | |
presence.details = "Using Minn API"; | |
lib.Discord_UpdatePresence(presence); | |
// in a worker thread | |
new Thread(() -> { | |
while (!Thread.currentThread().isInterrupted()) { | |
lib.Discord_RunCallbacks(); | |
try { | |
Thread.sleep(2000); | |
} catch (InterruptedException ignored) {} | |
} | |
}, "RPC-Callback-Handler").start(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
parseArguments(args); | |
System.setProperty("java.net.preferIPv4Stack", "true"); | |
if (!printToConsole) | |
ErrorStore.setOutputToFile(); | |
DiscordPresenceMinn.launch(); | |
GameLoop loop = new GameLoop(); | |
Keyboard keyboard = new Keyboard(); | |
Mouse mouse = new Mouse(); | |
RSApplet applet = buildApplet(keyboard, mouse); | |
Game game = buildClient(applet, loop, keyboard, mouse); | |
buildFrame(applet); | |
loop.start(game); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment