Changes

Jump to navigation Jump to search
no edit summary
Line 108: Line 108:     
===Receive messages===
 
===Receive messages===
You can receive messages by listening to the <tt>helper.Events.Multiplayer.ModMessageReceived</tt> [[Modding:Modder Guide/APIs/Events|event]]. Within your event handler, the event arguments specify who sent the message and let you read the message into a matching data model:
+
You can receive messages by listening to the <tt>helper.Events.Multiplayer.ModMessageReceived</tt> [[Modding:Modder Guide/APIs/Events|event]].
 +
<source lang="C#">
 +
public override void Entry(IModHelper helper)
 +
{
 +
  helper.Events.Multiple.ModMessageReceived += this.OnModMessageReceived;
 +
}
 +
</source>
 +
 
 +
Within your event handler, the event arguments specify who sent the message and let you read the message into a matching data model:
 
<source lang="C#">
 
<source lang="C#">
 
public void OnModMessageReceived(object sender, ModMessageReceivedEventArgs e)
 
public void OnModMessageReceived(object sender, ModMessageReceivedEventArgs e)
624

edits

Navigation menu