Changing discord RPC system

This commit is contained in:
Anuken 2020-06-16 13:43:00 -04:00
parent 6e162d91e5
commit 918c9492df
5 changed files with 9 additions and 7 deletions

View File

@ -190,13 +190,14 @@ project(":desktop"){
implementation arcModule("natives:natives-box2d-desktop")
implementation arcModule("natives:natives-desktop")
implementation arcModule("natives:natives-freetype-desktop")
implementation arcModule("extensions:discord")
if(debugged()) implementation project(":debug")
implementation "com.github.Anuken:steamworks4j:$steamworksVersion"
implementation arcModule("backends:backend-sdl")
implementation 'com.github.MinnDevelopment:java-discord-rpc:v2.0.1'
//implementation 'com.github.MinnDevelopment:java-discord-rpc:v2.0.1'
}
}

Binary file not shown.

Binary file not shown.

View File

@ -4,22 +4,23 @@ import arc.*;
import arc.Files.*;
import arc.backend.sdl.*;
import arc.backend.sdl.jni.*;
import arc.discord.*;
import arc.discord.DiscordRPC.*;
import arc.files.*;
import arc.func.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import arc.util.serialization.*;
import club.minnced.discord.rpc.*;
import com.codedisaster.steamworks.*;
import mindustry.*;
import mindustry.core.*;
import mindustry.desktop.steam.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.net.*;
import mindustry.net.Net.*;
import mindustry.type.*;
import mindustry.gen.*;
import java.io.*;
import java.net.*;
@ -56,11 +57,10 @@ public class DesktopLauncher extends ClientLauncher{
if(useDiscord){
try{
DiscordEventHandlers handlers = new DiscordEventHandlers();
DiscordRPC.INSTANCE.Discord_Initialize(discordID, handlers, true, "1127400");
DiscordRPC.initialize(discordID, true, "1127400");
Log.info("Initialized Discord rich presence.");
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC::shutdown));
}catch(Throwable t){
useDiscord = false;
Log.err("Failed to initialize discord.", t);
@ -282,7 +282,7 @@ public class DesktopLauncher extends ClientLauncher{
presence.largeImageKey = "logo";
DiscordRPC.INSTANCE.Discord_UpdatePresence(presence);
DiscordRPC.updatePresence(presence);
}
if(steam){

View File

@ -36,6 +36,7 @@ if(!hasProperty("release")){
':Arc:extensions:box2d',
':Arc:extensions:g3d',
':Arc:extensions:fx',
':Arc:extensions:discord',
':Arc:natives',
':Arc:natives:natives-desktop',
':Arc:natives:natives-android',