Plugin to display web content in a BookView

So I came up with this idea of displaying website or web content in a book-view in Minecraft.
I quickly drafted a plugin you can take a look at here.

The idea would be to simplify verification on various web APIs as the plugin send player name, UUID and a few more data to the webserver, the server then response with a html that is parsed and displayed as book where some special rules allow formatting text and special links holding commands for the player or server to execute.

So a book page could hold for example a link
<a href="kill DosMike" target="_player">Try to kill DosMike</a>
that will be translated to something like

Text.builder("Try to kill DosMike").onClick(TextActions.executeCallback(callback->{
  Sponge.getCommandManager().process(player, "kill DosMike");

This topic is mainly to get feedback and suggestions on the idea.

1 Like

I actually quite like this idea. It would be a neat way for server owners to be able to have dynamic new on their website be available in game easily too. I am assuming that the plugin would take the returned HTML and tweak it into a book, or would the webserver be expected to respond in JSON or something else?

As already said, that’s a nice idea :smiley:

Webserver will have to return a nice html formated page. In case it has to be displayed in browser, one day.

the web server provides a regular html, the first <ul> element with a class “book” will be used and every child shall be parsed into a page.
in case some web dev wants to style the book to look good in a regular browser he can do that, or add display:none to the stylesheet and hide it for regular viewers.

while regular html has style=“color:#RRGGBB” minecraft is very limited in this aspect and Keuterio suggesed fix ClassNames to be used in e.g. spans like <span class="mc-format-c" />

You may be interested in the TextXML format that Sponge used to have

It was removed but you may want to use the old code as a basis for your project.

Should have posted that this project is done and released on ore.
About the XML parser: XML has the fundamental problem that it does not support mixed nodes (literal text and child elements). so xml does not suppotr <c4>Red Text <b>bold and red</b></c4>. That’s why e.g. Javas JLabels support html, not xml.
On the other hand the XML serializer did not use default HTML elements only, which I really disliked.
Also I thought it’s still available with TextSerializers.TEXT_XML.serialize(Text)