Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Can't chat while dead #2071

Closed EdoanR closed 4 years ago

EdoanR commented 4 years ago

Reproduction steps:

  1. Dies ingame, in any way.
  2. During cooldown to respawn try to chat.
  3. The message will not show up, and a warning will appear on console.
[Server API] Warning Plugin "TShock" has had an unhandled exception thrown by one of its ServerChat handlers:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System. Text.StringBuilder. AppendFormatHelper (IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System. String.Format(String format, Object[] args)
at TShockAPI.TShock.OnChat(ServerChatEventArgs args)
at TerrariaApi.Server.HandlerCollection`1.Invoke (ArgsType args) in d:\a\TShock\TShock\TerrariaServerAPI\TerrariaServerAPI\TerrariaApi.Server\HandlerCollection.cs:line 109
EdoanR commented 4 years ago

I just found out, was because of "ChatAboveHeadsFormat" config, I was using the format "{4}", which was the only way to chat appear above my head and also on the other players, I think it's having a problem to find the "head" because the player is dead.

bartico6 commented 4 years ago

The default configuration value is {2} and {4} is out of argument bounds (there are 4 formatting arguments passed, 0, 1, 2 and 3) {0} is group name, {1} is group prefix, {2} is player name, {3} is group suffix

Hope this is of any use to you! :)