Minor update.

- AssertGroupValid now both sends the message and kicks the player
  depending on input parameter.
- /login and DataHandler code is now an identical assert check.
This commit is contained in:
quake1337 2021-07-13 21:53:54 +02:00
parent 048aaf6f0c
commit c759af6d49
3 changed files with 10 additions and 6 deletions

View file

@ -214,15 +214,19 @@ namespace TShockAPI
/// <summary>
/// Asserts that the group reference can be safely assigned to the player object.
/// <para>If this assertion fails, and <paramref name="kick"/> is true, the player is disconnected. If <paramref name="kick"/> is false, the player will receive an error message.</para>
/// </summary>
/// <param name="player"></param>
/// <param name="group"></param>
/// <returns></returns>
public bool AssertGroupValid(TSPlayer player, Group group)
public bool AssertGroupValid(TSPlayer player, Group group, bool kick)
{
if (group == null)
{
player.Disconnect("Your account's group could not be found. Please contact server administrators about this.");
if (kick)
player.Disconnect("Your account's group could not be loaded. Please contact server administrators about this.");
else
player.SendErrorMessage("Your account's group could not be loaded. Please contact server administrators about this.");
return false;
}