U Team Core

U Team Core

37M Downloads

[1.15.2] Config being ignored / Missing Config Statements?

CDAGaming opened this issue · 3 comments

commented

Describe the bug
I'm the owner of the mod CraftPresence, a discord rich presence mod for MC b1.6.6 - 1.16.2-Pre1.

While testing in correspondence with https://gitlab.com/CDAGaming/CraftPresence/-/issues/60 I noticed this piece of info:

�[m�[32m[05:24:56] [Discord Rich Presence Stop Thread/INFO] [UTeamCore/]: Discord client closed.
�[m�[32m[05:24:56] [CraftPresence-ShutDown-Handler/INFO] [craftpresence/]: Shutting Down CraftPresence...

However, this is the config for your mod:

#Client configuration settings
[client]
	#If you have discord installed it will show your some details about your game as rich presence
	discordRichPresence = false

This is leading me to question as to whether this config option is being employed properly, and if not, if it could be employed to prevent a possible conflict between our mods Discord implementations.

To Reproduce
Steps to reproduce the behavior:

  1. Just Launching is all this needs, default setup of the pack explained in the aforementioned issue page.

Expected behavior
Explained in Description.

Screenshots
N/A, test screenshots in aforementioned gitlab issue page.

Versions

  • Minecraft version: 1.15.2
  • Forge version: 31.2.36
  • UTeamCore version: 3.0.1.164

Log (For reference)
https://paste.ee/p/SSvfH

commented

Hello. This message will always be printed out even if the config is disabled. I might rework this soon (1.16+), so the shutdown hook only prints the message if the client was connected.

Either way the config value should still prevent the client from connecting so I don't think that it causes an issue with your mod.

if (ClientConfig.getInstance().discordRichPresence.get()) {
DiscordRichPresence.start();
}

static {
Runtime.getRuntime().addShutdownHook(new Thread(() -> stop(), "Discord Rich Presence Stop Thread"));
}
public static void start() {
try {
CLIENT.connect();
TIMER.schedule(timerTask = new TimerTask() {
@Override
public void run() {
setState(currentState);
}
}, 1000, 1000 * 120);
isEnabled = true;
UCoreMain.LOGGER.info("Discord client found and connected.");
} catch (final NoDiscordClientException ex) {
UCoreMain.LOGGER.info("Discord client was not found.");
}
}
public static void stop() {
if (timerTask != null) {
timerTask.cancel();
timerTask = null;
}
try {
CLIENT.close();
} catch (final Exception ex) {
}
errorCount = 0;
isEnabled = false;
UCoreMain.LOGGER.info("Discord client closed.");
}

commented

Thank you for the explanation, I look forward to those changes!

commented

In 1.16 this should now be addressed. The Discord client closed. should now only log if the connection was established before.
Hopefully that avoids confusion.