summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas/HookHandlers.lua
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-07 18:28:37 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-07 18:28:37 +0200
commit9790a6817cb4f1b4821de9af2630558cb5df882f (patch)
treeed9fd86bef0a74f0fcdc9b9bed12bb49c274b146 /MCServer/Plugins/ProtectionAreas/HookHandlers.lua
parentProtectionAreas: Newly added areas are stored in the DB (diff)
downloadcuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar.gz
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar.bz2
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar.lz
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar.xz
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.tar.zst
cuberite-9790a6817cb4f1b4821de9af2630558cb5df882f.zip
Diffstat (limited to 'MCServer/Plugins/ProtectionAreas/HookHandlers.lua')
-rw-r--r--MCServer/Plugins/ProtectionAreas/HookHandlers.lua16
1 files changed, 7 insertions, 9 deletions
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