summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authornielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-28 12:18:55 +0200
committernielsbreu@gmail.com <nielsbreu@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-28 12:18:55 +0200
commitbeb36ee1496fa54ae9a0abcef4251d71512d48c5 (patch)
treec8b47085477b48bb3c6f6a490d05f884243d6c11 /MCServer/Plugins
parentAdded a basic RCON protocol (diff)
downloadcuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar.gz
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar.bz2
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar.lz
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar.xz
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.tar.zst
cuberite-beb36ee1496fa54ae9a0abcef4251d71512d48c5.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Core/listgroups.lua2
-rw-r--r--MCServer/Plugins/Core/listworlds.lua20
-rw-r--r--MCServer/Plugins/Core/main.lua1
3 files changed, 22 insertions, 1 deletions
diff --git a/MCServer/Plugins/Core/listgroups.lua b/MCServer/Plugins/Core/listgroups.lua
index da9a6ce67..531b46463 100644
--- a/MCServer/Plugins/Core/listgroups.lua
+++ b/MCServer/Plugins/Core/listgroups.lua
@@ -3,7 +3,7 @@ function HandleListGroupsCommand( Split, Player )
if GroupsIni:ReadFile() == false then
Player:SendMessage( cChatColor.Green .. "No groups found" )
end
- Number = GroupsIni:NumKeys()
+ Number = GroupsIni:NumKeys() - 1
Groups = {}
for i=0, Number do
table.insert( Groups, GroupsIni:KeyName(i) )
diff --git a/MCServer/Plugins/Core/listworlds.lua b/MCServer/Plugins/Core/listworlds.lua
new file mode 100644
index 000000000..753345426
--- /dev/null
+++ b/MCServer/Plugins/Core/listworlds.lua
@@ -0,0 +1,20 @@
+function HandleListWorldsCommand( Split, Player )
+ local SettingsIni = cIniFile("settings.ini")
+ if SettingsIni:ReadFile() == false then
+ Player:SendMessage( cChatColor.Green .. "No worlds found" )
+ end
+ Number = SettingsIni:NumValues("Worlds") - 1
+ Worlds = {}
+ for i=0, SettingsIni:GetNumKeys() - 1 do
+ if SettingsIni:GetKeyName(i) == "Worlds" then
+ Key = i
+ break
+ end
+ end
+ for i=0, Number do
+ table.insert( Worlds, SettingsIni:GetValue( Key, i) )
+ end
+ Player:SendMessage( cChatColor.Green .. "Worlds:" )
+ Player:SendMessage( cChatColor.Green .. table.concat( Worlds, ", " ) )
+ return true
+end \ No newline at end of file
diff --git a/MCServer/Plugins/Core/main.lua b/MCServer/Plugins/Core/main.lua
index 8f83a2989..1f24e0715 100644
--- a/MCServer/Plugins/Core/main.lua
+++ b/MCServer/Plugins/Core/main.lua
@@ -32,6 +32,7 @@ function Initialize(Plugin)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
+ PluginManager:BindCommand("/listworlds", "core.listworlds", HandleListWorldsCommand, " - Shows a list of all the worlds");
PluginManager:BindCommand("/listgroups", "core.listgroups", HandleListGroupsCommand, " - Shows a list of all the groups");
PluginManager:BindCommand("/toggledownfall", "core.toggledownfall", HandleToggleDownfallCommand, " - Toggles the weather");
PluginManager:BindCommand("/back", "core.back", HandleBackCommand, " - Return to your last position");