diff --git a/MCGalaxy/Events/PlayerEvents.cs b/MCGalaxy/Events/PlayerEvents.cs
index 1f45ed280..bf1b78d99 100644
--- a/MCGalaxy/Events/PlayerEvents.cs
+++ b/MCGalaxy/Events/PlayerEvents.cs
@@ -222,6 +222,21 @@ namespace MCGalaxy.Events.PlayerEvents {
catch (Exception ex) { LogHandlerException(ex, items[i]); }
}
}
+ }
+
+ public delegate void OnSendingMotd(Player p, ref string motd);
+ /// Called when MOTD is being sent to a player.
+ /// To change MOTD for a player in general (e.g. for /fly), use OnGettingMotdEvent instead.
+ public sealed class OnSendingMotdEvent : IEvent {
+
+ public static void Call(Player p, ref string motd) {
+ IEvent[] items = handlers.Items;
+ // Can't use CallCommon because we need to pass arguments by ref
+ for (int i = 0; i < items.Length; i++) {
+ try { items[i].method(p, ref motd); }
+ catch (Exception ex) { LogHandlerException(ex, items[i]); }
+ }
+ }
}
public delegate void OnPlayerSpawning(Player p, ref Position pos, ref byte yaw, ref byte pitch, bool respawning);
diff --git a/MCGalaxy/Network/Player.Networking.cs b/MCGalaxy/Network/Player.Networking.cs
index f70449083..c39b9bd8b 100644
--- a/MCGalaxy/Network/Player.Networking.cs
+++ b/MCGalaxy/Network/Player.Networking.cs
@@ -152,6 +152,7 @@ namespace MCGalaxy {
public void SendMapMotd() {
string motd = GetMotd();
motd = Chat.Format(motd, this);
+ OnSendingMotdEvent.Call(this, ref motd);
byte[] packet = Packet.Motd(this, motd);
Send(packet);