Skip to content

Fixes public command blocking (Chat disabled in client options) and optimizes chunk loading. - #573

Closed
dangdinhbaohoang12 wants to merge 2 commits into
zardoy:nextfrom
dangdinhbaohoang12:next
Closed

dangdinhbaohoang12 wants to merge 2 commits into
zardoy:nextfrom
dangdinhbaohoang12:next

Conversation

@dangdinhbaohoang12

@dangdinhbaohoang12 dangdinhbaohoang12 commented Jul 1, 2026 •

Copy link
Copy Markdown

🐛 Fixes Public Command Blocking (Chat disabled in client options) and Optimizes Chunk Loading

📝 Overview

This Pull Request fixes an issue where players couldn't execute any commands (e.g., /clan resign, /menu,...) except for the /login command. When executing the command, the system displayed a system error message: Chat disabled in client options. It also optimizes the visibility configuration mechanism to address incomplete chunk loading.

🔍 Root Cause Analysis

  1. Command Error (Chat disabled in client options): - This error originates from the Minecraft server side when receiving the client configuration packet (client_settings) containing the chat visibility flag chatVisibility set to level 2 (Hidden).
  • The bot.settings.chat variable in the mineflayer library requires the correct strings ('enabled', 'commandsOnly', 'disabled'). In the current source code, this property is incorrectly configured by default or mismapped from UI data, leading the server to mistakenly believe the player has disabled chat in their personal settings and block the execution of normal commands.

  • The /login command still works because authentication plugins (like AuthMe) on the server actively bypass client settings filters to prevent players from getting stuck. Players still see other players' chat messages because the server forwards chat as System Message (mandatory display) through the ViaVersion multi-version port.

  1. Chunk Not Loading Issue:
  • Based on system logs, the viewDistance configuration is being forced to an extremely low level: viewDistance = 3. This causes the grid plotter (prismarine-viewer) to constantly report rendering errors for non-outstanding sections, resulting in missing or slow-loading chunks around the player when moving.

🛠️ Solutions (Changes Made)

  • Bot Initialization Configuration Modification: Update the initialization parameter in mineflayer.createBot, changing the chat property configuration to 'enabled' instead of the old error values.

  • Settings Mapping Standardization: Modify the bot.setSettings() update function to ensure that regardless of user changes on-screen UI options (enabling/disabling the Chat UI button), the value sent to the Mineflayer packet is always correctly translated to the string 'enabled'.

  • Improved Render Vision: Increase the default vision parameter or add constraint handling so that viewDistance doesn't fall into excessively low values ​​causing incomplete chunk loading errors.

🧪 Test Results (Testing & Verification)

  • The /login command works normally as before.

  • Tested typing common commands such as /clan resign, /clan, the system executed successfully and was no longer blocked by the server with the message Chat disabled in client options.

Summary by CodeRabbit

  • New Features
    • Added automated GitHub Actions checks for pull requests and pushes to the next branch.
    • Introduced Node.js CI across multiple Node versions to build and test the app.
    • Added Datadog Synthetic test runs for end-to-end coverage, filtered to relevant test tags.

dangdinhbaohoang12 added 2 commits July 1, 2026 20:38
This workflow triggers Datadog Synthetic tests on push and pull request events to the 'next' branch.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds two new GitHub Actions workflow files: one for running Datadog Synthetic tests on push/pull_request events targeting the next branch, and another Node.js CI workflow that builds and tests across multiple Node.js versions.

Changes

CI Workflow Additions

Layer / File(s) Summary
Datadog Synthetic tests workflow
.github/workflows/datadog-synthetics.yml
New workflow triggers on push/pull_request to next, checks out the repo, and runs the Datadog Synthetics CI action filtered by tag:e2e-tests, using DD_API_KEY/DD_APP_KEY secrets.
Node.js CI workflow
.github/workflows/node.js.yml
New workflow triggers on push/pull_request to next, builds a matrix across Node 18.x/20.x/22.x with npm caching, runs npm ci, optional npm run build, and npm test.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

Not applicable — these are configuration-only CI workflow additions with no multi-component application logic to visualize.

Suggested labels: ci, github-actions

Suggested reviewers: zardoy

🐇 Two workflows hop into the repo's nest,
One tests with Datadog, giving synthetic checks a rest,
The other builds Node across versions three,
CI now watches, as vigilant as can be.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes Minecraft client fixes, but the changes add GitHub Actions workflows for Datadog synthetics and Node.js CI. Rename it to reflect the workflow additions, e.g. "Add Datadog Synthetic and Node.js CI workflows".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request has been flagged as potential spam (other-spam) by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/datadog-synthetics.yml (2)

27-27: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Set persist-credentials: false on checkout.

Static analysis flags this: actions/checkout@v4 persists the GITHUB_TOKEN credential in the local git config by default, which is unnecessary since this job never pushes back to the repo.

🔒 Proposed fix
     steps:
-    - uses: actions/checkout@v4
+    - uses: actions/checkout@v4
+      with:
+        persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/datadog-synthetics.yml at line 27, The checkout step in
the datadog synthetics workflow should disable credential persistence because
this job only reads the repo and never pushes changes. Update the existing
actions/checkout@v4 usage to set persist-credentials to false so the
GITHUB_TOKEN is not stored in local git config.

Source: Linters/SAST tools


22-26: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider declaring explicit least-privilege permissions.

No permissions: block is set, so the job inherits the default (possibly broader) GITHUB_TOKEN scope. Since this job only checks out code and calls an external action, restricting to contents: read reduces blast radius if a step is compromised.

🔒 Proposed fix
 jobs:
   build:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/datadog-synthetics.yml around lines 22 - 26, Add an
explicit permissions block to the build job in the datadog-synthetics workflow
so the job does not inherit broad default GITHUB_TOKEN scope. In the build job
definition, set least-privilege access by granting only the permissions needed
for checkout and the external action, using the existing build job section as
the place to update. Keep the scope minimal, ideally contents: read only.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/node.js.yml:
- Line 23: The checkout step in the GitHub Actions workflow is persisting the
default token in git config, which can be leaked by later steps or artifacts.
Update the existing actions/checkout usage in the workflow to disable credential
persistence by setting persist-credentials to false, keeping the fix scoped to
the checkout step itself.
- Line 31: The CI workflow is invoking `npm test`, but the root `package.json`
does not define a plain `test` script, so this step won’t run the intended
suite. Update the job in the Node.js workflow to call the appropriate existing
test script(s) from `package.json` (for example the relevant `test:*` target),
or add a real `test` script if that is the intended entrypoint. Use the workflow
step currently running `npm test` as the place to fix it.

---

Nitpick comments:
In @.github/workflows/datadog-synthetics.yml:
- Line 27: The checkout step in the datadog synthetics workflow should disable
credential persistence because this job only reads the repo and never pushes
changes. Update the existing actions/checkout@v4 usage to set
persist-credentials to false so the GITHUB_TOKEN is not stored in local git
config.
- Around line 22-26: Add an explicit permissions block to the build job in the
datadog-synthetics workflow so the job does not inherit broad default
GITHUB_TOKEN scope. In the build job definition, set least-privilege access by
granting only the permissions needed for checkout and the external action, using
the existing build job section as the place to update. Keep the scope minimal,
ideally contents: read only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fb16cbd0-3890-4b85-be17-b8de03c4b5ec

📥 Commits

Reviewing files that changed from the base of the PR and between 0ee8f7f and 0d1c24f.

📒 Files selected for processing (2)
  • .github/workflows/datadog-synthetics.yml
  • .github/workflows/node.js.yml

# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Set persist-credentials: false on checkout.

Static analysis flags the checkout step for credential persistence (artipacked); the default GITHUB_TOKEN is left in git config after checkout and could be leaked by later steps/artifacts.

Proposed fix
-    - uses: actions/checkout@v4
+    - uses: actions/checkout@v4
+      with:
+        persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 23-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/node.js.yml at line 23, The checkout step in the GitHub
Actions workflow is persisting the default token in git config, which can be
leaked by later steps or artifacts. Update the existing actions/checkout usage
in the workflow to disable credential persistence by setting persist-credentials
to false, keeping the fix scoped to the checkout step itself.

Source: Linters/SAST tools

cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

npm test likely won't run the intended suite.

Per the referenced package.json snippet, the repo defines the root package.json defines a build script and multiple test:* scripts, but it does not define a plain test script. If no test script exists, npm test will either fail (npm ≥7 errors when script missing) or silently no-op, giving false CI confidence across all node-version matrix jobs.

Proposed fix
-    - run: npm test
+    - run: npm run test-unit --if-present
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- run: npm test
- run: npm run test-unit --if-present
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/node.js.yml at line 31, The CI workflow is invoking `npm
test`, but the root `package.json` does not define a plain `test` script, so
this step won’t run the intended suite. Update the job in the Node.js workflow
to call the appropriate existing test script(s) from `package.json` (for example
the relevant `test:*` target), or add a real `test` script if that is the
intended entrypoint. Use the workflow step currently running `npm test` as the
place to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant