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

observermc

v1.0.7

Published

A Node.js wrapper and API for multiple Minecraft Servers

Downloads

12

Readme

Observer.js is a wrapper that allows you to control multiple Minecraft Servers using Socket.io or JavaScript. It's written in TypeScript and based on the best node.js wrapper for Minecraft Servers: scriptserver by Garrett Cox.

Some features are:

  • Starts and stops multiple Minecrafts servers.
  • Get specific server information such as Online Players and Server Status.
  • Send commands to the servers.
  • Listen to events such as status changes, user login and logout, and get extra data with each event.
  • Connect multiple client apps using Socket.io and simple api key authentication.
  • Listen to custom events defined using RegEx

Note that this is a WIP and it was built for my own use. I will try to keep this updated in the future.

Get started

The first thing to do is install Observer.js. It's not in NPM yet, but if it was, you could install it globally like this:

npm i -g observermc

Now just start the server using the command:

$ observermc --config FULL_PATH_TO_THE_CONFIG_FILE

IMPORTANT: If the file doesn't exist, ObserverMC will try to create an empty config file on the path you provided. Once the file is generated, the api key used to connect to the server will show up in the console and also in the config file where you can change it.

Configuration

To configure Observer just open the generated config.json. Sample config:

{
  "servers": [
    {
      "name": "test-server",
      "type": "paper",
      "path": "PATH_TO_THE_SERVER_FOLDER",
      "jar": "paper.jar",
      "args": ["-Xmx2G"],
      "autostop": 5000,
      "rcon": {
        "host": "localhost",
        "port": 25575,
        "password": "test123"
      },
      "events": {
        "user-left": "/\\[(?<time>(?:[01]\\d|2[0123]):(?:[012345]\\d):(?:[012345]\\d)) INFO\\]: (?<user>\\w+) left the game */g"
      }
    }
  ],
  "apiKey": "AUTO_GENERATED_API_KEY",
  "port": 3000
}

From top to bottom the options are:

  • servers: An array of specific servers configuration
    • name: Unique name for the server
    • type: Type of the server (currently only paper supported)
    • path: Path to the server folder
    • jar: Name of the jar file
    • args: Extra arguments for java
    • autostop: (Optional) Milliseconds before the server closes if empty.
    • rcon: RCON configuration
      • host: RCON host
      • port: RCON port
      • password: RCON password
    • events: (Optional) Custom events.
  • apiKey: Secret key for client authentication
  • port: API Server port

Using a Socket.io Client

TODO

Using the JavaScript API

import {ObserverWrapper} from 'observer';

const wrapper = new ObserverWrapper(options);

TODO

License

Observer is open-sourced software licensed under the MIT license (If this is not ok please let me know, I don't know how to deal with open source licenses 😭)