mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
Compare commits
2 commits
f5c1953fc4
...
0b3c8802ad
Author | SHA1 | Date | |
---|---|---|---|
|
0b3c8802ad | ||
|
bcbe562f0f |
2 changed files with 7 additions and 2 deletions
|
@ -10,6 +10,11 @@ const options = {
|
|||
const server = mc.createServer(options)
|
||||
const mcData = require('minecraft-data')(server.version)
|
||||
const loginPacket = mcData.loginPacket
|
||||
function chatText (text) {
|
||||
return mcData.supportFeature('chatPacketsUseNbtComponents')
|
||||
? nbt.comp({ text: nbt.string(text) })
|
||||
: JSON.stringify({ text })
|
||||
}
|
||||
|
||||
server.on('playerJoin', function (client) {
|
||||
broadcast(client.username + ' joined the game.')
|
||||
|
@ -67,7 +72,7 @@ function sendBroadcastMessage (server, clients, message, sender) {
|
|||
server.writeToClients(clients, 'player_chat', {
|
||||
plainMessage: message,
|
||||
signedChatContent: '',
|
||||
unsignedChatContent: JSON.stringify({ text: message }),
|
||||
unsignedChatContent: chatText(message),
|
||||
type: 0,
|
||||
senderUuid: 'd3527a0b-bc03-45d5-a878-2aafdd8c8a43', // random
|
||||
senderName: JSON.stringify({ text: sender }),
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
"node-fetch": "^2.6.1",
|
||||
"node-rsa": "^0.4.2",
|
||||
"prismarine-auth": "^2.2.0",
|
||||
"prismarine-chat": "github:extremeheat/prismarine-chat#nbt-chat",
|
||||
"prismarine-chat": "^1.10.0",
|
||||
"prismarine-nbt": "^2.5.0",
|
||||
"prismarine-realms": "^1.2.0",
|
||||
"protodef": "^1.8.0",
|
||||
|
|
Loading…
Reference in a new issue