diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:39:53 +0200 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:39:53 +0200 |
commit | 7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9 (patch) | |
tree | 5ef154088135039dd0ea9430b4cbe608ef17d8ff /Plugins/ChatLog.lua | |
parent | Source for additional projects (diff) | |
download | cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar.gz cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar.bz2 cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar.lz cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar.xz cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.tar.zst cuberite-7e010e7f8fc3983c3bd85fe17da27e06bdb4c7d9.zip |
Diffstat (limited to '')
-rw-r--r-- | Plugins/ChatLog.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Plugins/ChatLog.lua b/Plugins/ChatLog.lua new file mode 100644 index 000000000..9f86a7086 --- /dev/null +++ b/Plugins/ChatLog.lua @@ -0,0 +1,41 @@ +local ChatLogPlugin = {}
+ChatLogPlugin.__index = ChatLogPlugin
+
+function ChatLogPlugin:new()
+ local t = {}
+ setmetatable(t, ChatLogPlugin)
+ local w = Lua__cPlugin:new()
+ tolua.setpeer(w, t)
+ w:tolua__set_instance(w)
+ return w
+end
+
+function ChatLogPlugin:OnDisable()
+ Log( self:GetName() .. " v." .. self:GetVersion() .. " is shutting down..." )
+end
+
+function ChatLogPlugin:Initialize()
+ self:SetName( "ChatLog" )
+ self:SetVersion( 1 )
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:AddHook( self, cPluginManager.E_PLUGIN_CHAT )
+
+ self.Logger = cMCLogger:new_local("ChatLog"..GetTime()..".txt")
+ self.Logger:LogSimple("--- ChatLog started ---", 1);
+
+ Log( "Initialized " .. self:GetName() .. " v." .. self:GetVersion() )
+ return true
+end
+
+function ChatLogPlugin:OnChat( Message, Player )
+ Server = cRoot:Get():GetServer()
+
+ -- Lets get loggin'
+ self.Logger:LogSimple(Player:GetName() .. ": " .. Message, 1);
+
+ return false
+end
+
+Plugin = ChatLogPlugin:new()
+cRoot:Get():GetPluginManager():AddPlugin( Plugin )
|