diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-10 14:41:05 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-10 14:41:05 +0200 |
commit | e3713be4519b038be57e3a1d444254c6b00cba56 (patch) | |
tree | b589a7be581316d7cd7e3c6b489cacf7145fd565 /MCServer/Plugins/ProtectionAreas/Config.lua | |
parent | ProtectionAreas: Implemented reloading areas when a player moves (diff) | |
download | cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar.gz cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar.bz2 cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar.lz cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar.xz cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.tar.zst cuberite-e3713be4519b038be57e3a1d444254c6b00cba56.zip |
Diffstat (limited to 'MCServer/Plugins/ProtectionAreas/Config.lua')
-rw-r--r-- | MCServer/Plugins/ProtectionAreas/Config.lua | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/Config.lua b/MCServer/Plugins/ProtectionAreas/Config.lua index c9b131f5c..b6fe34535 100644 --- a/MCServer/Plugins/ProtectionAreas/Config.lua +++ b/MCServer/Plugins/ProtectionAreas/Config.lua @@ -8,13 +8,35 @@ cConfig = {
- m_Wand = cItem(E_ITEM_STICK, 1, 1); -- TODO: Make this configurable by loading it from an INI file
+ m_Wand = cItem(E_ITEM_STICK, 1, 1); -- The item to be used as the selection wand
+ m_AllowInteractNoArea = true; -- If there's no area, is a player allowed to build / dig?
};
+--- Initializes the cConfig object, loads the configuration from an INI file
+function InitializeConfig()
+ local ini = cIniFile("ProtectionAreas.ini");
+ if (not(ini:ReadFile())) then
+ LOGINFO(PluginPrefix .. "Cannot read ProtectionAreas.ini, all plugin configuration is set to defaults");
+ end
+ local WandItem = cItem();
+ if (
+ StringToItem(ini:GetValueSet("ProtectionAreas", "WandItem", ItemToString(cConfig.m_Wand)), WandItem) and
+ IsValidItem(WandItem.m_ItemType)
+ ) then
+ cConfig.m_Wand = WandItem;
+ end
+ cConfig.m_AllowInteractNoArea = ini:GetValueSetB("ProtectionAreas", "AllowInteractNoArea", cConfig.m_AllowInteractNoArea);
+ ini:WriteFile();
+end
+
+
+
+
+
--- Returns true if a_Item is the wand tool item
function cConfig:IsWand(a_Item)
return (
|