Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
prismarine-chat
Advanced tools
A parser for a minecraft chat message
const registry = require('prismarine-registry')('1.16')
const ChatMessage = require('prismarine-chat')(registry)
const msg = new ChatMessage({"text":"Example chat mesasge"})
console.log(msg.toString()) // Example chat message
message
- Can be either text or a minecraft chat JSON objectdisplayWarning
- Display warnings if true, default to falseFlattens the message in to plain-text
lang
- (optional) - Set a custom lang (defaults to registry.language)Converts to motd format
lang
- (optional) - Set a custom lang (defaults to registry.language)parent
- Set a custom lang (defaults to mcData.language)Returns a text part from the message
idx
- Index of the partlang
- (optional) - Set a custom lang (defaults to registry.language)Converts to ansi format
lang
- (optional) - Set a custom lang (defaults to registry.language)codes
- (optional) - Specify which ANSI formatting codes should be used for each Minecraft color codeConverts to escaped HTML
lang
- (optional) - Set a custom lang (defaults to registry.language)codes
- (optional) - Specify which CSS style props should be used for each Minecraft color codeallowedFormats
- The set of allowed formats. Default is ['color', 'bold', 'strikethrough', 'underlined', 'italic']Returns the count of text extras and child ChatMessages Does not count recursively in to the children
Appends another ChatMessage or a string
Returns a clone of the ChatMessage
const registry = require('prismarine-registry')('1.16')
const { MessageBuilder } = require('prismarine-chat')(registry)
const msg = new MessageBuilder().setText('Example chat mesasge')
console.log(JSON.stringify(msg)) // The string as a message component
Returns a prismarine-chat representation of the message recieved from the 'chat' packet, example shown here
(1.19+) Loads a chat message sent by server that needs to be formatted on client side.
check code for examples (and explanations) from here on
sets every one of the formatting options to false and sets text to reset
type
builder.toJSON()
is the same thing as JSON.stringify(builder)
runs JSON.stringify()
on this
convert string with color codes like &4Hello&cWorld
to a MessageBuilder
object
This method is internally called by fromNotch.
mcpc 1.20.3 uses NBT instead of JSON in some places to store chat, so the schema is a bit different.
processNbtMessage
normalizes the JS object obtained from nbt derealization to the old JSON schema,
so it can be used to instantiate a ChatMessage.
1.10.1
FAQs
Wrapper for a minecraft chat message
The npm package prismarine-chat receives a total of 12,903 weekly downloads. As such, prismarine-chat popularity was classified as popular.
We found that prismarine-chat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.