From 2b232f547197ff061c395bf24030f489a58d9e0c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 8 Jun 2013 15:06:24 +0000 Subject: ProtectionAreas: ProtList works directly above the DB, displays areas' IDs and creators. ProtAdd and ProtAddCoords commands show the ID of the new area git-svn-id: http://mc-server.googlecode.com/svn/trunk@1564 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- .../Plugins/ProtectionAreas/CommandHandlers.lua | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'MCServer/Plugins/ProtectionAreas/CommandHandlers.lua') diff --git a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua index 18ab29f68..eec1f8042 100644 --- a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua +++ b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua @@ -44,8 +44,8 @@ function HandleAddArea(a_Split, a_Player) end -- Add the area to the storage - g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames); - a_Player:SendMessage("Area added"); + local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames); + a_Player:SendMessage("Area added, ID " .. AreaID); -- Reload all currently logged in players ReloadAllPlayersInWorld(a_Player:GetWorld():GetName()); @@ -81,8 +81,8 @@ function HandleAddAreaCoords(a_Split, a_Player) end -- Add the area to the storage - g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames); - a_Player:SendMessage("Area added"); + local AreaID = g_Storage:AddArea(Cuboid, a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames); + a_Player:SendMessage("Area added, ID = " .. AreaID); -- Reload all currently logged in players ReloadAllPlayersInWorld(a_Player:GetWorld():GetName()); @@ -195,24 +195,20 @@ function HandleListAreas(a_Split, a_Player) a_Player:SendMessage("Listing protection areas intersecting block column {" .. x .. ", " .. z .. "}:"); -- List areas intersecting the coords - local Areas = g_PlayerAreas[a_Player:GetUniqueID()] - Areas:ForEachArea( - function(a_Cuboid, a_IsAllowed) - if (not(a_Cuboid:IsInside(x, 1, z))) then - -- This cuboid doesn't intersect the column - return; - end - -- Column intersected, send to the player - local Coords = "{" .. - a_Cuboid.p1.x .. ", " .. a_Cuboid.p1.z .. "} - {" .. - a_Cuboid.p2.x .. ", " .. a_Cuboid.p2.z .. "} "; + local PlayerName = a_Player:GetName(); + local WorldName = a_Player:GetWorld():GetName(); + g_Storage:ForEachArea(x, z, WorldName, + function(AreaID, MinX, MinZ, MaxX, MaxZ, CreatorName) + local Coords = AreaID .. ": {" .. + MinX .. ", " .. MinZ .. "} - {" .. + MaxX .. ", " .. MaxZ .. "} "; local Allowance; - if (a_IsAllowed) then + if (g_Storage:IsAreaAllowed(AreaID, PlayerName, WorldName)) then Allowance = "Allowed"; else Allowance = "NOT allowed"; end - a_Player:SendMessage(" " .. Coords .. Allowance); + a_Player:SendMessage(" " .. Coords .. Allowance .. ", Created by " .. CreatorName); end ); -- cgit v1.2.3