-
-
Notifications
You must be signed in to change notification settings - Fork 959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 1.20.4 #3310
Merged
Support 1.20.4 #3310
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ffcba9d
Support 1.20.4
rom1504 16121da
Update package.json
rom1504 43dfe27
fix externalTest hang on op message waiting
extremeheat 95b3644
add more context to to errors
extremeheat 2a0f054
replace nodejs once() usage with mineflayer once() with a default 20s…
extremeheat 7bb9ea0
fix path
extremeheat 074413c
fix ChatMessages to use .fromNotch
extremeheat 39976f3
Update chat.js add debug
extremeheat aa33c8e
add more debug
extremeheat 0527933
internalTest: fix chat
extremeheat 4e2f693
fix nbt.string wrap
extremeheat 02425a7
update prismarine-windows dep
extremeheat d8a357f
fix
extremeheat 9995d23
add logging
extremeheat 18850a0
replace grass -> mycelium for test
extremeheat d7270a0
remove debug console.log in chat.js
rom1504 129c804
Update package.json
rom1504 1f94365
Update package.json
rom1504 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,98 @@ | ||
let ChatMessage | ||
const colors = ['pink', 'blue', 'red', 'green', 'yellow', 'purple', 'white'] | ||
const divisions = [0, 6, 10, 12, 20] | ||
|
||
module.exports = loader | ||
|
||
function loader (registry) { | ||
ChatMessage = require('prismarine-chat')(registry) | ||
return BossBar | ||
} | ||
|
||
class BossBar { | ||
constructor (uuid, title, health, dividers, color, flags) { | ||
this._entityUUID = uuid | ||
this._title = new ChatMessage(JSON.parse(title)) | ||
this._health = health | ||
this._dividers = divisions[dividers] | ||
this._color = colors[color] | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
set entityUUID (uuid) { | ||
this._entityUUID = uuid | ||
} | ||
|
||
set title (title) { | ||
this._title = new ChatMessage(JSON.parse(title)) | ||
} | ||
|
||
set health (health) { | ||
this._health = health | ||
} | ||
|
||
set dividers (dividers) { | ||
this._dividers = divisions[dividers] | ||
} | ||
|
||
set color (color) { | ||
this._color = colors[color] | ||
} | ||
|
||
set flags (flags) { | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
get flags () { | ||
return (this._shouldDarkenSky) | (this._isDragonBar << 1) | (this._createFog << 2) | ||
} | ||
|
||
set shouldDarkenSky (darkenSky) { | ||
this._shouldDarkenSky = darkenSky | ||
} | ||
|
||
set isDragonBar (dragonBar) { | ||
this._isDragonBar = dragonBar | ||
} | ||
|
||
get createFog () { | ||
return this._createFog | ||
} | ||
|
||
set createFog (createFog) { | ||
this._createFog = createFog | ||
} | ||
|
||
get entityUUID () { | ||
return this._entityUUID | ||
} | ||
|
||
get title () { | ||
return this._title | ||
} | ||
|
||
get health () { | ||
return this._health | ||
} | ||
|
||
get dividers () { | ||
return this._dividers | ||
} | ||
|
||
get color () { | ||
return this._color | ||
} | ||
|
||
get shouldDarkenSky () { | ||
return this._shouldDarkenSky | ||
} | ||
|
||
get isDragonBar () { | ||
return this._isDragonBar | ||
} | ||
|
||
get shouldCreateFog () { | ||
return this._createFog | ||
const ChatMessage = require('prismarine-chat')(registry) | ||
return class BossBar { | ||
constructor (uuid, title, health, dividers, color, flags) { | ||
this._entityUUID = uuid | ||
this._title = ChatMessage.fromNotch(title) | ||
this._health = health | ||
this._dividers = divisions[dividers] | ||
this._color = colors[color] | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
set entityUUID (uuid) { | ||
this._entityUUID = uuid | ||
} | ||
|
||
set title (title) { | ||
this._title = ChatMessage.fromNotch(title) | ||
} | ||
|
||
set health (health) { | ||
this._health = health | ||
} | ||
|
||
set dividers (dividers) { | ||
this._dividers = divisions[dividers] | ||
} | ||
|
||
set color (color) { | ||
this._color = colors[color] | ||
} | ||
|
||
set flags (flags) { | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
get flags () { | ||
return (this._shouldDarkenSky) | (this._isDragonBar << 1) | (this._createFog << 2) | ||
} | ||
|
||
set shouldDarkenSky (darkenSky) { | ||
this._shouldDarkenSky = darkenSky | ||
} | ||
|
||
set isDragonBar (dragonBar) { | ||
this._isDragonBar = dragonBar | ||
} | ||
|
||
get createFog () { | ||
return this._createFog | ||
} | ||
|
||
set createFog (createFog) { | ||
this._createFog = createFog | ||
} | ||
|
||
get entityUUID () { | ||
return this._entityUUID | ||
} | ||
|
||
get title () { | ||
return this._title | ||
} | ||
|
||
get health () { | ||
return this._health | ||
} | ||
|
||
get dividers () { | ||
return this._dividers | ||
} | ||
|
||
get color () { | ||
return this._color | ||
} | ||
|
||
get shouldDarkenSky () { | ||
return this._shouldDarkenSky | ||
} | ||
|
||
get isDragonBar () { | ||
return this._isDragonBar | ||
} | ||
|
||
get shouldCreateFog () { | ||
return this._createFog | ||
} | ||
} | ||
} | ||
|
||
module.exports = loader |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,8 +107,12 @@ function inject (bot, options) { | |
}) | ||
|
||
addDefaultPatterns() | ||
bot._client.on('player_chat', (msg) => console.dir(msg, { depth: null })) | ||
bot._client.on('profileless_chat', (msg) => console.dir(msg, { depth: null })) | ||
|
||
bot._client.on('playerChat', (data) => { | ||
console.log('playerChat') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please remove |
||
console.dir(data, { depth: null }) | ||
const message = data.formattedMessage | ||
const verified = data.verified | ||
let msg | ||
|
@@ -144,7 +148,7 @@ function inject (bot, options) { | |
function chatWithHeader (header, message) { | ||
if (typeof message === 'number') message = message.toString() | ||
if (typeof message !== 'string') { | ||
throw new Error('Incorrect type! Should be a string or number.') | ||
throw new Error('Chat message type must be a string or number: ' + typeof message) | ||
} | ||
|
||
if (!header && message.startsWith('/')) { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug code