Fix protocol version handling#344
Open
PrinceDale99 wants to merge 8 commits into
Open
Conversation
…col-version Addressing unsupported protocol version and runtime errors
There was a problem hiding this comment.
Pull request overview
This PR aims to improve Minecraft protocol/version handling for the bot by introducing explicit server version resolution (via settings or a status ping) before creating the Mineflayer bot instance.
Changes:
- Updates default
settings.jsonserver/account values and adjusts chat message timing/content. - Adds
minecraft-protocolping-based version detection and wires the resolved version intomineflayer.createBot. - Adds logging and a failure path when version detection cannot be determined.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| settings.json | Updates sample configuration values and chat message settings. |
| index.js | Adds ping-based Minecraft version resolution and uses it when creating the bot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
9
to
11
| "ip": "your-server-address.com", | ||
| "port": 00000, | ||
| "version": "", |
Comment on lines
+34
to
+36
| "I'm a regular Minecraft Player", | ||
| "Subscribe to Slobos!", | ||
| "I like to play Minecraft!" | ||
| "Hello, evrybody!" |
Comment on lines
3
to
6
| const { addLog, getLogs } = require("./logger"); | ||
| const mineflayer = require("mineflayer"); | ||
| const mcProtocol = require("minecraft-protocol"); | ||
| const { Movements, pathfinder, goals } = require("mineflayer-pathfinder"); |
Comment on lines
+1244
to
+1251
| const botVersion = await resolveBotVersion(); | ||
| if (!botVersion) { | ||
| addLog( | ||
| '[Bot] Unable to determine Minecraft version. Set "server.version" in settings.json to your exact server version.', | ||
| ); | ||
| scheduleReconnect(); | ||
| return; | ||
| } |
Comment on lines
+1215
to
+1217
| } catch (err) { | ||
| addLog(`[Bot] Version ping failed: ${err.message}`); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.