From 9790a6817cb4f1b4821de9af2630558cb5df882f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 7 Jun 2013 16:28:37 +0000 Subject: ProtectionAreas: Implemented all command handlers. They still call unimplemented methods in the DB, and haven't been properly tested git-svn-id: http://mc-server.googlecode.com/svn/trunk@1561 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/ProtectionAreas/HookHandlers.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'MCServer/Plugins/ProtectionAreas/HookHandlers.lua') diff --git a/MCServer/Plugins/ProtectionAreas/HookHandlers.lua b/MCServer/Plugins/ProtectionAreas/HookHandlers.lua index d0748a8a4..00cbcf3b3 100644 --- a/MCServer/Plugins/ProtectionAreas/HookHandlers.lua +++ b/MCServer/Plugins/ProtectionAreas/HookHandlers.lua @@ -35,10 +35,8 @@ end; function OnPlayerJoined(a_Player) -- Create a new cPlayerAreas object for this player - local PlayerName = a_Player:GetName(); - local PlayerID = a_Player:GetUniqueID(); - if (g_PlayerAreas[PlayerID] == nil) then - g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(PlayerName); + if (g_PlayerAreas[a_Player:GetUniqueID()] == nil) then + LoadPlayerAreas(a_Player); end; return false; @@ -60,8 +58,8 @@ function OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); -- Set the coords in the CommandState - GetCommandStateForPlayer(a_Player):SetCoords1(a_BlockX, a_BlockY, a_BlockZ); - a_Player:SendMessage("Coords1 set as {" .. a_BlockX .. ", " .. a_BlockY .. ", " .. a_BlockZ .."}."); + GetCommandStateForPlayer(a_Player):SetCoords1(a_BlockX, a_BlockZ); + a_Player:SendMessage("Coords1 set as {" .. a_BlockX .. ", " .. a_BlockZ .."}."); return true; end; @@ -91,14 +89,14 @@ function OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockX, a_BlockY, a_BlockZ = AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); -- Set the coords in the CommandState - GetCommandStateForPlayer(a_Player):SetCoords2(a_BlockX, a_BlockY, a_BlockZ); - a_Player:SendMessage("Coords2 set as {" .. a_BlockX .. ", " .. a_BlockY .. ", " .. a_BlockZ .."}."); + GetCommandStateForPlayer(a_Player):SetCoords2(a_BlockX, a_BlockZ); + a_Player:SendMessage("Coords2 set as {" .. a_BlockX .. ", " .. a_BlockZ .."}."); return true; end; -- Check the player areas to see whether to disable this action local Areas = g_PlayerAreas[a_Player:GetUniqueID()]; - if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockY, a_BlockZ)) then + if not(Areas:CanInteractWithBlock(a_BlockX, a_BlockZ)) then return true; end -- cgit v1.2.3