Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.Subsystems.Chat.ChatServer Class Reference
Inheritance diagram for essentials.Subsystems.Chat.ChatServer:
essentials.Subsystems.Chat.IChatServer pluginbase.Objects.Game.IServerSubsystem pluginbase.Objects.Game.ISubsystem

Public Member Functions

 ChatServer ()
 
void AddCommandHandler (IChatCommandHandler handler)
 
void ClearCommandHandlers ()
 
void OnStart ()
 
void OnStop ()
 
void Simulate (IFrameTimeState frameTime)
 
void BroadcastSystemMessage (string msg, params object[] args)
 
void SendDirectedMessage (ushort userId, string msg, params object[] args)
 
void SendDirectedMessage (IUser user, string msg, params object[] args)
 
void SendDirectedMessage (string username, string msg, params object[] args)
 

Protected Attributes

IRpcManager RpcManager
 
IUserManager UserManager
 
IPluginLogger Logger
 

Constructor & Destructor Documentation

essentials.Subsystems.Chat.ChatServer.ChatServer ( )
27  {
28  this.InjectDependencies();
29  this.RpcManager.RegisterClass(this);
30  _clientRpc = this.RpcManager.GetClass<ChatClient>();
31 
32  this.UserManager.OnJoin += OnPlayerJoin;
33  this.UserManager.OnLeave += OnPlayerLeave;
34 
35  AddCommandHandler(new UserManagerChatPlugin(this));
36  AddCommandHandler(new WorldChatPlugin(this));
37 
38  this.Logger.LogInfo("Chat server started");
39  }
IRpcManager RpcManager
Definition: ChatServer.cs:16
Action< IUser > OnJoin
Definition: IUserManager.cs:31
IPluginLogger Logger
Definition: ChatServer.cs:22
void AddCommandHandler(IChatCommandHandler handler)
Definition: ChatServer.cs:41
Action< IUser > OnLeave
Definition: IUserManager.cs:32
void LogInfo(string msg, params object[] args)
IUserManager UserManager
Definition: ChatServer.cs:19

Member Function Documentation

void essentials.Subsystems.Chat.ChatServer.AddCommandHandler ( IChatCommandHandler  handler)
42  {
43  _chatCommandHandlers.Add(handler);
44  }
void essentials.Subsystems.Chat.ChatServer.BroadcastSystemMessage ( string  msg,
params object[]  args 
)

Implements essentials.Subsystems.Chat.IChatServer.

71  {
72  BroadcastMessage(SERVER_USERNAME, UserAuthLevel.System, string.Format(msg, args));
73  }
UserAuthLevel
User authentication level
Definition: UserAuthLevel.cs:8
void essentials.Subsystems.Chat.ChatServer.ClearCommandHandlers ( )
47  {
48  _chatCommandHandlers.Clear();
49  }
void essentials.Subsystems.Chat.ChatServer.OnStart ( )
void essentials.Subsystems.Chat.ChatServer.OnStop ( )
void essentials.Subsystems.Chat.ChatServer.SendDirectedMessage ( ushort  userId,
string  msg,
params object[]  args 
)

Implements essentials.Subsystems.Chat.IChatServer.

81  {
82  _clientRpc.Invoke("ChatMessage", RpcTarget.Client(userId), "SystemDirect", (int)UserAuthLevel.System, string.Format(msg, args));
83  }
void Invoke(string name, RpcTarget target, params object[] args)
Invokes a remoted method by name, at a target
UserAuthLevel
User authentication level
Definition: UserAuthLevel.cs:8
static RpcTarget Client(ushort id)
Create a target for a specific client
Definition: RpcTarget.cs:190
Class that specifies the target of an RPC class
Definition: RpcTarget.cs:21
void essentials.Subsystems.Chat.ChatServer.SendDirectedMessage ( IUser  user,
string  msg,
params object[]  args 
)

Implements essentials.Subsystems.Chat.IChatServer.

86  {
87  SendDirectedMessage(user.ClientIdent, msg, args);
88  }
void SendDirectedMessage(ushort userId, string msg, params object[] args)
Definition: ChatServer.cs:80
ushort ClientIdent
The Id of the user
Definition: IUser.cs:20
void essentials.Subsystems.Chat.ChatServer.SendDirectedMessage ( string  username,
string  msg,
params object[]  args 
)

Implements essentials.Subsystems.Chat.IChatServer.

91  {
92  var user = this.UserManager.GetUser(username);
93  if (user != null)
94  {
95  SendDirectedMessage(user, msg, args);
96  }
97  }
void SendDirectedMessage(ushort userId, string msg, params object[] args)
Definition: ChatServer.cs:80
IUserManager UserManager
Definition: ChatServer.cs:19
void essentials.Subsystems.Chat.ChatServer.Simulate ( IFrameTimeState  frameTime)

Implements pluginbase.Objects.Game.ISubsystem.

58  { }

Member Data Documentation

IPluginLogger essentials.Subsystems.Chat.ChatServer.Logger
protected

Attribute: Dependency

IRpcManager essentials.Subsystems.Chat.ChatServer.RpcManager
protected

Attribute: Dependency

IUserManager essentials.Subsystems.Chat.ChatServer.UserManager
protected

Attribute: Dependency


The documentation for this class was generated from the following file: