diff options
author | Mattes D <github@xoft.cz> | 2015-02-21 09:41:14 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-02-21 09:41:14 +0100 |
commit | b9e4fe0a3b2a6a4d688d1a0807f15944361fb585 (patch) | |
tree | d275514c962f4e852cfd6dede9e4cde349f6dbc7 /MCServer/Plugins/Debuggers/Debuggers.lua | |
parent | Fixed monster spawn randomness. (diff) | |
download | cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar.gz cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar.bz2 cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar.lz cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar.xz cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.tar.zst cuberite-b9e4fe0a3b2a6a4d688d1a0807f15944361fb585.zip |
Diffstat (limited to 'MCServer/Plugins/Debuggers/Debuggers.lua')
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index a46072324..a28ffa552 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1476,7 +1476,7 @@ function HandleWESel(a_Split, a_Player) SelCuboid:Expand(NumBlocks, NumBlocks, 0, 0, NumBlocks, NumBlocks) -- Set the selection: - local IsSuccess = cPluginManager:CallPlugin("WorldEdit", "SetPlayerCuboidSelection", a_Player, SelCuboid) + IsSuccess = cPluginManager:CallPlugin("WorldEdit", "SetPlayerCuboidSelection", a_Player, SelCuboid) if not(IsSuccess) then a_Player:SendMessage(cCompositeChat():SetMessageType(mtFailure):AddTextPart("Cannot adjust selection, WorldEdit reported failure while setting new selection")) return true @@ -1606,17 +1606,36 @@ end -function HandleConsoleSchedule(a_Split) - local prev = os.clock() - LOG("Scheduling a task for 2 seconds in the future (current os.clock is " .. prev .. ")") - cRoot:Get():GetDefaultWorld():ScheduleTask(40, - function () - local current = os.clock() - local diff = current - prev - LOG("Scheduled function is called. Current os.clock is " .. current .. ", difference is " .. diff .. ")") - end - ) - return true, "Task scheduled" +-- List of hashing functions to test: +local HashFunctions = +{ + {"md5", md5 }, + {"cCryptoHash.md5", cCryptoHash.md5 }, + {"cCryptoHash.md5HexString", cCryptoHash.md5HexString }, + {"cCryptoHash.sha1", cCryptoHash.sha1 }, + {"cCryptoHash.sha1HexString", cCryptoHash.sha1HexString }, +} + +-- List of strings to try hashing: +local HashExamples = +{ + "", + "\0", + "test", +} + +function HandleConsoleHash(a_Split) + for _, str in ipairs(HashExamples) do + LOG("Hashing string \"" .. str .. "\":") + for _, hash in ipairs(HashFunctions) do + if not(hash[2]) then + LOG("Hash function " .. hash[1] .. " doesn't exist in the API!") + else + LOG(hash[1] .. "() = " .. hash[2](str)) + end + end -- for hash - HashFunctions[] + end -- for str - HashExamples[] + return true end @@ -1704,3 +1723,20 @@ end + +function HandleConsoleSchedule(a_Split) + local prev = os.clock() + LOG("Scheduling a task for 2 seconds in the future (current os.clock is " .. prev .. ")") + cRoot:Get():GetDefaultWorld():ScheduleTask(40, + function () + local current = os.clock() + local diff = current - prev + LOG("Scheduled function is called. Current os.clock is " .. current .. ", difference is " .. diff .. ")") + end + ) + return true, "Task scheduled" +end + + + + |