From 38aad32a8b92a0189483f0f61a42660ee31a835c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 18 Mar 2014 13:54:32 +0100 Subject: Debuggers: Using binary file mode for .schematics. --- MCServer/Plugins/Debuggers/Debuggers.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index d2c9a2a49..fe3efa306 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -217,7 +217,7 @@ function TestBlockAreasString() return end cFile:CreateFolder("schematics") - local f = io.open("schematics/StringTest.schematic", "w") + local f = io.open("schematics/StringTest.schematic", "wb") f:write(Data) f:close() @@ -230,7 +230,7 @@ function TestBlockAreasString() BA2:Clear() -- Load another area from a string in that file: - f = io.open("schematics/StringTest.schematic", "r") + f = io.open("schematics/StringTest.schematic", "rb") Data = f:read("*all") if not(BA2:LoadFromSchematicString(Data)) then LOG("Cannot load schematic from string") -- cgit v1.2.3 From 7cc44d4d8b6b6142ab45f955890a92e395604142 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 28 Mar 2014 13:34:32 +0100 Subject: Debuggers: Deactivated the chunk generator callback. --- MCServer/Plugins/Debuggers/Debuggers.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index fe3efa306..2cb014875 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -27,11 +27,13 @@ function Initialize(Plugin) PM:AddHook(cPluginManager.HOOK_CHAT, OnChat); PM:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity); PM:AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick); - PM:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); PM:AddHook(cPluginManager.HOOK_PLUGINS_LOADED, OnPluginsLoaded); PM:AddHook(cPluginManager.HOOK_PLUGIN_MESSAGE, OnPluginMessage); PM:AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined) + -- _X: Disabled so that the normal operation doesn't interfere with anything + -- PM:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); + PM:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); PM:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities"); PM:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool"); -- cgit v1.2.3 From 8126d9e66ef1ac90db2660ae357c9aa1c14c7126 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 31 Mar 2014 22:51:14 +0200 Subject: Console logging supports cCompositeChat as its parameters. --- MCServer/Plugins/Debuggers/Debuggers.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 2cb014875..2619bd6c4 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -75,6 +75,15 @@ function Initialize(Plugin) -- TestPluginCalls(); TestBlockAreasString() + + --[[ + -- Test cCompositeChat usage in console-logging: + LOGINFO(cCompositeChat("This is a simple message with some @2 color formatting @4 and http://links.to .") + :AddSuggestCommandPart("(Suggested command)", "cmd") + :AddRunCommandPart("(Run command)", "cmd") + :SetMessageType(mtInfo) + ) + --]] return true end; -- cgit v1.2.3 From 67d7ad86896e90b799a0479a86a6e764c7fe36da Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 2 Apr 2014 11:58:19 +0200 Subject: Debuggers: Added a Base64 API roundtrip test. --- MCServer/Plugins/Debuggers/Debuggers.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins/Debuggers') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 2619bd6c4..064d5d772 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -69,12 +69,13 @@ function Initialize(Plugin) LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) - -- TestBlockAreas(); - -- TestSQLiteBindings(); - -- TestExpatBindings(); - -- TestPluginCalls(); + -- TestBlockAreas() + -- TestSQLiteBindings() + -- TestExpatBindings() + -- TestPluginCalls() TestBlockAreasString() + TestStringBase64() --[[ -- Test cCompositeChat usage in console-logging: @@ -252,6 +253,24 @@ end +function TestStringBase64() + -- Create a binary string: + local s = "" + for i = 0, 255 do + s = s .. string.char(i) + end + + -- Roundtrip through Base64: + local Base64 = Base64Encode(s) + local UnBase64 = Base64Decode(Base64) + + assert(UnBase64 == s) +end + + + + + function TestSQLiteBindings() LOG("Testing SQLite bindings..."); -- cgit v1.2.3