mirror of
https://github.com/System-End/Discord-MC-Chat.git
synced 2026-04-19 22:05:11 +00:00
Set overwriting Minecraft source messages in login process
This commit is contained in:
parent
efb2d857c1
commit
d574483578
6 changed files with 32 additions and 21 deletions
|
|
@ -7,6 +7,8 @@ import com.xujiayao.discord_mc_chat.utils.EnvironmentUtils;
|
|||
import com.xujiayao.discord_mc_chat.utils.logging.Logger;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Static final constants used across the project.
|
||||
*
|
||||
|
|
@ -28,4 +30,7 @@ public class Constants {
|
|||
public static final String VERSION = EnvironmentUtils.getDmccVersion();
|
||||
|
||||
public static final OkHttpClient OK_HTTP_CLIENT = new OkHttpClient();
|
||||
|
||||
// For DMCC Client use
|
||||
public static final AtomicBoolean OVERWRITE_MINECRAFT_SOURCE_MESSAGES = new AtomicBoolean(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ public class ClientHandler extends SimpleChannelInboundHandler<Packet> {
|
|||
}
|
||||
case LoginSuccessPacket p -> {
|
||||
I18nManager.load(p.language);
|
||||
Constants.OVERWRITE_MINECRAFT_SOURCE_MESSAGES.set(p.overwriteMinecraftSourceMessages);
|
||||
LOGGER.info(I18nManager.getDmccTranslation("client.network.connected"));
|
||||
|
||||
if (!initialLoginFuture.isDone()) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ import com.xujiayao.discord_mc_chat.network.packets.Packet;
|
|||
*/
|
||||
public class LoginSuccessPacket extends Packet {
|
||||
public String language;
|
||||
public boolean overwriteMinecraftSourceMessages;
|
||||
|
||||
public LoginSuccessPacket(String language) {
|
||||
public LoginSuccessPacket(String language, boolean overwriteMinecraftSourceMessages) {
|
||||
this.language = language;
|
||||
this.overwriteMinecraftSourceMessages = overwriteMinecraftSourceMessages;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ public class ServerHandler extends SimpleChannelInboundHandler<Packet> {
|
|||
NetworkManager.addClientChannel(ctx.channel(), clientName);
|
||||
|
||||
LOGGER.info(I18nManager.getDmccTranslation("server.network.auth_success", clientName));
|
||||
ctx.writeAndFlush(new LoginSuccessPacket(ConfigManager.getString("language")));
|
||||
ctx.writeAndFlush(new LoginSuccessPacket(ConfigManager.getString("language"), ConfigManager.getBoolean("message_parsing.overwrite_minecraft_source_messages")));
|
||||
|
||||
// After successful authentication, perform OP level sync if enabled
|
||||
OpSyncManager.syncAll();
|
||||
|
|
|
|||
|
|
@ -75,14 +75,13 @@ message_parsing:
|
|||
ansi_code_blocks: true
|
||||
polls: true
|
||||
minecraft_to_discord:
|
||||
overwrite_minecraft_source_messages: false
|
||||
parsings:
|
||||
markdown: true
|
||||
unicode_emojis: true
|
||||
custom_emojis: true
|
||||
mentions: true
|
||||
hyperlinks: true
|
||||
timestamps: true
|
||||
markdown: true
|
||||
unicode_emojis: true
|
||||
custom_emojis: true
|
||||
mentions: true
|
||||
hyperlinks: true
|
||||
timestamps: true
|
||||
overwrite_minecraft_source_messages: false
|
||||
|
||||
# 命令过滤设置
|
||||
excluded_commands:
|
||||
|
|
@ -153,7 +152,6 @@ account_linking:
|
|||
# 示例 2:可将基础认证角色映射为 OP 0,使其有权执行无需特殊权限的 DMCC 命令(如委托执行白名单)。
|
||||
- role: "Players"
|
||||
op_level: 0
|
||||
# 已隐藏 (2026/03/13)
|
||||
discord_mention_notifications:
|
||||
enable: true
|
||||
style: "title" # action_bar, title, or chat
|
||||
|
|
|
|||
|
|
@ -108,15 +108,21 @@ message_parsing:
|
|||
timestamps: true
|
||||
ansi_code_blocks: true
|
||||
polls: true
|
||||
minecraft_to_xxxxx: # both minecraft_to_discord and between_minecraft_servers
|
||||
overwrite_minecraft_source_messages: false
|
||||
parsings:
|
||||
markdown: true
|
||||
unicode_emojis: true
|
||||
custom_emojis: true
|
||||
mentions: true
|
||||
hyperlinks: true
|
||||
timestamps: true
|
||||
minecraft_to_discord:
|
||||
markdown: true
|
||||
unicode_emojis: true
|
||||
custom_emojis: true
|
||||
mentions: true
|
||||
hyperlinks: true
|
||||
timestamps: true
|
||||
between_minecraft_servers:
|
||||
markdown: true
|
||||
unicode_emojis: true
|
||||
custom_emojis: true
|
||||
mentions: true
|
||||
hyperlinks: true
|
||||
timestamps: true
|
||||
overwrite_minecraft_source_messages: false
|
||||
|
||||
# 命令过滤设置
|
||||
excluded_commands:
|
||||
|
|
@ -207,7 +213,6 @@ account_linking:
|
|||
op_level: 0
|
||||
- server: "CMP"
|
||||
op_level: 2
|
||||
# 已隐藏 (2026/03/13)
|
||||
discord_mention_notifications:
|
||||
enable: true
|
||||
style: "title" # action_bar, title, or chat
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue