summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers
diff options
context:
space:
mode:
Diffstat (limited to 'Server/Plugins/Debuggers')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua74
-rw-r--r--Server/Plugins/Debuggers/Info.lua12
2 files changed, 85 insertions, 1 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 0559a4ef8..5b7f26fe6 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -1459,7 +1459,7 @@ function HandleCompo(a_Split, a_Player)
-- Send one composite message to self:
local msg = cCompositeChat()
msg:AddTextPart("Hello! ", "b@e") -- bold yellow
- msg:AddUrlPart("MCServer", "http://mc-server.org")
+ msg:AddUrlPart("Cuberite", "http://cuberite.org")
msg:AddTextPart(" rules! ")
msg:AddRunCommandPart("Set morning", "/time set 0")
a_Player:SendMessage(msg)
@@ -2030,6 +2030,78 @@ end
+function HandleConsoleTestUrlParser(a_Split, a_EntireCmd)
+ LOG("Testing cUrlParser...")
+ local UrlsToTest =
+ {
+ "invalid URL",
+ "https://github.com",
+ "ftp://anonymous:user@example.com@ftp.cuberite.org:9921/releases/2015/2015-12-25.zip",
+ "ftp://anonymous:user:name:with:colons@example.com@ftp.cuberite.org:9921",
+ "http://google.com/",
+ "http://google.com/?q=cuberite",
+ "http://google.com/search?q=cuberite",
+ "http://google.com/some/search?q=cuberite#results",
+ "http://google.com/?q=cuberite#results",
+ "http://google.com/#results",
+ "ftp://cuberite.org:9921/releases/2015/2015-12-25.zip",
+ "mailto:support@cuberite.org",
+ }
+ for _, u in ipairs(UrlsToTest) do
+ LOG("URL: " .. u)
+ local scheme, username, password, host, port, path, query, fragment = cUrlParser:Parse(u)
+ if not(scheme) then
+ LOG(" Error: " .. (username or "<nil>"))
+ else
+ LOG(" Scheme = " .. scheme)
+ LOG(" Username = " .. username)
+ LOG(" Password = " .. password)
+ LOG(" Host = " .. host)
+ LOG(" Port = " .. port)
+ LOG(" Path = " .. path)
+ LOG(" Query = " .. query)
+ LOG(" Fragment = " .. fragment)
+ end
+ end
+ LOG("cUrlParser test complete")
+ return true
+end
+
+
+
+
+
+function HandleConsoleUuid(a_Split, a_EntireCmd)
+ -- Check params:
+ local playerName = a_Split[2]
+ if not(playerName) then
+ return true, "Usage: uuid <PlayerName>"
+ end
+
+ -- Query with cache:
+ LOG("Player " .. playerName .. ":")
+ local cachedUuid = cMojangAPI:GetUUIDFromPlayerName(playerName, true)
+ if not(cachedUuid) then
+ LOG(" - not in the UUID cache")
+ else
+ LOG(" - in the cache: \"" .. cachedUuid .. "\"")
+ end
+
+ -- Query online:
+ local onlineUuid = cMojangAPI:GetUUIDFromPlayerName(playerName, false)
+ if not(onlineUuid) then
+ LOG(" - UUID not available online")
+ else
+ LOG(" - online: \"" .. onlineUuid .. "\"")
+ end
+
+ return true
+end
+
+
+
+
+
function HandleConsoleBBox(a_Split)
local bbox = cBoundingBox(0, 10, 0, 10, 0, 10)
local v1 = Vector3d(1, 1, 1)
diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua
index f71ee5509..99d3ebe74 100644
--- a/Server/Plugins/Debuggers/Info.lua
+++ b/Server/Plugins/Debuggers/Info.lua
@@ -253,6 +253,18 @@ g_PluginInfo =
Handler = HandleConsoleTestTracer,
HelpString = "Tests the cLineBlockTracer",
},
+
+ ["testurlparser"] =
+ {
+ Handler = HandleConsoleTestUrlParser,
+ HelpString = "Tests the cUrlParser",
+ },
+
+ ["uuid"] =
+ {
+ Handler = HandleConsoleUuid,
+ HelpString = "Queries the cMojangAPI for a player's UUID",
+ }
}, -- ConsoleCommands
} -- g_PluginInfo