Xujiayao / Discord-MC-Chat

Discord-MC-Chat (DMCC), formerly known as MC-Discord-Chat and MCDiscordChat (MCDC), is a practical and powerful Fabric and Quilt Minecraft <> Discord chat bridge inspired by BRForgers/DisFabric
https://blog.xujiayao.com/posts/4ba0a17a/
MIT License
65 stars 36 forks source link

[Bug] Console messages stop sending once the server time passes midnight #73

Closed LofiTurtle closed 2 years ago

LofiTurtle commented 2 years ago

Checks

Java Version

17.0.3

Minecraft Version

1.19

MCDiscordChat Version

2.0.0-alpha.6

Description

When the server time passes from 23:59:59 to 00:00:00, console messages stop being sent to Discord. The server saves the existing latest.log as a .log.gz and creates a new log file for the new day. MCDC doesn't detect this file change, and doesn't watch for messages in the new file.

Example (compare this to the log below): image

To Reproduce

  1. Set system time to 11:59 PM, or wait till midnight
  2. Notice that console messages aren't sent to discord after 12AM

Log

[23:58:54] [main/INFO]: Loading Minecraft 1.19 with Fabric Loader 0.14.8
[23:58:54] [main/INFO]: Loading 57 mods:
    - com_fasterxml_jackson_core_jackson-annotations 2.13.3 via mcdiscordchat
    - com_fasterxml_jackson_core_jackson-core 2.13.3 via mcdiscordchat
    - com_fasterxml_jackson_core_jackson-databind 2.13.3 via mcdiscordchat
    - com_google_code_gson_gson 2.9.0 via mcdiscordchat
    - com_neovisionaries_nv-websocket-client 2.14 via mcdiscordchat
    - com_squareup_okhttp3_okhttp 4.10.0 via mcdiscordchat
    - com_squareup_okio_okio 2.10.0 via mcdiscordchat
    - com_vdurmont_emoji-java 5.1.1 via mcdiscordchat
    - com_velocitypowered_velocity-native 3.1.2-SNAPSHOT via krypton
    - fabric 0.56.0+1.19
    - fabric-api-base 0.4.9+e62f51a3a9 via fabric
    - fabric-api-lookup-api-v1 1.6.7+9ff28f40a9 via fabric
    - fabric-biome-api-v1 9.0.13+b2a4a624a9 via fabric
    - fabric-command-api-v1 1.2.5+f71b366fa9 via fabric
    - fabric-command-api-v2 2.1.1+cda9839ba9 via fabric
    - fabric-commands-v0 0.2.22+df3654b3a9 via fabric
    - fabric-containers-v0 0.1.27+df3654b3a9 via fabric
    - fabric-content-registries-v0 3.1.0+4a3ec384a9 via fabric
    - fabric-convention-tags-v1 1.0.8+37622d24a9 via fabric
    - fabric-crash-report-info-v1 0.2.3+bd0a0d4aa9 via fabric
    - fabric-data-generation-api-v1 5.0.1+2a5b9210a9 via fabric
    - fabric-dimensions-v1 2.1.27+72da3b3da9 via fabric
    - fabric-entity-events-v1 1.4.16+9ff28f40a9 via fabric
    - fabric-events-interaction-v0 0.4.26+9ff28f40a9 via fabric
    - fabric-events-lifecycle-v0 0.2.25+df3654b3a9 via fabric
    - fabric-game-rule-api-v1 1.0.19+18990361a9 via fabric
    - fabric-item-api-v1 1.5.4+767db26ea9 via fabric
    - fabric-item-groups-v0 0.3.23+9ff28f40a9 via fabric
    - fabric-lifecycle-events-v1 2.1.0+33fbc738a9 via fabric
    - fabric-loot-api-v2 1.0.1+9e7660c6a9 via fabric
    - fabric-loot-tables-v1 1.1.1+9e7660c6a9 via fabric
    - fabric-message-api-v1 1.0.1+513f4a59a9 via fabric
    - fabric-mining-level-api-v1 2.1.8+33fbc738a9 via fabric
    - fabric-networking-api-v1 1.0.27+7fe97409a9 via fabric
    - fabric-networking-v0 0.3.14+df3654b3a9 via fabric
    - fabric-object-builder-api-v1 4.0.5+9ff28f40a9 via fabric
    - fabric-particles-v1 1.0.8+dc39553aa9 via fabric
    - fabric-registry-sync-v0 0.9.16+92cf9a3ea9 via fabric
    - fabric-rendering-data-attachment-v1 0.3.12+9ff28f40a9 via fabric
    - fabric-rendering-fluids-v1 3.0.5+9ff28f40a9 via fabric
    - fabric-resource-conditions-api-v1 2.0.9+e62f51a3a9 via fabric
    - fabric-resource-loader-v0 0.5.3+9e7660c6a9 via fabric
    - fabric-screen-handler-api-v1 1.2.6+9ff28f40a9 via fabric
    - fabric-transfer-api-v1 2.0.9+e62f51a3a9 via fabric
    - fabric-transitive-access-wideners-v1 1.1.1+9e7660c6a9 via fabric
    - fabricloader 0.14.8
    - java 17
    - krypton 0.2.0
    - mcdiscordchat 2.0.0-alpha.6
    - mcdiscordchat-1_19_x 2.0.0-alpha.6 via mcdiscordchat
    - minecraft 1.19
    - net_dv8tion_jda 5.0.0-alpha.16 via mcdiscordchat
    - net_sf_trove4j_trove4j 3.0.3 via mcdiscordchat
    - org_apache_commons_commons-collections4 4.4 via mcdiscordchat
    - org_jetbrains_kotlin_kotlin-stdlib 1.6.21 via mcdiscordchat
    - org_json_json 20220320 via mcdiscordchat
    - org_slf4j_slf4j-api 1.7.36 via mcdiscordchat
[23:58:55] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=file:/C:/Users/johnc/MCDC-dev-server/libraries/net/fabricmc/sponge-mixin/0.11.4+mixin.0.8.5/sponge-mixin-0.11.4+mixin.0.8.5.jar Service=Knot/Fabric Env=SERVER
[23:58:55] [main/INFO]: Compatibility level set to JAVA_16
[23:58:55] [main/INFO]: Compatibility level set to JAVA_17
[23:59:03] [main/INFO]: Building unoptimized datafixer
[23:59:06] [main/INFO]: Compression will use Java, encryption will use Java
[23:59:06] [main/INFO]: Krypton is now accelerating your Minecraft server's networking stack 🚀
[23:59:07] [main/INFO]: -----------------------------------------
[23:59:07] [main/INFO]: MCDiscordChat (MCDC) 2.0.0-alpha.6
[23:59:07] [main/INFO]: By Xujiayao
[23:59:07] [main/INFO]: 
[23:59:07] [main/INFO]: More information + Docs:
[23:59:07] [main/INFO]: https://blog.xujiayao.top/posts/4ba0a17a/
[23:59:07] [main/INFO]: -----------------------------------------
[23:59:08] [main/INFO]: Login Successful!
[23:59:09] [JDA MainWS-ReadThread/INFO]: Connected to WebSocket
[23:59:10] [JDA MainWS-ReadThread/INFO]: Finished Loading!
[23:59:10] [Thread-1/INFO]: [ConsoleLog] Starting new ConsoleLogListener
[23:59:10] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[23:59:13] [main/INFO]: Loaded 7 recipes
[23:59:14] [main/INFO]: Loaded 1179 advancements
[23:59:15] [main/INFO]: Applied 0 biome modifications to 0 of 63 new biomes in 3.965 ms
[23:59:15] [Server thread/INFO]: Starting minecraft server version 1.19
[23:59:15] [Server thread/INFO]: Loading properties
[23:59:15] [Server thread/INFO]: Default game type: SURVIVAL
[23:59:15] [Server thread/INFO]: Generating keypair
[23:59:15] [Server thread/INFO]: Starting Minecraft server on *:25565
[23:59:15] [Server thread/INFO]: Using default channel type
[23:59:15] [Server thread/INFO]: Preparing level "world"
[23:59:16] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-1/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-1/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-3/INFO]: Preparing spawn area: 0%
[23:59:21] [Worker-Main-7/INFO]: Preparing spawn area: 0%
[23:59:22] [Worker-Main-6/INFO]: Preparing spawn area: 1%
[23:59:23] [Server thread/INFO]: Time elapsed: 6915 ms
[23:59:23] [Server thread/INFO]: Done (7.436s)! For help, type "help"
[23:59:23] [JDA RateLimit-Worker 5/WARN]: Encountered 429 on route PATCH/channels/{channel_id} with bucket 9852e1a53c06ffc5a89d65fef85ca4ce:channel_id=999090185490927636 Retry-After: 438000 ms
[23:59:23] [JDA RateLimit-Worker 1/WARN]: Encountered 429 on route PATCH/channels/{channel_id} with bucket 9852e1a53c06ffc5a89d65fef85ca4ce:channel_id=999090273466466354 Retry-After: 439000 ms
[23:59:35] [JDA MainWS-ReadThread/INFO]: [Discord] <ᴸᵒᶠⁱᵀᵘʳᵗˡᵉ> This all gets sent correctly
[00:00:05] [JDA MainWS-ReadThread/INFO]: [Discord] <ᴸᵒᶠⁱᵀᵘʳᵗˡᵉ> This does not get sent to Discord

Config

{
  "generic": {
    "useEngInsteadOfChin": true,
    "botToken": "hidden",
    "botPlayingStatus": "Minecraft-dev",
    "botListeningStatus": "",
    "webhookUrl": "hidden",
    "channelId": "999090185490927636",
    "consoleLogChannelId": "999090273466466354",
    "updateNotificationChannelId": "",
    "useUuidInsteadOfName": true,
    "avatarApi": "https://mc-heads.net/avatar/%player%.png",
    "broadcastCommandExecution": true,
    "announceServerStartStop": true,
    "announcePlayerJoinLeave": true,
    "announceDeathMessages": true,
    "announceAdvancements": true,
    "allowMentions": true,
    "formatChatMessages": true,
    "useServerNickname": true,
    "announceHighMspt": true,
    "msptCheckInterval": 5000,
    "msptLimit": 50,
    "mentionAdminsForUpdates": true,
    "updateChannelTopic": true,
    "channelTopicUpdateInterval": 600000,
    "excludedCommands": [
      "/msg",
      "/tell",
      "/tellraw",
      "/w"
    ],
    "adminsIds": [
      "203228275949043713"
    ]
  },
  "multiServer": {
    "enable": false,
    "host": "hidden",
    "port": 5000,
    "name": "SMP",
    "botIds": []
  },
  "textsZH": {
    "unformattedResponseMessage": "    ┌──── <%name%> %message%",
    "unformattedChatMessage": "[%server%] <%name%> %message%",
    "unformattedOtherMessage": "[%server%] %message%",
    "unformattedCommandNotice": "%name% 执行了 %command% 命令!",
    "formattedResponseMessage": [
      {
        "text": "    ┌──── ",
        "bold": true,
        "color": "dark_gray"
      },
      {
        "text": "<%name%> ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "dark_gray"
      }
    ],
    "formattedChatMessage": [
      {
        "text": "[%server%] ",
        "bold": true,
        "color": "blue"
      },
      {
        "text": "<%name%> ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "gray"
      }
    ],
    "formattedOtherMessage": [
      {
        "text": "[%server%] ",
        "bold": true,
        "color": "blue"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "gray"
      }
    ],
    "formattedCommandNotice": [
      {
        "text": "%name% ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "执行了 %command% 命令!",
        "bold": false,
        "color": "gray"
      }
    ],
    "serverStarted": "**服务器已启动!**",
    "serverStopped": "**服务器已关闭!**",
    "joinServer": "**%playerName% 加入了服务器**",
    "leftServer": "**%playerName% 离开了服务器**",
    "deathMessage": "**%deathMessage%**",
    "advancementTask": "**%playerName% 达成了进度 [%advancement%]**",
    "advancementChallenge": "**%playerName% 完成了挑战 [%advancement%]**",
    "advancementGoal": "**%playerName% 达成了目标 [%advancement%]**",
    "highMspt": "**服务器 MSPT (%mspt%) 高于 %msptLimit%!**",
    "offlineChannelTopic": ":x: 服务器离线 | 最后更新于:<t:%lastUpdateTime%:f>",
    "onlineChannelTopic": ":white_check_mark: %onlinePlayerCount%/%maxPlayerCount% 位玩家在线 | 服务器玩家总数:%uniquePlayerCount% | 服务器于 <t:%serverStartedTime%:R> 启动 | 最后更新于:<t:%lastUpdateTime%:f>",
    "onlineChannelTopicForMultiServer": ":white_check_mark: %onlinePlayerCount%/%maxPlayerCount% 位玩家在线 | 服务器玩家总数:%uniquePlayerCount% | %onlineServerCount% 个服务器在线 [%onlineServerList%] | 服务器于 <t:%serverStartedTime%:R> 启动 | 最后更新于:<t:%lastUpdateTime%:f>"
  },
  "textsEN": {
    "unformattedResponseMessage": "    ┌──── <%name%> %message%",
    "unformattedChatMessage": "[%server%] <%name%> %message%",
    "unformattedOtherMessage": "[%server%] %message%",
    "unformattedCommandNotice": "%name% executed %command% command!",
    "formattedResponseMessage": [
      {
        "text": "    ┌──── ",
        "bold": true,
        "color": "dark_gray"
      },
      {
        "text": "<%name%> ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "dark_gray"
      }
    ],
    "formattedChatMessage": [
      {
        "text": "[%server%] ",
        "bold": true,
        "color": "blue"
      },
      {
        "text": "<%name%> ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "gray"
      }
    ],
    "formattedOtherMessage": [
      {
        "text": "[%server%] ",
        "bold": true,
        "color": "blue"
      },
      {
        "text": "%message%",
        "bold": false,
        "color": "gray"
      }
    ],
    "formattedCommandNotice": [
      {
        "text": "%name% ",
        "bold": false,
        "color": "%roleColor%"
      },
      {
        "text": "executed %command% command!",
        "bold": false,
        "color": "gray"
      }
    ],
    "serverStarted": "**Server started!**",
    "serverStopped": "**Server stopped!**",
    "joinServer": "**%playerName% joined the game**",
    "leftServer": "**%playerName% left the game**",
    "deathMessage": "**%deathMessage%**",
    "advancementTask": "**%playerName% has made the advancement [%advancement%]**",
    "advancementChallenge": "**%playerName% has completed the challenge [%advancement%]**",
    "advancementGoal": "**%playerName% has reached the goal [%advancement%]**",
    "highMspt": "**Server MSPT (%mspt%) is above %msptLimit%!**",
    "offlineChannelTopic": ":x: Server offline | Last updated: <t:%lastUpdateTime%:f>",
    "onlineChannelTopic": ":white_check_mark: %onlinePlayerCount%/%maxPlayerCount% player(s) online | %uniquePlayerCount% unique player(s) ever joined | Server started <t:%serverStartedTime%:R> | Last updated: <t:%lastUpdateTime%:f>",
    "onlineChannelTopicForMultiServer": ":white_check_mark: %onlinePlayerCount%/%maxPlayerCount% player(s) online | %uniquePlayerCount% unique player(s) ever joined | %onlineServerCount% server(s) online [%onlineServerList%] | Server started <t:%serverStartedTime%:R> | Last updated: <t:%lastUpdateTime%:f>"
  },
  "latestVersion": "2.0.0-alpha.6",
  "latestCheckTime": 1658053992584
}
LofiTurtle commented 2 years ago

I am working on a fix for this, and will make a PR when it is done.

For now, the /reload command will update MCDC to use the new log file.

Xujiayao commented 2 years ago

Oh! So this is why the log file sent by the /log command is often not the whole of it.