Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat committed Jan 3, 2025
1 parent 9a52c1c commit 0c1963f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
29 changes: 0 additions & 29 deletions src/lib/plugins/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ module.exports.player = function (player, serv) {
function handleChatMessage (data) {
const fmtMessage = `<${player.username}> ${data.message}`
serv.broadcast(fmtMessage, { whitelist: serv.players, blacklist: [] })
// broadcast(fmtMessage, null, player.username)
}

player._client.on('chat_message', (data) => {
Expand Down Expand Up @@ -204,32 +203,4 @@ module.exports.player = function (player, serv) {
})
}
}

// const nbt = require('prismarine-nbt')
// function sendBroadcastMessage (server, clients, message, sender) {
// function chatText (text) {
// return serv.supportFeature('chatPacketsUseNbtComponents')
// ? nbt.comp({ text: nbt.string(text) })
// : JSON.stringify({ text })
// }
// console.log('sendBroadcastMessage', message, sender, chatText(message))
// server.writeToClients(clients, 'player_chat', {
// plainMessage: message,
// signedChatContent: '{"text":""}',
// //unsignedChatContent: chatText(message),
// type: 0,
// senderUuid: 'd3527a0b-bc03-45d5-a878-2aafdd8c8a43', // random
// senderName: JSON.stringify({ text: 'x' }),
// senderTeam: undefined,
// timestamp: Date.now(),
// salt: 0n,
// signature: serv.supportFeature('useChatSessions') ? undefined : Buffer.alloc(0),
// previousMessages: [],
// filterType: 0,
// networkName: JSON.stringify({ text: 'v' })
// })
// }
// function broadcast (message, exclude, username) {
// sendBroadcastMessage(serv._server, Object.values(serv._server.clients).filter(client => client !== exclude), message, username)
// }
}
11 changes: 5 additions & 6 deletions test/mineflayer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,11 @@ squid.testedVersions.forEach((testedVersion, i) => {
})
it('can use /playsound', async () => {
bot.chat('/playsound ambient.weather.rain')
// TODO: why are there two events for this as opposed to one with extra fields?
if (serv.supportFeature('removedNamedSoundEffectPacket')) { // 1.19.3+
await once(bot, 'hardcodedSoundEffectHeard')
} else {
await once(bot, 'soundEffectHeard')
}
// TODO: why are there 2 mineflayer events for this as opposed to one with extra fields?
await once(bot, serv.supportFeature('removedNamedSoundEffectPacket')
? 'hardcodedSoundEffectHeard' // 1.19.3+
: 'soundEffectHeard'
)
})

function waitDragon () {
Expand Down

0 comments on commit 0c1963f

Please sign in to comment.