mirror of https://github.com/kami-blue/client
comment out broken code so ppl can build
This commit is contained in:
parent
3095ad7cdf
commit
6edb174b75
|
@ -29,129 +29,129 @@ public class DiscordKBlueRPC extends Module {
|
|||
//1// }
|
||||
//1//}
|
||||
|
||||
private static final String APP_ID = "638403216278683661";
|
||||
private static final DiscordKBlueRPC rpc = DiscordKBlueRPC.INSTANCE;
|
||||
|
||||
private static DiscordRichPresence presence = new DiscordRichPresence();
|
||||
|
||||
private static boolean hasStarted = false;
|
||||
|
||||
public static boolean start()
|
||||
{
|
||||
FMLLog.log.info("Starting Discord RPC");
|
||||
|
||||
if(hasStarted) return false;
|
||||
|
||||
hasStarted = true;
|
||||
|
||||
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||
|
||||
handlers.disconnected = (int var1, String var2) ->
|
||||
{
|
||||
System.out.println("Discord RPC disconnected, var1: " + String.valueOf(var1) + ", var2: " + var2);
|
||||
};
|
||||
|
||||
rpc.Discord_Initialize(APP_ID, handlers, true, "");
|
||||
|
||||
presence.startTimestamp = System.currentTimeMillis() / 1000;
|
||||
presence.details = "Main Menu";
|
||||
presence.state = "discord.gg/ncQkFKU";
|
||||
//presence.smallImageKey = "backdoored_logo";
|
||||
presence.largeImageKey = "backdoored_logo";
|
||||
//presence.spectateSecret = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
//presence.joinSecret = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
|
||||
rpc.Discord_UpdatePresence(presence);
|
||||
|
||||
new Thread(() ->
|
||||
{
|
||||
while(!Thread.currentThread().isInterrupted())
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// Run callbacks
|
||||
rpc.Discord_RunCallbacks();
|
||||
|
||||
String details = "";
|
||||
String state = "";
|
||||
int players = 0;
|
||||
int maxPlayers = 0;
|
||||
|
||||
// If we're in singleplayer
|
||||
if (Globals.mc.isIntegratedServerRunning())
|
||||
{
|
||||
details = "Singleplayer";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Globals.mc.getCurrentServerData() != null)
|
||||
{
|
||||
ServerData svr = Globals.mc.getCurrentServerData();
|
||||
if (!svr.serverIP.equals(""))
|
||||
{
|
||||
// If we're on multiplayer
|
||||
details = "Multiplayer";
|
||||
state = svr.serverIP;
|
||||
if(svr.populationInfo != null)
|
||||
{
|
||||
String[] popInfo = svr.populationInfo.split("/");
|
||||
if(popInfo.length > 2)
|
||||
{
|
||||
players = Integer.valueOf(popInfo[0]);
|
||||
maxPlayers = Integer.valueOf(popInfo[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(state.contains("2b2t.org"))
|
||||
{
|
||||
try
|
||||
{
|
||||
if(Backdoored.lastChat.startsWith("Position in queue: "))
|
||||
{
|
||||
state = state + " " + Integer.parseInt(Backdoored.lastChat.substring(19)) + " in queue";
|
||||
}
|
||||
} catch(Throwable e){ e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we're in the main menu
|
||||
else
|
||||
{
|
||||
details = "Main Menu";
|
||||
state = "discord.gg/ncQkFKU";
|
||||
}
|
||||
}
|
||||
|
||||
if(!details.equals(presence.details) || !state.equals(presence.state))
|
||||
{
|
||||
presence.startTimestamp = System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
presence.details = details;
|
||||
presence.state = state;
|
||||
//presence.partySize = players;
|
||||
//presence.partyMax = maxPlayers;
|
||||
|
||||
/*if(players > 0)
|
||||
{
|
||||
presence.partyId = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
}*/
|
||||
|
||||
rpc.Discord_UpdatePresence(presence);
|
||||
} catch(Exception e){e.printStackTrace();}
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
catch(InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, "Discord-RPC-Callback-Handler").start();
|
||||
FMLLog.log.info("Discord RPC initialised succesfully");
|
||||
return true;
|
||||
}
|
||||
//2//private static final String APP_ID = "638403216278683661";
|
||||
//2//private static final DiscordKBlueRPC rpc = DiscordKBlueRPC.INSTANCE;
|
||||
//2//
|
||||
//2//private static DiscordRichPresence presence = new DiscordRichPresence();
|
||||
//2//
|
||||
//2//private static boolean hasStarted = false;
|
||||
//2//
|
||||
//2//public static boolean start()
|
||||
//2//{
|
||||
//2//FMLLog.log.info("Starting Discord RPC");
|
||||
//2//
|
||||
//2// if(hasStarted) return false;
|
||||
//2//
|
||||
//2// hasStarted = true;
|
||||
//2//
|
||||
//2// DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||
//2//
|
||||
//2// handlers.disconnected = (int var1, String var2) ->
|
||||
//2// {
|
||||
//2// System.out.println("Discord RPC disconnected, var1: " + String.valueOf(var1) + ", var2: " + var2);
|
||||
//2// };
|
||||
//2//
|
||||
//2// rpc.Discord_Initialize(APP_ID, handlers, true, "");
|
||||
//2//
|
||||
//2// presence.startTimestamp = System.currentTimeMillis() / 1000;
|
||||
//2// presence.details = "Main Menu";
|
||||
//2// presence.state = "discord.gg/ncQkFKU";
|
||||
//2// //presence.smallImageKey = "backdoored_logo";
|
||||
//2// presence.largeImageKey = "backdoored_logo";
|
||||
//2// //presence.spectateSecret = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
//2// //presence.joinSecret = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
//2//
|
||||
//2// rpc.Discord_UpdatePresence(presence);
|
||||
//2//
|
||||
//2// new Thread(() ->
|
||||
//2// {
|
||||
//2// while(!Thread.currentThread().isInterrupted())
|
||||
//2// {
|
||||
//2//
|
||||
//2// try
|
||||
//2// {
|
||||
//2// // Run callbacks
|
||||
//2// rpc.Discord_RunCallbacks();
|
||||
//2//
|
||||
//2// String details = "";
|
||||
//2// String state = "";
|
||||
//2// int players = 0;
|
||||
//2// int maxPlayers = 0;
|
||||
//2//
|
||||
//2// // If we're in singleplayer
|
||||
//2// if (Globals.mc.isIntegratedServerRunning())
|
||||
//2// {
|
||||
//2// details = "Singleplayer";
|
||||
//2// }
|
||||
//2// else
|
||||
//2// {
|
||||
//2// if (Globals.mc.getCurrentServerData() != null)
|
||||
//2// {
|
||||
//2// ServerData svr = Globals.mc.getCurrentServerData();
|
||||
//2// if (!svr.serverIP.equals(""))
|
||||
//2// {
|
||||
//2// // If we're on multiplayer
|
||||
//2// details = "Multiplayer";
|
||||
//2// state = svr.serverIP;
|
||||
//2// if(svr.populationInfo != null)
|
||||
//2// {
|
||||
//2// String[] popInfo = svr.populationInfo.split("/");
|
||||
//2// if(popInfo.length > 2)
|
||||
//2// {
|
||||
//2// players = Integer.valueOf(popInfo[0]);
|
||||
//2// maxPlayers = Integer.valueOf(popInfo[1]);
|
||||
//2// }
|
||||
//2// }
|
||||
//2//
|
||||
//2// if(state.contains("2b2t.org"))
|
||||
//2// {
|
||||
//2// try
|
||||
//2// {
|
||||
//2// if(Backdoored.lastChat.startsWith("Position in queue: "))
|
||||
//2// {
|
||||
//2// state = state + " " + Integer.parseInt(Backdoored.lastChat.substring(19)) + " in queue";
|
||||
//2// }
|
||||
//2// } catch(Throwable e){ e.printStackTrace(); }
|
||||
//2// }
|
||||
//2// }
|
||||
//2// }
|
||||
//2// // If we're in the main menu
|
||||
//2// else
|
||||
//2// {
|
||||
//2// details = "Main Menu";
|
||||
//2// state = "discord.gg/ncQkFKU";
|
||||
//2// }
|
||||
//2// }
|
||||
//2//
|
||||
//2// if(!details.equals(presence.details) || !state.equals(presence.state))
|
||||
//2// {
|
||||
//2// presence.startTimestamp = System.currentTimeMillis() / 1000;
|
||||
//2// }
|
||||
//2//
|
||||
//2// presence.details = details;
|
||||
//2// presence.state = state;
|
||||
//2// //presence.partySize = players;
|
||||
//2// //presence.partyMax = maxPlayers;
|
||||
//2//
|
||||
//2// /*if(players > 0)
|
||||
//2// {
|
||||
//2// presence.partyId = String.valueOf(new Random().nextInt((9000000 - 100000) + 1) + 100000);
|
||||
//2// }*/
|
||||
//2//
|
||||
//2// rpc.Discord_UpdatePresence(presence);
|
||||
//2// } catch(Exception e){e.printStackTrace();}
|
||||
//2//
|
||||
//2// try
|
||||
//2// {
|
||||
//2// Thread.sleep(5000);
|
||||
//2// }
|
||||
//2// catch(InterruptedException e)
|
||||
//2// {
|
||||
//2// e.printStackTrace();
|
||||
//2// }
|
||||
//2// }
|
||||
//2// }, "Discord-RPC-Callback-Handler").start();
|
||||
//2// FMLLog.log.info("Discord RPC initialised succesfully");
|
||||
//2// return true;
|
||||
//2//}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue