项目作者: tmaxmax

项目描述 :
A RESTful API which provides documentation for Minecraft's server.properties
高级语言: Go
项目地址: git://github.com/tmaxmax/serverpropertiesapi.git
创建时间: 2020-06-10T18:27:06Z
项目社区:https://github.com/tmaxmax/serverpropertiesapi

开源协议:

下载


Minecraft Server Properties API

Find useful information about Minecraft’s Java Edition server configuration file, server.properties, with this simple, RESTful API!

Usage

Make a simple GET request and decode the JSON response!

To get the whole documentation: GET http://api.mcbonanza.games/serverproperties/v1/

To get a single key: GET http://api.mcbonanza.games/serverproperties/v1/{key}, where {key} is a valid server.properties key.

To get metadata (such as the default limit value and the possible value types): GET http://api.mcbonanza.games/serverproperties/v1/meta/

Response examples

  • Whole documentation (on GET http://api.mcbonanza.games/serverproperties/v1/)
  1. {
  2. "options": {
  3. "contains": "",
  4. "type": "",
  5. "upcoming": ""
  6. },
  7. "properties": [
  8. {
  9. "name": "allow-flight",
  10. "type": "boolean",
  11. "defaultValue": "false",
  12. "values": {
  13. "min": 0,
  14. "max": 1,
  15. "possible": ["false", "true"]
  16. },
  17. "description": "Allows users to ...",
  18. "upcoming": false,
  19. "upcomingVersion": ""
  20. }
  21. ...
  22. ]
  23. }

You can filter your requests with the provided options!

  • contains option only returns the properties that contain the substring the key is attributed
  • type option only returns the properties of the requested type
  • upcoming option only returns properties that are going to be implemented in future versions, if "true", or only properties currently available, if "false"

Example request: GET http://api.mcbonanza.games/serverproperties/v1/?upcoming=true&type=integer

  1. {
  2. "options": {
  3. "contains": "",
  4. "type": "integer",
  5. "upcoming": "true"
  6. },
  7. "properties": [
  8. {
  9. "name": "entity-broadcast-range-percentage",
  10. "type": "integer",
  11. "defaultValue": "100",
  12. "values": {
  13. "min": 0,
  14. "max": 500,
  15. "possible": []
  16. },
  17. "description": "Controls how close ...",
  18. "upcoming": true,
  19. "upcomingVersion": "JE 1.16"
  20. }
  21. ]
  22. }

If there is no property that matches your options, an empty array will be returned.

  • Single key (on GET http://api.mcbonanza.games/serverproperties/v1/difficulty)
  1. {
  2. "name": "difficulty",
  3. "type": "string",
  4. "defaultValue": "easy",
  5. "values": {
  6. "min": -2147483648,
  7. "max": -2147483648,
  8. "possible": ["peaceful", "easy", "normal", "hard"]
  9. },
  10. "description": "Defines the difficulty ...",
  11. "upcoming": false,
  12. "upcomingVersion": ""
  13. }
  • Error (on GET http://api.mcbonanza.games/serverproperties/v1/sarmale). The errors are appended to the array in the order they occur.
  1. {
  2. "errors": [
  3. {
  4. "error": "404 Not Found, key \"sarmale\" doesn't exist",
  5. "retry": false
  6. }
  7. ]
  8. }

How it works

The API scrapes the official Minecraft Wiki page (specifically the server.properties page), also evaluating
the mentioned values and limits a property can be assigned. The math expressions are evaluated using math.js web service. Then the data
is sent to the user, caching it if possible.

Contributions

Fork this project, create a branch from develop, do your work, and open a pull request in the origin’s develop branch.
Don’t forget to get the module’s dependencies! Use goimports to format the code and LF line endings.