diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-07-29 13:13:03 +0200 |
commit | 53e22b11857fed62e2313d6d84d90f88ed412ffb (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /MCServer/Plugins/ProtectionAreas/Config.lua | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
download | cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.gz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.bz2 cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.lz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.xz cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.tar.zst cuberite-53e22b11857fed62e2313d6d84d90f88ed412ffb.zip |
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/ProtectionAreas/Config.lua | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/Config.lua b/MCServer/Plugins/ProtectionAreas/Config.lua index b6fe34535..b40be0c75 100644 --- a/MCServer/Plugins/ProtectionAreas/Config.lua +++ b/MCServer/Plugins/ProtectionAreas/Config.lua @@ -1,55 +1,55 @@ -
--- Config.lua
-
--- Implements the cConfig class that holds the general plugin configuration
-
-
-
-
-
-cConfig = {
- 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 (
- (a_Item.m_ItemType == self.m_Wand.m_ItemType) and
- (a_Item.m_ItemDamage == self.m_Wand.m_ItemDamage)
- );
-end
-
-
-
-
-
---- Returns the wand tool item as a cItem object
-function cConfig:GetWandItem()
- return self.m_Wand;
+ +-- Config.lua + +-- Implements the cConfig class that holds the general plugin configuration + + + + + +cConfig = { + 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 ( + (a_Item.m_ItemType == self.m_Wand.m_ItemType) and + (a_Item.m_ItemDamage == self.m_Wand.m_ItemDamage) + ); +end + + + + + +--- Returns the wand tool item as a cItem object +function cConfig:GetWandItem() + return self.m_Wand; end
\ No newline at end of file |