1
0

Added /listworlds command and fixed bug in /listgroups where you have an extra comma at the end.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1629 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
nielsbreu@gmail.com 2013-06-28 10:18:55 +00:00
parent bc421842c6
commit beb36ee149
3 changed files with 22 additions and 1 deletions

View File

@ -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) )

View File

@ -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

View File

@ -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");