summaryrefslogtreecommitdiffstats
path: root/Plugins
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-11 14:16:13 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-04-11 14:16:13 +0200
commitae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5 (patch)
tree2b0994ab5e9709562f4dec862456c51762986ae9 /Plugins
parentAdded error messages to socket closing error conditions for *nix (diff)
downloadcuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar.gz
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar.bz2
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar.lz
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar.xz
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.tar.zst
cuberite-ae3fa2b6220b5e5f995c0b9c79db605cddcd5fb5.zip
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/Core/coords.lua4
-rw-r--r--Plugins/Core/main.lua8
-rw-r--r--Plugins/Core/regeneratechunk.lua18
-rw-r--r--Plugins/Core/viewdistance.lua10
4 files changed, 39 insertions, 1 deletions
diff --git a/Plugins/Core/coords.lua b/Plugins/Core/coords.lua
new file mode 100644
index 000000000..07cda1a92
--- /dev/null
+++ b/Plugins/Core/coords.lua
@@ -0,0 +1,4 @@
+function HandleCoordsCommand( Split, Player )
+ Player:SendMessage(cChatColor.Green .. string.format("[X:%0.2f] [Y:%0.2f] [Z:%0.2f]", Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
+ return true
+end \ No newline at end of file
diff --git a/Plugins/Core/main.lua b/Plugins/Core/main.lua
index 2706a6846..4ef67e424 100644
--- a/Plugins/Core/main.lua
+++ b/Plugins/Core/main.lua
@@ -37,7 +37,10 @@ function Initialize( Plugin )
Plugin:AddCommand("/top", " - Teleport yourself to the top most block", "core.top")
Plugin:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm")
Plugin:AddCommand("/gotoworld", " - Move to a different world!", "core.gotoworld")
-
+ Plugin:AddCommand("/coords", " - Show your current server coordinates", "core.coords")
+ Plugin:AddCommand("/viewdistance", " - [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."] - Change your view distance", "core.viewdistance")
+ Plugin:AddCommand("/regeneratechunk", " - <X [Z]> - Regenerates a chunk", "core.regeneratechunk")
+
Plugin:BindCommand( "/help", "core.help", HandleHelpCommand )
Plugin:BindCommand( "/pluginlist", "core.pluginlist", HandlePluginListCommand )
Plugin:BindCommand( "/tp", "core.teleport", HandleTPCommand )
@@ -57,6 +60,9 @@ function Initialize( Plugin )
Plugin:BindCommand( "/top", "core.top", HandleTopCommand )
Plugin:BindCommand( "/gm", "core.changegm", HandleChangeGMCommand )
Plugin:BindCommand( "/gotoworld", "core.gotoworld", HandleGotoWorldCommand )
+ Plugin:BindCommand( "/coords", "core.coords", HandleCoordsCommand )
+ Plugin:BindCommand( "/viewdistance","core.viewdistance", HandleViewDistanceCommand )
+ Plugin:BindCommand( "/regeneratechunk","core.regeneratechunk", HandleRegenerateChunkCommand )
local IniFile = cIniFile("settings.ini")
diff --git a/Plugins/Core/regeneratechunk.lua b/Plugins/Core/regeneratechunk.lua
new file mode 100644
index 000000000..b4b2874fc
--- /dev/null
+++ b/Plugins/Core/regeneratechunk.lua
@@ -0,0 +1,18 @@
+function HandleRegenerateChunkCommand( Split, Player )
+ if( (#Split == 2) or (#Split > 3) ) then
+ Player:SendMessage( cChatColor.Green .. "Usage: /regeneratechunk <X [Z]>" )
+ return true
+ end
+
+ local X = Player:GetChunkX()
+ local Z = Player:GetChunkZ()
+
+ if( #Split == 3 ) then
+ X = Split[2]
+ Z = Split[3]
+ end
+
+ Player:SendMessage(cChatColor.Green .. "Regenerating chunk ["..X..", "..Z.."]")
+ Player:GetWorld():RegenerateChunk(X, Z)
+ return true
+end \ No newline at end of file
diff --git a/Plugins/Core/viewdistance.lua b/Plugins/Core/viewdistance.lua
new file mode 100644
index 000000000..43d2a7de8
--- /dev/null
+++ b/Plugins/Core/viewdistance.lua
@@ -0,0 +1,10 @@
+function HandleViewDistanceCommand( Split, Player )
+ if( #Split ~= 2 ) then
+ Player:SendMessage( cChatColor.Green .. "Usage: /viewdistance [".. cClientHandle.MIN_VIEW_DISTANCE .."-".. cClientHandle.MAX_VIEW_DISTANCE .."]" )
+ return true
+ end
+
+ Player:GetClientHandle():SetViewDistance( Split[2] )
+ Player:SendMessage(cChatColor.Green .. "Your viewdistance has been set to " .. Player:GetClientHandle():GetViewDistance() )
+ return true
+end \ No newline at end of file