summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2013-07-29 13:13:03 +0200
committerAlexander Harkness <bearbin@gmail.com>2013-07-29 13:13:03 +0200
commit53e22b11857fed62e2313d6d84d90f88ed412ffb (patch)
treec61e56725da7dff0154d566722651e2c39c9d6c6 /MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
parentWebAdmin: Removed the duplicate memory usage querying (diff)
downloadcuberite-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 'MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua')
-rw-r--r--MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua142
1 files changed, 71 insertions, 71 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua b/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
index 8c2db1387..cbe3fa94d 100644
--- a/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
+++ b/MCServer/Plugins/ProtectionAreas/ProtectionAreas.lua
@@ -1,71 +1,71 @@
-
--- ProtectionAreas.lua
--- Defines the main plugin entrypoint, as well as some utility functions
-
-
-
-
-
---- Prefix for all messages logged to the server console
-PluginPrefix = "ProtectionAreas: ";
-
---- Bounds for the area loading. Areas less this far in any direction from the player will be loaded into cPlayerAreas
-g_AreaBounds = 48;
-
---- If a player moves this close to the PlayerAreas bounds, the PlayerAreas will be re-queried
-g_AreaSafeEdge = 12;
-
-
-
-
-
---- Called by MCS when the plugin loads
--- Returns true if initialization successful, false otherwise
-function Initialize(a_Plugin)
- a_Plugin:SetName("ProtectionAreas");
- a_Plugin:SetVersion(1);
-
- InitializeConfig();
- if (not(InitializeStorage())) then
- LOGWARNING(PluginPrefix .. "failed to initialize Storage, plugin is disabled");
- return false;
- end
- InitializeHooks(a_Plugin);
- InitializeCommandHandlers();
-
- -- We might be reloading, so there may be players already present in the server; reload all of them
- cRoot:Get():ForEachWorld(
- function(a_World)
- ReloadAllPlayersInWorld(a_World:GetName());
- end
- );
-
- return true;
-end
-
-
-
-
-
---- Loads a cPlayerAreas object from the DB for the player, and assigns it to the player map
-function LoadPlayerAreas(a_Player)
- local PlayerID = a_Player:GetUniqueID();
- local PlayerX = math.floor(a_Player:GetPosX());
- local PlayerZ = math.floor(a_Player:GetPosZ());
- local WorldName = a_Player:GetWorld():GetName();
- g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(a_Player:GetName(), PlayerX, PlayerZ, WorldName);
-end
-
-
-
-
-
-function ReloadAllPlayersInWorld(a_WorldName)
- local World = cRoot:Get():GetWorld(a_WorldName);
- World:ForEachPlayer(LoadPlayerAreas);
-end
-
-
-
-
-
+
+-- ProtectionAreas.lua
+-- Defines the main plugin entrypoint, as well as some utility functions
+
+
+
+
+
+--- Prefix for all messages logged to the server console
+PluginPrefix = "ProtectionAreas: ";
+
+--- Bounds for the area loading. Areas less this far in any direction from the player will be loaded into cPlayerAreas
+g_AreaBounds = 48;
+
+--- If a player moves this close to the PlayerAreas bounds, the PlayerAreas will be re-queried
+g_AreaSafeEdge = 12;
+
+
+
+
+
+--- Called by MCS when the plugin loads
+-- Returns true if initialization successful, false otherwise
+function Initialize(a_Plugin)
+ a_Plugin:SetName("ProtectionAreas");
+ a_Plugin:SetVersion(1);
+
+ InitializeConfig();
+ if (not(InitializeStorage())) then
+ LOGWARNING(PluginPrefix .. "failed to initialize Storage, plugin is disabled");
+ return false;
+ end
+ InitializeHooks(a_Plugin);
+ InitializeCommandHandlers();
+
+ -- We might be reloading, so there may be players already present in the server; reload all of them
+ cRoot:Get():ForEachWorld(
+ function(a_World)
+ ReloadAllPlayersInWorld(a_World:GetName());
+ end
+ );
+
+ return true;
+end
+
+
+
+
+
+--- Loads a cPlayerAreas object from the DB for the player, and assigns it to the player map
+function LoadPlayerAreas(a_Player)
+ local PlayerID = a_Player:GetUniqueID();
+ local PlayerX = math.floor(a_Player:GetPosX());
+ local PlayerZ = math.floor(a_Player:GetPosZ());
+ local WorldName = a_Player:GetWorld():GetName();
+ g_PlayerAreas[PlayerID] = g_Storage:LoadPlayerAreas(a_Player:GetName(), PlayerX, PlayerZ, WorldName);
+end
+
+
+
+
+
+function ReloadAllPlayersInWorld(a_WorldName)
+ local World = cRoot:Get():GetWorld(a_WorldName);
+ World:ForEachPlayer(LoadPlayerAreas);
+end
+
+
+
+
+