summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-07 21:58:02 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-07 21:58:02 +0200
commit018adc3153500f84a2f416399c22f6c5f437c661 (patch)
tree0a3e60273ba02650128cadede3c12c68ceb4ca89 /MCServer/Plugins/ProtectionAreas
parentProtectionAreas: Implemented all command handlers. (diff)
downloadcuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar.gz
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar.bz2
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar.lz
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar.xz
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.tar.zst
cuberite-018adc3153500f84a2f416399c22f6c5f437c661.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/ProtectionAreas/CommandState.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/CommandState.lua b/MCServer/Plugins/ProtectionAreas/CommandState.lua
index dacf04599..2911688a8 100644
--- a/MCServer/Plugins/ProtectionAreas/CommandState.lua
+++ b/MCServer/Plugins/ProtectionAreas/CommandState.lua
@@ -21,7 +21,8 @@ cCommandState = {
m_Coords1 = {x = 0, z = 0}; -- lclk coords
m_Coords2 = {x = 0, z = 0}; -- rclk coords
m_LastCoords = 0; -- When Coords1 or Coords2 is set, this gets set to 1 or 2, signifying the last changed set of coords
- m_HasCoords = 1; -- Set to 0, 1, 2 or 3, based on which set of coords has been set (bitmask)
+ m_HasCoords1 = false; -- Set to true when m_Coords1 has been set by the user
+ m_HasCoords2 = false; -- Set to true when m_Coords2 has been set by the user
};
g_CommandStates = {};
@@ -43,14 +44,14 @@ end
--- Returns the current coord pair as a cCuboid object
function cCommandState:GetCurrentCuboid()
- if (self.m_HasCoords ~= 3) then
+ if (not(self.m_HasCoords1) or not(self.m_HasCoords2)) then
-- Some of the coords haven't been set yet
return nil;
end
local res = cCuboid(
- self.m_Coords1.x, self.m_Coords1.y, self.m_Coords1.z,
- self.m_Coords2.x, self.m_Coords2.y, self.m_Coords2.z
+ self.m_Coords1.x, 0, self.m_Coords1.z,
+ self.m_Coords2.x, 255, self.m_Coords2.z
);
res:Sort();
return res;
@@ -86,6 +87,7 @@ function cCommandState:SetCoords1(a_BlockX, a_BlockZ)
self.m_Coords1.x = a_BlockX;
self.m_Coords1.z = a_BlockZ;
self.m_LastCoords = 1;
+ self.m_HasCoords1 = true;
end
@@ -97,6 +99,7 @@ function cCommandState:SetCoords2(a_BlockX, a_BlockZ)
self.m_Coords2.x = a_BlockX;
self.m_Coords2.z = a_BlockZ;
self.m_LastCoords = 2;
+ self.m_HasCoords2 = true;
end