Coder Social home page Coder Social logo

smp-api's Introduction

An API to expose player information for Janet (or other discord bots).

Coding time:

wakatime

Support

Prove you aren't a robot and get some help here: http://invite.boredmandiscord.workers.dev/

SpigotMC page:

https://www.spigotmc.org/threads/smp-api.549051/

Available Endpoints

All API calls must include a secret header the value of which is set in the config.yml.

The plugin will refuse to load if you don't set a secret to prevent leaking player IP's and base locations.


https://yourserveripchange.me:port/players/BoredManPlays Lookup some useful player stats:

{
    "kills":"1",
    "bed":"x=189.5,y=58.5625,z=-25.5",
    "address":"127.0.0.1",
    "death":"5801",
    "level":"0",
    "lastJoined":1646231639815,
    "health":"20.0",
    "jumps":"167",
    "experience":"0.0",
    "uuid":"957c3421-5c2c-48aa-810d-2bd895804940",
    "gamemode":"CREATIVE",
    "food":"20",
    "world":"world",
    "online":false,
    "location":"x=192.5,y=58.5625,z=-25.5",
    "time":"8200",
    "deaths":"3",
    "username":"BoredManPlays"
}
key definition
kills The amount of entities the player has killed
bed Player's bed location
address The IP address of the player
death The time in seconds since the players last death
level The player's XP level
lastjoined The epoch timestamp from when the player last joined (in milliseconds)
health Player's health from 0 - 20
jumps The amount of times the player has jumped
experience The players XP points
uuid The player's UUID
gamemode The player's gamemode
food The player's hunger from 0 - 20
world The world the player is currently in
online Whether the player is currently online or using cached playerdata
location The player's location at the time of the lookup
time The amount of in game time the player has been online
deaths The amount of times the player has died
username The player's username



https://yourserveripchange.me:port/minecraft/name/BoredManPlays Lookup linked Minecraft and Discord accounts using Minecraft username: Requires DiscordSRV

{
    "discordId": "324504908013240330",
    "error": false,
    "uuid": "957c3421-5c2c-48aa-810d-2bd895804940",
    "discordTag": "BoredManPlays#0001",
    "discordName": "BoredManPlays",
    "username": "BoredManPlays"
}



https://yourserveripchange.me:port/discord/id/324504908013240330 Same as above but with the Discord ID instead of username:

{
    "discordId": "324504908013240330",
    "error": false,
    "uuid": "957c3421-5c2c-48aa-810d-2bd895804940",
    "discordTag": "BoredManPlays#0001",
    "discordName": "BoredManPlays",
    "username": "BoredManPlays"
}
key definition
discordid The user's Discord ID
error Whether request returned an error
uuid The user's Minecraft UUID
discordTag The user's Discord name and discriminator
discordName The user's Discord name
username The user's Minecraft player name



API call failed due to invalid secret header:

{
    "error":true,
    "message":"You are not authourised to access this resource"
}

Log output on failed authentication:

[SMP-API] A request to access Minecraft info from 206.189.205.251 was rejected 
as they did not pass the correct secret in the header

Configuration

The config is pretty simple. This is the default:

debug: false
port: 25567
secret: CHANGE THIS!
key definition
debug Whether debug messages should be logged to console
port The port to host the API on.
Do not use your Minecraft server port
secret The "password" that allows access to the API

Note, the plugin will not run unless you change the secret. This is explained above.

Legal Mumbo Jumbo

The idea and base code for this project came from TristanSMPAPI. It has been extensively added to by myself with much technical help from the developers of DiscordSRV

smp-api's People

Contributors

boredmancodes avatar anutley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.