summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2014-09-28 10:28:51 +0200
committerAlexander Harkness <me@bearbin.net>2014-09-28 10:28:51 +0200
commit4a4411d4d72efd13b38df813321565898d9da60f (patch)
tree45165e3c519381e73808fab24689ee0395134eb5 /MCServer/Plugins/APIDump
parentchanged description to be more readable. (diff)
downloadcuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar.gz
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar.bz2
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar.lz
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar.xz
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.tar.zst
cuberite-4a4411d4d72efd13b38df813321565898d9da60f.zip
Diffstat (limited to 'MCServer/Plugins/APIDump')
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnServerPing.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua
index 6dcaf3f17..6d2325fe6 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua
@@ -20,5 +20,31 @@ return
The plugin can return whether to continue processing of the hook with other plugins, the server description to
be displayed to the client, the currently online players, the player cap and the base64/png favicon data, in that order.
]],
+ CodeExamples = {
+ {
+ Title = "Change information returned to the player",
+ Desc = "Tells the client that the server description is 'test', there are one more players online than there actually are, and that the player cap is zero. It also changes the favicon data.",
+ Code = [[
+function OnServerPing(ClientHandle, ServerDescription, OnlinePlayers, MaxPlayers, Favicon)
+ -- Change Server Description
+ ServerDescription = "Test"
+
+ -- Change online / max players
+ OnlinePlayers = OnlinePlayers + 1
+ MaxPlayers = 0
+
+ -- Change favicon
+ if (cFile:IsFile("my-favicon.png")) then
+ local FaviconData = cFile:ReadWholeFile("my-favicon.png")
+ if (FaviconData != "") then
+ Favicon = Base64Encode(FaviconData)
+ end
+ end
+
+ return false, ServerDescription, OnlinePlayers, MaxPlayers, Favicon
+end
+ ]],
+ },
+ },
}, -- HOOK_SERVER_PING
}