forked from RepoMirrors/kami-blue
discordrpc > discordsettings and make it use session
This commit is contained in:
parent
3e84165858
commit
95af92e4a0
|
@ -42,7 +42,7 @@ public class DiscordPresence {
|
|||
while (!Thread.currentThread().isInterrupted()) {
|
||||
try {
|
||||
DiscordPresence.rpc.Discord_RunCallbacks();
|
||||
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordRPC"));
|
||||
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordSettings"));
|
||||
String separator = " | ";
|
||||
details = discordSettings.getLine(discordSettings.line1Setting.getValue()) + separator + discordSettings.getLine(discordSettings.line3Setting.getValue());
|
||||
state = discordSettings.getLine(discordSettings.line2Setting.getValue()) + separator + discordSettings.getLine(discordSettings.line4Setting.getValue());
|
||||
|
@ -56,7 +56,7 @@ public class DiscordPresence {
|
|||
}
|
||||
}
|
||||
private static void setRpcFromSettings() {
|
||||
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordRPC"));
|
||||
discordSettings = ((DiscordSettings) ModuleManager.getModuleByName("DiscordSettings"));
|
||||
details = discordSettings.getLine(discordSettings.line1Setting.getValue()) + " " + discordSettings.getLine(discordSettings.line3Setting.getValue());
|
||||
state = discordSettings.getLine(discordSettings.line2Setting.getValue()) + " " + discordSettings.getLine(discordSettings.line4Setting.getValue());
|
||||
DiscordPresence.presence.details = details;
|
||||
|
|
|
@ -192,8 +192,8 @@ public class KamiMod {
|
|||
ModuleManager.getModuleByName("InfoOverlay").setEnabled(true);
|
||||
ModuleManager.getModuleByName("InventoryViewer").setEnabled(true);
|
||||
|
||||
if (((DiscordSettings) ModuleManager.getModuleByName("DiscordRPC")).startupGlobal.getValue()) {
|
||||
ModuleManager.getModuleByName("DiscordRPC").setEnabled(true);
|
||||
if (((DiscordSettings) ModuleManager.getModuleByName("DiscordSettings")).startupGlobal.getValue()) {
|
||||
ModuleManager.getModuleByName("DiscordSettings").setEnabled(true);
|
||||
}
|
||||
if (((AntiCompressionBan) ModuleManager.getModuleByName("AntiCompressionBan")).startupGlobal.getValue()) {
|
||||
ModuleManager.getModuleByName("AntiCompressionBan").setEnabled(true);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class InfoOverlay extends Module {
|
|||
infoContents.add(textColour(firstColour.getValue()) + KamiMod.KAMI_KANJI + textColour(secondColour.getValue()) + " " + KamiMod.MODVER);
|
||||
}
|
||||
if (username.getValue()) {
|
||||
infoContents.add(textColour(firstColour.getValue()) + "Welcome" + textColour(secondColour.getValue()) + " " + mc.player.getName() + "!");
|
||||
infoContents.add(textColour(firstColour.getValue()) + "Welcome" + textColour(secondColour.getValue()) + " " + mc.getSession().getUsername() + "!");
|
||||
}
|
||||
if (time.getValue()) {
|
||||
infoContents.add(textColour(firstColour.getValue()) + TimeUtil.getFinalTime(secondColour.getValue(), firstColour.getValue(), timeUnitSetting.getValue(), timeTypeSetting.getValue(), doLocale.getValue()) + TextFormatting.RESET);
|
||||
|
|
|
@ -11,7 +11,7 @@ import me.zeroeightsix.kami.setting.Settings;
|
|||
* @author S-B99
|
||||
* Updated by S-B99 on 13/01/20
|
||||
*/
|
||||
@Module.Info(name = "DiscordRPC", category = Module.Category.MISC, description = "Discord Rich Presence")
|
||||
@Module.Info(name = "DiscordSettings", category = Module.Category.MISC, description = "Discord Rich Presence")
|
||||
public class DiscordSettings extends Module {
|
||||
|
||||
public Setting<Boolean> startupGlobal = register(Settings.b("Enable Automatically", true));
|
||||
|
@ -33,7 +33,7 @@ public class DiscordSettings extends Module {
|
|||
else if (mc.getCurrentServerData() != null) return "Multiplayer";
|
||||
else return "Main Menu";
|
||||
case USERNAME:
|
||||
if (mc.player != null) return mc.player.getName();
|
||||
if (mc.player != null) return mc.getSession().getUsername();
|
||||
else return "(Not logged in)";
|
||||
case HEALTH:
|
||||
if (mc.player != null) return "(" + ((int) mc.player.getHealth()) + " hp)";
|
||||
|
|
Loading…
Reference in New Issue