The error on the console, I can't find what caused it
Exception invoking SDG.Unturned.InteractableSign.ReceiveChangeTextRequest from client steamid:76561199578771838:
Value cannot be null.
Parameter name: format
at System.String.FormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) [0x0000
3] in <47fc8c70fa834cbf8141d7c1a7589125>:0
at System.String.Format (System.String format, System.Object[] args) [0x00020] in <47fc8c70fa834cbf8141d7c1a7589125>:0
at BTSignRestriction.Helpers.BaseHelpers.TranslationHelper.GetTranslation (System.String key, System.Object[] placehol
der) [0x0000c] in <4530e19f0afb44bb94b31ebbeaf146fb>:0
at BTSignRestriction.Helpers.BaseHelpers.TranslationHelper.SendMessageTranslation (Steamworks.CSteamID playerId, Syste
m.String translationKey, System.Object[] placeholder) [0x00063] in <4530e19f0afb44bb94b31ebbeaf146fb>:0
at BTSignRestriction.BTSignRestriction.onModifySignRequested (Steamworks.CSteamID instigator, SDG.Unturned.Interactabl
eSign sign, System.String& text, System.Boolean& shouldAllow) [0x00123] in <4530e19f0afb44bb94b31ebbeaf146fb>:0
at (wrapper delegate-invoke) <Module>.invoke_void_CSteamID_InteractableSign_string&_bool&(Steamworks.CSteamID,SDG.Untu
rned.InteractableSign,string&,bool&)
at (wrapper dynamic-method) SDG.Unturned.InteractableSign.SDG.Unturned.InteractableSign.ReceiveChangeTextRequest_Patch
2(SDG.Unturned.InteractableSign,SDG.Unturned.ServerInvocationContext&,string)
at SDG.Unturned.InteractableSign_NetMethods.ReceiveChangeTextRequest_Read (SDG.Unturned.ServerInvocationContext& conte
xt) [0x00039] in <6b1f72456e95430bacde60da03e38772>:0
at SDG.Unturned.ServerMessageHandler_InvokeMethod.ReadMessage (SDG.NetTransport.ITransportConnection transportConnecti
on, SDG.NetPak.NetPakReader reader) [0x00132] in <6b1f72456e95430bacde60da03e38772>:0
This is ChatGPT’s explanation:The error you're encountering occurs because a null value is being passed to the System.String.Format method as the format argument. The issue seems to originate from the BTSignRestriction plugin, specifically in the ReceiveChangeTextRequest function, when a player attempts to modify the text on a sign.
Key points:
TranslationHelper.GetTranslation likely returns a null or invalid format string, which leads to the exception when it's passed to String.Format.
The SendMessageTranslation function might not be handling cases where the key or placeholder values are missing or improperly formatted.
The error occurs because String.Format requires a non-null format string.
Potential Fixes:
Ensure that GetTranslation handles null or empty key and placeholder values correctly, returning a valid string at all times.
Add a check before calling String.Format to ensure that the format string is not null:
if (string.IsNullOrEmpty(format))
{
// Log the error or provide a default message
format = "Default message";
}
If the plugin relies on configuration files, verify that all translation strings are correctly defined in the config, and there are no missing or malformed entries.
The error on the console, I can't find what caused it
This is ChatGPT’s explanation:The error you're encountering occurs because a
null
value is being passed to theSystem.String.Format
method as theformat
argument. The issue seems to originate from theBTSignRestriction
plugin, specifically in theReceiveChangeTextRequest
function, when a player attempts to modify the text on a sign.Key points:
null
or invalidformat
string, which leads to the exception when it's passed toString.Format
.SendMessageTranslation
function might not be handling cases where thekey
orplaceholder
values are missing or improperly formatted.String.Format
requires a non-nullformat
string.Potential Fixes:
Ensure that
GetTranslation
handlesnull
or emptykey
andplaceholder
values correctly, returning a valid string at all times.Add a check before calling
String.Format
to ensure that theformat
string is notnull
:If the plugin relies on configuration files, verify that all translation strings are correctly defined in the config, and there are no missing or malformed entries.