Updated the ChatLog plugin to the new format
git-svn-id: http://mc-server.googlecode.com/svn/trunk@315 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
41d55ef86b
commit
2518738f7f
@ -1,41 +0,0 @@
|
||||
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 )
|
17
Plugins/ChatLog/plugin.lua
Normal file
17
Plugins/ChatLog/plugin.lua
Normal file
@ -0,0 +1,17 @@
|
||||
function Initialize( Plugin )
|
||||
Plugin:SetName( "ChatLog" )
|
||||
Plugin:SetVersion( 2 )
|
||||
|
||||
PluginManager = cRoot:Get():GetPluginManager()
|
||||
PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_CHAT )
|
||||
|
||||
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
|
||||
return true
|
||||
end
|
||||
|
||||
function OnChat( Message, Player )
|
||||
-- Lets get loggin'
|
||||
LOGINFO("[" .. Player:GetName() .. "]: " .. Message);
|
||||
|
||||
return false
|
||||
end
|
@ -8,7 +8,8 @@ DefaultWorld=world
|
||||
;World=world_sexy
|
||||
|
||||
[Plugins]
|
||||
;Squirrel=SquirrelChatLog
|
||||
NewPlugin=Core
|
||||
NewPlugin=ChatLog
|
||||
|
||||
[HelpPlugin]
|
||||
ShowPluginNames=1
|
||||
|
Loading…
Reference in New Issue
Block a user