summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-11 21:21:41 +0100
committerMattes D <github@xoft.cz>2014-12-11 21:21:58 +0100
commit1142879cc8e6c585e6722d720ca0b58f619a5961 (patch)
treea3750ac0d6dd373a82871652255b8dc2c8cdb8d8 /MCServer/Plugins/Debuggers
parentDebuggers: Changed to use Info.lua file. (diff)
downloadcuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar.gz
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar.bz2
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar.lz
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar.xz
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.tar.zst
cuberite-1142879cc8e6c585e6722d720ca0b58f619a5961.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua77
-rw-r--r--MCServer/Plugins/Debuggers/Info.lua10
2 files changed, 87 insertions, 0 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index dc1d02a74..74bfbf512 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -1619,3 +1619,80 @@ end
+
+function HandleConsoleLoadChunk(a_Split)
+ -- Check params:
+ local numParams = #a_Split
+ if (numParams ~= 3) and (numParams ~= 4) then
+ return true, "Usage: " .. a_Split[1] .. " <ChunkX> <ChunkZ> [<WorldName>]"
+ end
+
+ -- Get the chunk coords:
+ local chunkX = tonumber(a_Split[2])
+ if (chunkX == nil) then
+ return true, "Not a number: '" .. a_Split[2] .. "'"
+ end
+ local chunkZ = tonumber(a_Split[3])
+ if (chunkZ == nil) then
+ return true, "Not a number: '" .. a_Split[3] .. "'"
+ end
+
+ -- Get the world:
+ local world
+ if (a_Split[4] == nil) then
+ world = cRoot:Get():GetDefaultWorld()
+ else
+ world = cRoot:Get():GetWorld(a_Split[4])
+ if (world == nil) then
+ return true, "There's no world named '" .. a_Split[4] .. "'."
+ end
+ end
+
+ -- Queue a ChunkStay for the chunk, log a message when the chunk is loaded:
+ world:ChunkStay({{chunkX, chunkZ}}, nil,
+ function()
+ LOG("Chunk [" .. chunkX .. ", " .. chunkZ .. "] is loaded")
+ end
+ )
+ return true
+end
+
+
+
+
+
+function HandleConsolePrepareChunk(a_Split)
+ -- Check params:
+ local numParams = #a_Split
+ if (numParams ~= 3) and (numParams ~= 4) then
+ return true, "Usage: " .. a_Split[1] .. " <ChunkX> <ChunkZ> [<WorldName>]"
+ end
+
+ -- Get the chunk coords:
+ local chunkX = tonumber(a_Split[2])
+ if (chunkX == nil) then
+ return true, "Not a number: '" .. a_Split[2] .. "'"
+ end
+ local chunkZ = tonumber(a_Split[3])
+ if (chunkZ == nil) then
+ return true, "Not a number: '" .. a_Split[3] .. "'"
+ end
+
+ -- Get the world:
+ local world
+ if (a_Split[4] == nil) then
+ world = cRoot:Get():GetDefaultWorld()
+ else
+ world = cRoot:Get():GetWorld(a_Split[4])
+ if (world == nil) then
+ return true, "There's no world named '" .. a_Split[4] .. "'."
+ end
+ end
+
+ -- TODO: Queue the chunk for preparing, log a message when prepared
+ return true
+end
+
+
+
+
diff --git a/MCServer/Plugins/Debuggers/Info.lua b/MCServer/Plugins/Debuggers/Info.lua
index 6e2591ffa..b96ef3de5 100644
--- a/MCServer/Plugins/Debuggers/Info.lua
+++ b/MCServer/Plugins/Debuggers/Info.lua
@@ -205,6 +205,16 @@ g_PluginInfo =
Handler = HandleConsoleSchedule,
HelpString = "Tests the world scheduling",
},
+ ["loadchunk"] =
+ {
+ Handler = HandleConsoleLoadChunk,
+ HelpString = "Loads the specified chunk into memory",
+ },
+ ["preparechunk"] =
+ {
+ Handler = HandleConsolePrepareChunk,
+ HelpString = "Prepares the specified chunk completely (load / gen / light)",
+ }
}, -- ConsoleCommands
} -- g_PluginInfo