jsplanet
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

JsPlanet

JsPlanet is a Javascript controller written in TypeScript for Trackmania 2020 dedicated server.

Usage

// Import the controller
import { JsPlanet } from "jsplanet";

// Instantiate the controller
const jsPlanet = new JsPlanet("localhost", 5000, "SuperAdmin", "SuperAdmin");

jsPlanet.on("ready", () => {
  console.log("JsPlanet is ready to use.");

  // Send a message to all players
  jsPlanet.chatManager.send("Controller has started.");
});

jsPlanet.on("race", (checkpoint) =>
  console.log(
    `${checkpoint.player.nickname} has finished in ${checkpoint.time} ms.`,
  ),
);

// Connect JsPlanet to the Trackmania Xml-RPC server
await jsPlanet.connect();

Contributing

Ensure a supported NodeJS version is installed with Yarn and install dependencies with Yarn.

Trackmania dev server

Ensure Docker is installed, copy .env.example to .env and fulfill it. Start a Trackmania development server with docker compose by running

docker compose -f compose.dev.yml up --build

License

MIT

Package Sidebar

Install

npm i jsplanet

Weekly Downloads

49

Version

0.5.1

License

MIT

Unpacked Size

102 kB

Total Files

49

Last publish

Collaborators

  • cordonzeus22