promotional bannermobile promotional banner

MinerBuddyServer

RESTfull server to allow remote clients to query Bukkit server data and trigger preset commands.

MineBuddyServer

MinerBuddy Server is a RESTfull server implementation to allow remote clients to query Bukkit server data as JSON and trigger pre-set commands.

In simpler terms it lets you get JSON data that you can use in your own scripts, or remotely trigger commands, for example in an attached forum/website.

For example this URL: http://yourmcserver.tld:25569/players/ Might return:

{"Players": ["sablednah","lordsable"] }

and : http://127.0.0.1:25569/player/sablednah Might return:

{
"DisplayName": "sablednah",
"EntityId": "31",
"Op": true,
"GameMode": "SURVIVAL",
"Blocking": false,
"Sneaking": false,
"Sprinting": false,
"Sleeping": false,
"SleepingIgnored": true,
"Dead": false,
"Health": "34.0",
"MaxHealth": "71.0",
"Exhaustion": "1.4372691",
"Saturation": "0.0",
"FoodLevel": "20",
"RemainingAir": "300",
"MaximumAir": "300",
"Holding": "SULPHUR",
"PlayerTime": "118023105",
"Level": "165",
"Exp": "0.61171794",
"TotalExperience": "73147",
"AllowFlight": false,
"Flying": false,
"Location": {"X":-4688.8167977237845,"Y":66.0,"Z":-612.1939240003135,"Pitch":-11.10005,"Yaw":139.19807,"Block": "AIR","BlockUnder": "STONE","Biome": "PLAINS","BlockLight":0,"SkyLight":0,"Light":0},
"Vector": {"X":0.0,"Y":-0.0784000015258789,"Z":0.0,"Length":0.0784000015258789,"Direction":0.0},
"World": {"Name":"ZARP","Time":118023105,"Weather":false,"Thunder":false,"WeatherLeft":16966,"ThunderLeft":21779},
"CompassTarget": {"X":-4761.0,"Y":66.0,"Z":-2044.0,"Pitch":0.0,"Yaw":0.0,"Block": "DOUBLE_STEP","BlockUnder": "DIRT","Biome": "PLAINS","BlockLight":0,"SkyLight":0,"Light":0},
"CompassDistance": 1433.6247953912032
}

You can also configure commands to be run in the console on a web request, passing parameters. For example: http://127.0.0.1:25569/command/approve/sablednah/1f8b2e114a6a90f106dd04f3ed711a5c62b32a47f36fafc1afd0a4f54e77efe4 can be mapped to this config to approve a new member.

    approve:
        args: 1
        console: permissions player setgroup %1 Member
        password: imagicraft

And this could be used to ban a player: http://127.0.0.1:25569/command/ban/sablednah/Banned+for+griefing/e6b8772430ae3a98e9ee24e377de2f8678ff51d602571cd9f32487b489972326

    ban:
        args: 2
        console: ban %1 %2
        password: imagicraft

Config

Example/Default Config

debugMode: true

commands:
    approve:
        args: 1
        console: permissions player setgroup %1 Member
        password: imagicraft
    kick:
        args: 2
        console: kick %1 %2
        password: imagicraft
    ban:
        args: 2
        console: ban %1 %2
        password: imagicraft

Details

debug: [true|false] Enable debug mode for detailed errors.

commands: A list of commands that can be triggered by server requests. Consisting of: args: [integer] number of arguments to require in the request. console: [string] The command to run from the console = use %1 for argument 1, %2 for argument 2 and so on. password: [string] the password required to use this command. See the notes below.

Example usage

Here's an example PHP snippet

<?php
$serverip = "127.0.0.1";
$portnum  = "25569";
$command  = "approve";
$pwd      = "imagicraft";

$username = $_POST["username"]

$salted   = utf8_encode($pwd . $command);
$hash     = hash("sha256",$salted);

$url      = "http://" . $serverip . ":" . $portnum . "/command/" . $command . "/" . $username . "/" . $hash; 
$result   = file_get_contents ( $url );
?>

You could build such a script into your forum sign up page to move registered players into a different group for permissions.

Note the password structure. The password is always added at the end of the request, and consists of a sha256 hash of the password in configuration added to the command name.

Commands

/MinerBuddyHealth reload Reload settings from config.yml

Permissions

None. (Yet.)

Changelog

1.0: First release.

Source Code

https:github.com/Sablednah/MinerBuddyServer

Donations

Donations of any amount are, of course appreciated :)

Contributions go towards maintaining my development server to encourage continued development. MinerBuddyServer is solo coded by me so if you think that time is worth something then hit the button in the top right! ;)

The MinerBuddyServer Team

profile avatar
  • 7
    Projects
  • 1.0M
    Downloads

More from sablednahView all

  • MobHealth project image

    MobHealth

    • 989.6K
    • Bukkit Plugins

    Simple plugin to let you know the damage you just caused to a mob, and how much health it has left.

    • 989.6K
    • June 18, 2016
    • Bukkit Plugins
    • +3
  • LegendQuest project image

    LegendQuest

    • 29.6K
    • Bukkit Plugins

    Complete RPG Mod, featuring Races, Classes and skills.

    • 29.6K
    • June 25, 2015
    • Bukkit Plugins
    • +1
  • ChatFilter project image

    ChatFilter

    • 17.0K
    • Bukkit Plugins

    Filter chat to stop messages!

    • 17.0K
    • May 14, 2014
    • Bukkit Plugins
    • +1
  • WoodDye project image

    WoodDye

    • 3.6K
    • Bukkit Plugins

    No plugin does wood more good! Stain your wood with dyes - bleach it with bone meal!

    • 3.6K
    • March 21, 2014
    • Bukkit Plugins
    • +2
  • MobHealth project image

    MobHealth

    • 989.6K
    • Bukkit Plugins

    Simple plugin to let you know the damage you just caused to a mob, and how much health it has left.

    • 989.6K
    • June 18, 2016
    • Bukkit Plugins
    • +3
  • LegendQuest project image

    LegendQuest

    • 29.6K
    • Bukkit Plugins

    Complete RPG Mod, featuring Races, Classes and skills.

    • 29.6K
    • June 25, 2015
    • Bukkit Plugins
    • +1
  • ChatFilter project image

    ChatFilter

    • 17.0K
    • Bukkit Plugins

    Filter chat to stop messages!

    • 17.0K
    • May 14, 2014
    • Bukkit Plugins
    • +1
  • WoodDye project image

    WoodDye

    • 3.6K
    • Bukkit Plugins

    No plugin does wood more good! Stain your wood with dyes - bleach it with bone meal!

    • 3.6K
    • March 21, 2014
    • Bukkit Plugins
    • +2