WebBooks - Display magic content from the interwebz in a book!


This is a discussion topic for the Ore project, WebBooks. View the full project on Ore for downloads and more information.


Open websites in Minecraft

The main command is /webbook or /wbk for short. Or /url if you fancy that.
The syntax is as follows: /<command> -s -c <url> [target].

  • url is the website to load and display
  • target is a optional parameter specifying who’s supposed to see the website.
    This parameter requires the permission webbooks.url.other
  • -c will open the website paginated into the chat instead of as a book.
    following links will open a book reguardless
  • -s this can not be used with -c as it supressed any output. Instead the website will be stored away in a physical book.
    Links that execute server-commands will not work well with those!
    This option requires the permission webbooks.save
    The base permission to use the command is webbooks.url.command


The config file provides options to proxy the requests. This is usefull as every website will be loaded by the game-server. So going to any website will expose the ip to it. Not like you can just lookup the ip by the server-name, but it’s there as a feature.
Keep in mind tho that any response from the web-server must happen within 3 seconds before timing out!

Additionally you can specify a url to display when a player joins your server. This might be usefull to have a dynamic greeting message, automatically updated rules or what ever you come up with to write on your webserver.


Pages are basically selected by document.querySelector("ul.book").children().

Player data are sent using POST data, making it a bit easier to repush GET data from links within the webbook.
All available Data are listen below and use a slash ‘/’ as data separator, so the location data may look something like this:
Location=-820.4/5/723.2 meaning the coordinates are X -820.4, Y 5, Z 723.2

Example PHP showcasing the required html structure for books to load:

//Preparing data for display, split them on the delimiter '/'
$worldData = explode('/', $_POST['World']);
$worldName = $worldData[0];

$statusData = explode('/', $_POST['Status']);
$health = $statusData[0];
$level = $statusData[2];

$playerName = $_POST['Name'];
<!DOCTYPE html>
  <title>Test Book</title>
  <ul class="book">
    <li><u>This is <span class="mc-m">website</span> book!</u>
    <br>Your User-Agent: <?= $_SERVER['HTTP_USER_AGENT'] ?>
    <br><i>1</i> <a href="#2">2</a> <a href="#3">3</a>

    <li>Hello, <?= $playerName ?> level <?= $level ?>
    <br>You are currently in <?= $worldName ?> with <?= $health ?> HP
    <br><a href="#1">1</a> <i>2</i> <a href="#3">3</a>

    <li>Test some links:
    <br><a href="kill" target="_player">Die now</a>
    <br><a href="test.php">Reload site</a>
    <br><a href="stop" target="_server" data-permission="webbooks.links.admin" title="Please dont :<">Kill the server</a>
    <br><a href="http://www.google.com" target="_blank">Go to google</a>
    <br><a href="#1">1</a> <a href="#2">2</a> <i>3</i>

Formatting your website

To reflect the limited set for formats available to minecraft a fix set of style classes has to be used.
Those can in return be defined in your stylesheet as well to support displaying the content in an actual web-browser.

The class names have a mc--Prefix followed by the format-code. Some bold red text could be:

<span class="mc-c mc-l">Text</span> or
<b><span class="mc-c">Text</span></b> or
<b class="mc-c">Text</b>

Links and special targets

Links will work as expected, loading the website and viewing it as another book.
As you might expect if you add target="_blank" to your link Minecraft will ask the player to open the link in the system web-browser.

But it would be pretty boring if that was everything a book could do, so there’s a little bit more you can do with links:

  • <a href="#1"> will not jump to sections with the specified id, but instead jump to the given pagenumber
  • <a href="command" target="_player"> will execute the command in href as if the player typed it. the / is optional.
  • <a href="command" target="_server"> will execute the command in href as the server with op-powers. These links will break if you save the website, but not cause any big errors (Besides telling the player that the callback stopped working)

Links with target “_player” and “_server” allow for a additional attribute data-permission to restrict usage.
Using this parameter on “_player” commands will break the link in saves book in the same way “_sever” commands will break in saved books.
An example would be <a href="stop" target="_server" data-permission="server.admin.stop">Stop the server</a>

Available player-data:

These data are sent to the server using the POST data

  • Name: <PlayerName>
  • UUID: <PlayerUUID>
  • World: <WorldName>/<WorldUUID>
  • Location: <X>/<Y>/<Z>
  • Connection: <IP>:<Port>/<Latency>ms
  • Joined: <LastJoined>/<FirstJoined>
  • Status: <Health>/<FoodLevel>/<Level>/<GameMode>

User-Agent string:

<MinecraftName>(<ExecutionType>/<Type>) <MinecraftVersion>/<SpongeName> <SpongeVersion>/WebBooks(webbook) <WebBooksVersion>

This Plugin utilizes JSoup

Jsoup is licensed under MIT-License
Poject HomepageLicense-Text

Web-API - Provides an admin panel and API for your Minecraft server
Web-API [v4] - AdminPanel & RESTful web server [now with screenshots!]
:book: BookOTD 2.0.0 - Display a "message of the day" to your users in the Book GUI [MC1.10.2+/API5+]

That was done so fast :smiley:


Why is requesting the page performing a POST rather than a GET?


I was wondering about that too. I believe because its easier to transmit the data that is sent along to the page like that. But it should probably be mentioned somewhere more explicitly than just the sample code.


Yh, it just seems to be data transfer but it would be nice if it stated it on the page, I think it would be better to understand things if the PHP example instead of having a foreach loop cycling through the post data would show individually echoing out each bit of data.
Its also a little difficult to understand that the different parts of “Available player-data” refer to each bit of post data, and things like Status are infact 1 long string seperated by /


Could we get a permission for executing the server commands? or is that a vanilla issue? Not a fan of a player being able to get ahold of a dropped book by an op or something that gives them permissions and things they shouldn’t have


I’m using POST data for the player information to allow you as web-developer to repost GET data with links such as <a href="index.html?content=rules">Rules</a> and to keep them separate. As for the Argument: “But it should be a GET request because you request data” - no server will really care, and so I don’t care, yes the concept exists, but it is in no way enforced.

As for the example: I will provide a more clear example and note under Available player-data that these fields are available as $_POST fields.

Requiring permissions requires non-standard tag attributes and if you want to suggest a good one I’ll try and see if I can implement those. Shall this result in the Link being completely dead if the player does not have permission or shall it retry in case the permission changes and cause a “You do not have permission to do this”-message in chat?


I tried to convince him but I failed :joy:


A new version has been released for WebBooks, it is available for download here.

Display magic content from the interwebz in a book!

Now parsing data-permission on links with target “_player” or “_server”


A new version has been released for WebBooks, it is available for download here.

Display magic content from the interwebz in a book!

This Version is a Cause-Refactor fix for the more recent API 7 of SpongeAPI
Use Version 1.1 for API 6, API 6.1 and early API 7


A new version has been released for WebBooks, it is available for download here.

Display magic content from the interwebz in a book!

Reupload for Minecraft 1.12.2

For a API 6 Version (MC 1.12) see the github page


Great idea but it doesn’t work for our players on server join!?


Did you add the URL you want to be displayed to the config? Also remeber that you can’t just display any URL with it. The website needs to provide a HTML structure like the one described in the original post.


Could you please show us what command do you type do display a book or which mechanism you use to display it on player join ?


Uhm… okay, I think it was a misunderstanding. I thought the plugin opens the configured URL out of the box if a player joins the server.
So, I’m using kt-skript which handles the join check. That combination works for me.

“Additionally you can specify a url to display when a player joins your server. (…)”

This is not working.


There should be an option for that in the generated config :thinking:
Could you please open an issue on my git if that’s missing? I won’t be able to work on stuff for a few more weeks.