Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Shadowevil015/ccnetmc-api

Repository files navigation

CCNetMC API

A REST API providing info about people, places and more on CCNetMC. This is a "fork" of the EarthMC API, and 99% of the code is not written by me. Although not actually a fork, I still update from upstream when possible (I barely know any JavaScipt, and what I do know was learnt from this project). The original API was created by Owen3H and Warriorrrr.

The original source code can be found here: https://github.com/Owen3H/EarthMC-API

Basic Setup (JS Example)

  1. Install a fetch package in your chosen language.
$ npm install ccnetmc
  1. Require/import the package.
var fetch = require("node-fetch")
  1. Implement by fetching and returning the data.
var town = await fetch("https://shadowevil015.tech/api/v1/towns/new_amsterdam").then(res => res.json()).catch(err => { return err })

console.log(town)
// => {"name":"New_Amsterdam","nation":"Oceanic_Empire","residents":["ShootingRice","Shadowevil015","PinkyBleu"],"area":322,"mayor":"ShootingRice","capital":true,"x":18200,"z":3984,"bank":"$10,367.50","upkeep":"$320"}

Understanding the structure

Start with the base domain -
https://shadowevil015.tech/api/v1
Append a route from the list below
Full URL Example: https://shadowevil015.tech/api/v1/towns

Routes

Towns

All - towns/
Single - towns/townName

Nations

All - nations/
Single - [nations/nationName]https://shadowevil015.tech/api/v1/nations/Britain)

Residents

All - residents/
Single - residents/residentName

Players

This merges online players and residents.
NOTE - The "town", "nation" and "rank" keys will not appear for townless players

All - allplayers/
Single - allplayers/playerName

Online Players

All - onlineplayers/
Single - onlineplayers/playerName

Townless

Only displays townless players that are online.

townlessplayers/

Nearby

Returns any players visible on the map in a radius to a certain point.

xPos/zPos - The coordinates of a point on the dynmap.
xRadius/zRadius - The x and z radii (in blocks) around the specified coords.

nearby/xPos/zPos/xRadius/zRadius

Server Info

serverinfo/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks