2022-02-03 16:56:26 -05:00
|
|
|
package com.discord.rpc;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
public final class DiscordRPC {
|
|
|
|
private final long handle;
|
|
|
|
|
|
|
|
private DiscordRPC(long handle) {
|
|
|
|
this.handle = handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the new client instance, or null if an error occurred.
|
|
|
|
*/
|
|
|
|
public static native DiscordRPC create();
|
|
|
|
|
|
|
|
public native boolean connect(String clientId);
|
|
|
|
|
2022-03-21 13:19:12 -04:00
|
|
|
public native boolean disconnect();
|
|
|
|
|
2022-02-03 16:56:26 -05:00
|
|
|
public native boolean setActivity(Activity activity);
|
|
|
|
|
2022-03-21 13:19:12 -04:00
|
|
|
public native boolean clearActivity();
|
|
|
|
|
2022-02-03 16:56:26 -05:00
|
|
|
static {
|
|
|
|
final var dir = System.getProperty("com.discord.librarypath");
|
|
|
|
if (dir != null) {
|
|
|
|
System.load(dir + File.separator + System.mapLibraryName("discord_rpc"));
|
|
|
|
} else {
|
|
|
|
System.loadLibrary("discord_rpc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-21 13:19:12 -04:00
|
|
|
/**
|
|
|
|
* This method does nothing, but ensures that the native library will be loaded.
|
|
|
|
*/
|
|
|
|
public static void initialize() {
|
|
|
|
}
|
|
|
|
}
|