# multicraft

> Node.js API for Multicraft (https://multicraft.org)

Latest version **1.0.17** (published 2019-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install multicraft
pnpm add multicraft
yarn add multicraft
bun add multicraft
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2019-12-22 |
| First published | 2019-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 24.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Ruby |
| Maintainers | rubybae |
| Keywords | minecraft, api |

## Links

- npm: https://www.npmjs.com/package/multicraft
- Repository: https://discord.gg/59ChGRJ
- Issues: https://discord.gg/59ChGRJ
- npm.io page: https://npm.io/package/multicraft

## Dependencies (2)

- [md5](https://npm.io/package/md5.md) ^2.2.1
- [request](https://npm.io/package/request.md) ^2.88.0

## Recent versions

- 1.0.17 (latest) — 2019-12-22
- 1.0.16 — 2019-12-22
- 1.0.15 — 2019-12-19
- 1.0.14 — 2019-12-19
- 1.0.14-0 — 2019-12-19
- 1.0.12 — 2019-12-19
- 1.0.11 — 2019-12-17
- 1.0.10 — 2019-12-17
- 1.0.9 — 2019-12-17
- 1.0.8 — 2019-12-16
- 1.0.7 — 2019-12-16
- 1.0.6 — 2019-12-16
- 1.0.5 — 2019-12-16
- 1.0.4 — 2019-12-16
- 1.0.3 — 2019-12-16
- … 3 more at https://npm.io/package/multicraft/versions

## README

# Multicraft
Node.js API for Multicraft (https://multicraft.org)

### Under active development.
This package isn't finished, alot of the functions listed below either aren't working or aren't even implemented, however most of the server & user ones are, **use with caution**.

### Join the discussion!
[Discord](https://discord.gg/59ChGRJ) | [GitHub](https://discord.gg/59ChGRJ)

##### Basic implementation of the package.
```javascript
const api = require("multicraft").begin({
  url: "API PANEL URL",
  user: "USERNAME",
  key: "API_KEY"
});
```

##### Built using Promises.
If you don't know how [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) work, please take a look. Promises all us to use async/await and chained responses.

```javascript
// Chained
api.getUser(1).then((response) => {
  console.log(response);
});

// Async / Await
let response = await api.getUser(1);
console.log(response);
```

### Frequently asked questions;
- *x* is returning function not defined.
  - That function isn't implemented yet or you aren't on the latest build, firstly check for updates, if it persits, join the discord and ask for it to be implemented.
- I found a bug, or, *x* isn't working!
  - Check for updates on the package, if that doesn't fix the problem, join the discord and ask for help.
- I'd like to help out!
  - Wow that's amazing, however, currently the project source isn't public, feel free to join my discord and I'll let you know when I'm posting to GitHub.

##### List of functions.
All of these functions are prefixed by your API instance; ``api.``

User functions // 90% implemented.
```javascript
listUsers();

findUsers(field, value);

getUser(0);

getCurrentUser();

updateUser(id, field, value);

createUser(name, email, password);

deleteUser(id);

getUserRole(user_id, server_id);

setUserRole(user_id, server_id, role);

getUserFtpAccess(user_id, server_id);

setUserFtpAccess(user_id, user_id, mode);

getUserId(name);

validateUser(name, password);

generateUserApiKey(id);

getUserApiKey(user_id);

removeUserApiKey(user_id);
```

Player functions // 10% implemented.
```javascript
listPlayers(server_id);

findPlayers(server_id, field, value);

getPlayer(id);

updatePlayer(id, field, value);

createPlayer(server_id, name);

deletePlayer(id);

assignPlayerToUser(player_id, user_id);
```

Command functions // Not implemented.
```javascript
listCommands(server_id);

findCommands(server_id, field, value);

getCommand(id);

updateCommand(id, field, value);

createCommand(server_id, name, role, chat, response, run);

deleteCommand(id);
```

Server functions // 90% implemented.
```javascript
listServers();

findServers(field, value);

listServersByConnection(connection_id);

listServersByOwner(user_id);

getServer(id);

updateServer(id, field, value);

createServerOn(daemon_id = 0, no_commands = 0, no_setup_script = 0);

createServer(name = '', port = 0, base = '', players = 0, no_setup_script = 0);

suspendServer(id, stop = 1);

resumeServer(id, start = 1);

deleteServer(id, delete_dir = 'no', delete_user = 'no');

getServerStatus(id, player_list = 0);

getServerOwner(server_id);

setServerOwner(server_id, user_id);

getServerConfig(id);

updateServerConfig(id, field, value);

startServerBackup(id);

getServerBackupStatus(id);

startServer(id);

stopServer(id);

restartServer(id);

killServer(id);

startAllServers();

stopAllServers();

restartAllServers();

killAllServers();

sendConsoleCommand(server_id, command);

sendAllConsoleCommand(command);

runCommand(server_id, command_id, run_for = 0);

getServerLog(id);

clearServerLog(id);

getServerChat(id);

clearServerChat(id);

sendServerControl(id, command);

getServerResources(id);

moveServer(server_id, daemon_id);
```

Daemon functions // Fully implemented.
```javascript
listConnections();

findConnections(field, value);

getConnection(id);

removeConnection(id);

getConnectionStatus(id);

getConnectionMemory(id, include_suspended = 0);

getStatistics(daemon_id = 0, include_suspended = 0);
```

Settings function // Somewhat functional?
```javascript
listSettings();

getSetting(key);

setSetting(key, value);

deleteSetting(key);
```

Schedule functions // Not implemented.
```javascript
listSchedules(server_id);

findSchedules(server_id, field, value);

getSchedule(id);

updateSchedule(id, field, value);

createSchedule(server_id, name, ts, interval, cmd, status, for);

deleteSchedule(id);
```

Database functions // Not functional.
```javascript
getDatabaseInfo(server_id);

createDatabase(server_id);

changeDatabasePassword(server_id);

deleteDatabase(server_id);
```

Well then, that's alot of functions!

---
_Source: https://npm.io/package/multicraft · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
