From 03e29802cdde309f3734ab7b6dd17ab60b9a359f Mon Sep 17 00:00:00 2001 From: "nielsbreu@gmail.com" Date: Sun, 24 Mar 2013 15:44:44 +0000 Subject: Updated core plugin. Added limited world. Configurable through webadmin. Added a Manage server page in webadmin where you can reload/restart/stop the server. You can add players to groups with the webadmin. without the player have to relog first You can change someone's group in-game with a command, without the player have to relog first Hardcore mode Improved death messages git-svn-id: http://mc-server.googlecode.com/svn/trunk@1306 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Core/web_permissions.lua | 56 +++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 10 deletions(-) (limited to 'MCServer/Plugins/Core/web_permissions.lua') diff --git a/MCServer/Plugins/Core/web_permissions.lua b/MCServer/Plugins/Core/web_permissions.lua index 4fce502e1..962078bb2 100644 --- a/MCServer/Plugins/Core/web_permissions.lua +++ b/MCServer/Plugins/Core/web_permissions.lua @@ -1,11 +1,6 @@ local function ShowUsersTable() local Content = "

Users

" - local UsersIni = cIniFile("users.ini") - if( UsersIni:ReadFile() == false ) then - return "Could not read users.ini!" - end - local NumUsers = UsersIni:GetNumKeys() Content = Content .. "" @@ -36,11 +31,6 @@ end local function ShowGroupsTable() local Content = "

Groups

" - local GroupsIni = cIniFile("groups.ini") - if( GroupsIni:ReadFile() == false ) then - return "Could not read groups.ini!" - end - local NumGroups = GroupsIni:GetNumKeys() Content = Content .. "
" @@ -69,9 +59,55 @@ local function ShowGroupsTable() return Content end +local function AddPlayers( Request ) + local Content = "

Add Players

" + if( Request.PostParams["AddPlayerToGroup"] ~= nil ) then + if Request.PostParams["AddPlayer"] ~= "" then + if Request.PostParams["AddGroups"] ~= "" then + if GroupsIni:FindKey(Request.PostParams["AddGroup"]) == -1 then + return "Group does not exist" + end + UsersIni:DeleteKey(Request.PostParams["AddPlayer"]) + UsersIni:GetValueSet(Request.PostParams["AddPlayer"], "Groups", Request.PostParams["AddGroup"]) + UsersIni:WriteFile() + local loopPlayers = function( Player ) + if Player:GetName() == Request.PostParams["AddPlayer"] then + Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Request.PostParams["AddGroup"] ) + Player:LoadPermissionsFromDisk() + end + end + local loopWorlds = function ( World ) + World:ForEachPlayer( loopPlayers ) + end + cRoot:Get():ForEachWorld( loopWorlds ) + end + end + end + Content = Content .. [[ + +
+ +
+ + +
Player:
Group:
+ ]] + return Content +end + function HandleRequest_Permissions( Request ) + GroupsIni = cIniFile("groups.ini") + if( GroupsIni:ReadFile() == false ) then + return "Could not read groups.ini!" + end + UsersIni = cIniFile("users.ini") + if( UsersIni:ReadFile() == false ) then + return "Could not read users.ini!" + end + local Content = "" + Content = Content .. AddPlayers( Request ) Content = Content .. ShowGroupsTable() Content = Content .. ShowUsersTable() -- cgit v1.2.3