0.0.6 • Published 8 years ago

scriptserver-helpers v0.0.6

Weekly downloads
5
License
ISC
Repository
github
Last release
8 years ago

scriptserver-helpers

npm.io

FYI: This package is an addon for ScriptServer and requires ScriptServer to be set up, please see here for more information.

Installation

While in root directory of your server run:

npm install scriptserver-helpers

And in your server file:

server.use('scriptserver-helpers');

Usage

This module provides the following basic helper functions to help developers get started with modules.

// .testForBlock(coords, type)
// Returns whether or not the block at the given coords matches the given type
server.testForBlock({x: 0, y: 75, z: 0}, 'air')
  .then(result => {
    if (result) doSomething();
    else doSomethingElse();
  });

// .isOnline(username)
// Returns whether or not the player is online
server.isOnline('ProxySaw')
  .then(result => {
    if (result) doSomething();
    else doSomethingElse();
  });

// .wait(ms)
// Waits a given time (milliseconds) then continues to next promise in chain
server.doSomething(withSomething)
  .then(() => server.wait(1000))
  .then(() => doSomethingElse());

// .getCoords(username)
// Returns coordinates of given user if online
server.getCoords('ProxySaw')
  .then(coords => {
    console.log(coords.x);
    console.log(coords.y);
    console.log(coords.z);
  });

// .tellRaw(text, target, options)
// Uses the minecraft command tellRaw to tell [target] [text] with [options]
server.tellRaw('Something went wrong!', '@a', {color: 'red'});
0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago