![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
minecraft-protocol
Advanced tools
Parse and serialize minecraft packets, plus authentication and encryption.
Parse and serialize minecraft packets, plus authentication and encryption.
This package aims to be a low-level interface to the Minecraft protocol and no more. If you want a higher-level API with which to write bots, see mineflayer
var mc = require('minecraft-protocol');
var client = mc.createClient({
host: "localhost", // optional
port: 25565, // optional
username: "email@example.com",
password: "12345678",
});
client.on(0x03, function(packet) {
// Listen for chat messages and echo them back.
if (packet.message.indexOf(client.session.username) !== -1) return;
client.write(0x03, {
message: packet.message,
});
});
If the server is in offline mode, you may leave out the password
option.
var mc = require('minecraft-protocol');
var server = mc.createServer({
'online-mode': true, // optional
encryption: true, // optional
host: '0.0.0.0', // optional
port: 25565, // optional
});
server.on('login', function(client) {
client.write(0x01, {
entityId: client.id,
levelType: 'default',
gameMode: 0,
dimension: 0,
difficulty: 2,
maxPlayers: server.maxPlayers
});
client.write(0x0d, {
x: 0,
y: 1.62,
stance: 0,
z: 0,
yaw: 0,
pitch: 0,
onGround: true
});
client.write(0x03, { message: 'Hello, ' + client.username });
});
npm install minecraft-protocol
npm install minecraft-protocol
callback(err, pingResults)
pingResults
:
prefix
protocol
version
motd
playerCount
maxPlayers
Value looks like this:
[
{type: 'slot', value: slot, key: 3},
{type: 'int', value: value, key: 4},
...
]
Where the key is the numeric metadata key and the value is the value of the correct data type.
java
executable in PATH
.minecraft_server.jar
.MC_SERVER_JAR=path/to/minecraft_server.jar MC_USERNAME=email@example.com MC_PASSWORD=password npm test
packets
✓ 0x00
✓ 0x01
✓ 0x02
✓ 0x03
✓ 0x04
✓ 0x05
✓ 0x06
✓ 0x07
✓ 0x08
✓ 0x09
✓ 0x0a
✓ 0x0b
✓ 0x0c
✓ 0x0d
✓ 0x0e
✓ 0x0f
✓ 0x10
✓ 0x11
✓ 0x12
✓ 0x13
✓ 0x14
✓ 0x16
✓ 0x17
✓ 0x18
✓ 0x19
✓ 0x1a
✓ 0x1c
✓ 0x1d
✓ 0x1e
✓ 0x1f
✓ 0x20
✓ 0x21
✓ 0x22
✓ 0x23
✓ 0x26
✓ 0x27
✓ 0x28
✓ 0x29
✓ 0x2a
✓ 0x2b
✓ 0x33
✓ 0x34
✓ 0x35
✓ 0x36
✓ 0x37
✓ 0x38
✓ 0x3c
✓ 0x3d
✓ 0x3e
✓ 0x46
✓ 0x47
✓ 0x64
✓ 0x65
✓ 0x66
✓ 0x67
✓ 0x68
✓ 0x69
✓ 0x6a
✓ 0x6b
✓ 0x6c
✓ 0x82
✓ 0x83
✓ 0x84
✓ 0xc8
✓ 0xc9
✓ 0xca
✓ 0xcb
✓ 0xcc
✓ 0xcd
✓ 0xfa
✓ 0xfc
✓ 0xfd
✓ 0xfe
✓ 0xff
client
✓ pings the server
✓ connects successfully - online mode
✓ connects successfully - offline mode
✓ gets kicked when no credentials supplied in online mode
✓ does not crash for 10000ms
mc-server
✓ starts listening and shuts down cleanly
✓ kicks clients that do not log in
✓ kicks clients that do not send keepalive packets
✓ responds to ping requests
✓ clients can log in and chat
✓ gives correct reason for kicking clients when shutting down
85 tests complete
createServer
: rename encryption-enabled
option to encryption
to stay
consistent with the examples. (thanks roblabla)createClient
: don't require both email
and username
.
username
and password
arguments are used to authenticate with the
official minecraft servers and determine the case-correct username. If
you have migrated your user account to a mojang login, username
looks
like an email address.password
argument, username
is used to connect
directly to the server. In this case you will get kicked if the server is
in online mode.Emit 'error' event instead of crashing when other computers abuse the minecraft protocol.
Big thanks to Robin Lambertz for this release.
FAQs
Parse and serialize minecraft packets, plus authentication and encryption.
The npm package minecraft-protocol receives a total of 5,841 weekly downloads. As such, minecraft-protocol popularity was classified as popular.
We found that minecraft-protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.