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
62 stars 35 forks source link

[Bug] Incorrect Display of Server TPS #217

Open Xujiayao opened 7 months ago

Xujiayao commented 7 months ago

Checks

Minecraft Version

1.20.4

MC-Discord-Chat Version

2.2.6

Description

MCDC always calculates the Server TPS by using the following code:

tps = Math.min(1000.0 / mspt, 20)

However, if the TPS is modified using the Carpet mod, the MSPT value remains unchanged, and as a result, MCDC cannot reflect the modified TPS.

To Reproduce

  1. Install Carpet mod
  2. Execute /tick rate 15
  3. Execute /mcdc info

The message still displays the default Server TPS of 20 instead of 15.

Log

[17:31:29] [Netty Server IO #1/INFO]: <Xujiayao> /tick rate 15
[17:31:29] [Server thread/INFO]: [Xujiayao: Set the target tick rate to 15.0 per second]
[17:31:40] [Netty Server IO #1/INFO]: <Xujiayao> /mcdc info

Config

{
  "generic": {
    "language": "zh_cn",
    "botToken": "REDACTED",
    "botPlayingStatus": "Minecraft (%onlinePlayerCount%/%maxPlayerCount%)",
    "botListeningStatus": "",
    "useWebhook": true,
    "channelId": "REDACTED",
    "consoleLogChannelId": "",
    "updateNotificationChannelId": "",
    "useUuidInsteadOfName": true,
    "avatarApi": "https://mc-heads.net/avatar/%player%.png",
    "broadcastPlayerCommandExecution": true,
    "broadcastSlashCommandExecution": true,
    "announceServerStartStop": true,
    "announcePlayerJoinLeave": true,
    "announceDeathMessages": true,
    "announceAdvancements": true,
    "broadcastChatMessages": true,
    "formatChatMessages": true,
    "allowedMentions": [
      "everyone",
      "users",
      "roles"
    ],
    "useServerNickname": true,
    "discordNewlineLimit": 3,
    "announceHighMspt": true,
    "msptCheckInterval": 5000,
    "msptLimit": 50,
    "whitelistRequiresAdmin": true,
    "notifyUpdates": true,
    "mentionAdminsForUpdates": true,
    "updateChannelTopic": false,
    "channelTopicUpdateInterval": 600000,
    "shutdownImmediately": false,
    "excludedCommands": [
      "/msg",
      "/tell",
      "/tellraw",
      "/w"
    ],
    "adminsIds": [
      "REDACTED"
    ]
  },
  "multiServer": {
    "enable": false,
    "host": "127.0.0.1",
    "port": 5000,
    "name": "SMP",
    "botIds": []
  },
  "customMessage": {
    "unformattedResponseMessage": "",
    "unformattedChatMessage": "",
    "unformattedOtherMessage": "",
    "unformattedCommandNotice": "",
    "formattedResponseMessage": "",
    "formattedChatMessage": "",
    "formattedOtherMessage": "",
    "formattedCommandNotice": "",
    "messageWithoutWebhook": "",
    "messageWithoutWebhookForMultiServer": "",
    "serverStarted": "",
    "serverStopped": "",
    "joinServer": "",
    "leftServer": "",
    "deathMessage": "",
    "advancementTask": "",
    "advancementGoal": "",
    "advancementChallenge": "",
    "highMspt": "",
    "offlineChannelTopic": "",
    "onlineChannelTopic": "",
    "onlineChannelTopicForMultiServer": ""
  },
  "latestVersion": "2.2.4",
  "latestCheckTime": 1702137321152
}
Xujiayao commented 7 months ago

Commits 889b96322d459db4774ffe71b7e67953765fec92 and d6845a8a99012789463ebedd8ab836b6cf4c767d only resolves version 1.20.3 or above. Versions below 1.20.3 will need to find another solution.