public static bool OnChat(messageBuffer msg, int whoami, string text) { if (ServerHooks.Chat == null) { return false; } HandledEventArgs handledEventArgs = new HandledEventArgs(); ServerHooks.Chat(msg, whoami, text, handledEventArgs); return handledEventArgs.Handled; }
public static bool OnGetData(ref byte msgid, messageBuffer msg, ref int idx, ref int length) { if (NetHooks.GetData == null) { return false; } GetDataEventArgs getDataEventArgs = new GetDataEventArgs { MsgID = (PacketTypes)msgid, Msg = msg, Index = idx, Length = length }; NetHooks.GetData(getDataEventArgs); msgid = (byte)getDataEventArgs.MsgID; idx = getDataEventArgs.Index; length = getDataEventArgs.Length; return getDataEventArgs.Handled; }
private void OnChat(messageBuffer msg, int ply, string text, HandledEventArgs e) { if (e.Handled) return; var tsplr = Players[msg.whoAmI]; if (tsplr == null) { e.Handled = true; return; } if (!TShock.Utils.ValidString(text)) { e.Handled = true; return; } if (text.StartsWith("/")) { try { e.Handled = Commands.HandleCommand(tsplr, text); } catch (Exception ex) { Log.ConsoleError("Command exception"); Log.Error(ex.ToString()); } } else if (!tsplr.mute) { TShock.Utils.Broadcast(String.Format(TShock.Config.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix, text), tsplr.Group.R, tsplr.Group.G, tsplr.Group.B); e.Handled = true; } else if (tsplr.mute) { tsplr.SendMessage("You are muted!"); e.Handled = true; } }