This commit is contained in:
Xujiayao 2025-08-08 17:44:58 +08:00
parent 3c4d177812
commit f8a92bc025
4 changed files with 37 additions and 1 deletions

View file

@ -22,6 +22,9 @@ subprojects {
configurations.configureEach {
resolutionStrategy {
force "org.slf4j:slf4j-api:2.0.17"
force "com.fasterxml.jackson.core:jackson-core:2.19.2"
force "com.fasterxml.jackson.core:jackson-databind:2.19.2"
force "com.fasterxml.jackson.core:jackson-annotations:2.19.2"
}
}
}

View file

@ -14,10 +14,15 @@ dependencies {
exclude module: "opus-java" // for encoding audio into opus
exclude module: "tink" // for encrypting and decrypting audio
exclude module: "slf4j-api"
exclude module: "jackson-core"
exclude module: "jackson-databind"
exclude module: "jackson-annotations"
}
shadow("org.slf4j:slf4j-api:2.0.17")
shadow("org.slf4j:slf4j-jdk14:2.0.17")
shadow("com.fasterxml.jackson.core:jackson-databind:2.19.2")
}
neoForge {

View file

@ -1,6 +1,7 @@
package com.xujiayao.discord_mc_chat.common;
import com.xujiayao.discord_mc_chat.common.utils.Logger;
import com.xujiayao.discord_mc_chat.common.utils.Utils;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.requests.GatewayIntent;
@ -10,6 +11,7 @@ import net.dv8tion.jda.api.requests.GatewayIntent;
*/
public class DMCC {
public static final String VERSION = Utils.getVersion();
public static final Logger LOGGER = new Logger();
public static void main(String[] args) {
@ -19,7 +21,7 @@ public class DMCC {
}
public static void init(String loader) {
LOGGER.info("Initializing DMCC with loader: {}", loader);
LOGGER.info("Initializing DMCC {} with loader: {}", VERSION, loader);
try {
String token = ""; // intended to be empty

View file

@ -0,0 +1,26 @@
package com.xujiayao.discord_mc_chat.common.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
public class Utils {
public static String getVersion() {
InputStream stream = Utils.class.getResourceAsStream("/fabric.mod.json");
if (stream == null) {
throw new RuntimeException("File \"fabric.mod.json\" not found");
}
try (Reader reader = new InputStreamReader(stream)) {
JsonNode root = new ObjectMapper().readTree(reader);
return root.get("version").asText();
} catch (IOException e) {
throw new RuntimeException("Failed to identify DMCC version", e);
}
}
}