summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas/Storage.lua
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-04 23:05:33 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-04 23:05:33 +0200
commitf746d17424a071c15fd5b92bc521ce832ba15a07 (patch)
tree85fce40aa5d92dc03c360c916e277c5bf2f35ee6 /MCServer/Plugins/ProtectionAreas/Storage.lua
parentAdded script to generate cloc statistics (diff)
downloadcuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar.gz
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar.bz2
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar.lz
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar.xz
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.tar.zst
cuberite-f746d17424a071c15fd5b92bc521ce832ba15a07.zip
Diffstat (limited to 'MCServer/Plugins/ProtectionAreas/Storage.lua')
-rw-r--r--MCServer/Plugins/ProtectionAreas/Storage.lua49
1 files changed, 48 insertions, 1 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/Storage.lua b/MCServer/Plugins/ProtectionAreas/Storage.lua
index 260f895c2..8aebae0c7 100644
--- a/MCServer/Plugins/ProtectionAreas/Storage.lua
+++ b/MCServer/Plugins/ProtectionAreas/Storage.lua
@@ -2,8 +2,55 @@
-- Storage.lua
-- Implements the storage access object, shielding the rest of the code away from the DB
+--[[
+The cStorage class is the interface to the underlying storage, the SQLite database.
+This class knows how to load player areas from the DB, how to add or remove areas in the DB
+and other such operations.
+
+Also, a g_Storage global variable is declared, it holds the single instance of the storage.
+--]]
+
+
+
+
+
+cStorage = {};
+
+g_Storage = {};
+
+
+
+
+
+--- Initializes the storage subsystem, creates the g_Storage object
+function InitializeStorage()
+ g_Storage = cStorage:new();
+end
+
+
+
+
+
+function cStorage:new(obj)
+ obj = obj or {};
+ setmetatable(obj, self);
+ self.__index = self;
+ return obj;
+end
+
+
+
+
+--- Loads cPlayerAreas for the specified player from the DB. Returns a cPlayerAreas object
+function cStorage:LoadPlayerAreas(PlayerName)
+ local res = cPlayerAreas:new();
+ -- TODO: Load the areas from the DB, based on the player's location
+
+ -- DEBUG: Insert a dummy area for testing purposes:
+ res:AddArea(cCuboid(10, 0, 10, 20, 255, 20), false);
+ return res;
+end
--- TODO