npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@minecraft-js/lunarbukkitapi

v1.3.0

Published

Defines the Lunar Client Bukkit protocol

Downloads

238

Readme

LunarBukkitAPI

GitHub Workflow Status GitHub npm (scoped)

Defines the Lunar Client Bukkit protocol

Documentation

Installation

Install the package:

$ npm install @minecraft-js/lunarbukkitapi

And then import it in your JavaScript/TypeScript file

const LunarClient = require('@minecraft-js/lunarbukkitapi'); // CommonJS

import * as LunarClient from '@minecraft-js/lunarbukkitapi'; // ES6

High level API

This library comes with a high level API for a player which means you can easily set cooldowns, set waypoints without even touching any packets!

For now since there's no MinecraftJS client/server library you need to set your own packet sending/receiving handling.

At the time of writing, the biggest client/server library is PrismarineJS and here is a simple example with that library

// PrismarineJS
const mc = require('minecraft-protocol');
const server = mc.createServer({ ... });

server.on('login', (client) => {
  ...

  let playerChannel = '';
  const lunarPlayer = new LunarClient.LunarClientPlayer({
    customHandling: {
      registerPluginChannel(channel) {
        playerChannel = channel;

        // PrismarineJS way of sending packets
        client.write('custom_payload', {
          channel: 'REGISTER',
          data: Buffer.from(channel + '\0')
        });
      },

      sendPacket(buffer) {
        // PrismarineJS way of sending packets
        client.write('custom_payload', {
          channel: playerChannel,
          data: buffer
        })
      }
    }
  });

  // Sending a cooldown
  // with id of `pearl`
  // for 15s and an ender
  // pearl as item (368)
  lunarPlayer.addCooldown('pearl', 15000, 368);
});

Benchmarks

Packet used in the benchmark: CooldownPacket

Computer specs: Ryzen 5 3600 - 16GB at 2100MHz

Reading x 836,146 ops/sec ±0.28% (97 runs sampled)
Writing x 432,880 ops/sec ±1.23% (95 runs sampled)

Run this command to run the benchmarks on your machine

$ npm run benchmark