icons_src | ||
embed.js | ||
embed.min.js | ||
icons.png | ||
LICENSE | ||
README.md | ||
test.html |
Eaglercraft HTML5 Ping Embed
This allows you to easily embed your Eaglercraft server's ping, player list, and MOTD in a <div> element in an HTML5 document using the same style as the game's multiplayer screen
Demo link: https://g.deev.is/eaglercraft/ping.html
How to install:
-
Download 'embed.min.js' and 'icons.png' and upload them to your server
-
Add the script:
<script type="text/javascript" src="embed.min.js"></script>
-
Create a <div> like:
<div id="embed"></div>
-
In your Javascript, create a new
ServerEmbed
object. Pass the <div> object and a CSS width as parameters:
var embed = new ServerEmbed(document.getElementById("embed"), "500px");
-
Call the
ping
function on the new object:embed.ping("127.0.0.1:25565");
(Replace
127.0.0.1:25565
with theip:port
orws://
orwss://
address of your server) -
You're done
Extra features:
The ping
function takes five arguments, four of which are optional:
ping(addr, name, forceName, hideAddress, hideCracked)
-
addr
Is theip:port
orws://
orwss://
address of your server -
name
(Optional) Sets the name to display for the server, if left undefined then the default name displayed for the server is theserver_name:
variable of config.yml of the server being pinged (once the server responds) -
forceName
(Optional) Sets if thename
parameter should always be shown as the server's name instead of the pinged server's config.ymlserver_name:
sent in the response to the ping. Default is false, so by default the optionalname
parameter is only shown until the server responds with it's configuredserver_name:
, which is then displayed instead until the ping is sent again -
hideAddress
(Optional) Sets if the second line of the server's MOTD should not display theaddr
parameter on the canvas while it is still connecting, and then also if it shouldn't display theaddr
when the destination server's response does not specify a second line in it's MOTD. Default is false -
hideCracked
(Optional) Sets if the warning icon and padlock icon, which indicate if the server uses online mode or not, should be hidden from the embed so nobody can tell if your server is cracked or not. Default is false