Remove the test method from Utils, re-route checks to GroupManager

This commit is contained in:
quake1337 2021-08-07 13:56:52 +02:00
parent 91376ae087
commit b32058ac51
No known key found for this signature in database
GPG key ID: DA3BF4DE0341A2B6
3 changed files with 3 additions and 25 deletions

View file

@ -825,7 +825,7 @@ namespace TShockAPI
{
var group = TShock.Groups.GetGroupByName(account.Group);
if (!TShock.Utils.AssertGroupValid(args.Player, group, false))
if (!TShock.Groups.AssertGroupValid(args.Player, group, false))
{
args.Player.SendErrorMessage("Login attempt failed - see the message above.");
return;

View file

@ -2452,7 +2452,7 @@ namespace TShockAPI
var group = TShock.Groups.GetGroupByName(account.Group);
if (!TShock.Utils.AssertGroupValid(args.Player, group, true))
if (!TShock.Groups.AssertGroupValid(args.Player, group, true))
return true;
args.Player.PlayerData = TShock.CharacterDB.GetPlayerData(args.Player, account.ID);
@ -3023,7 +3023,7 @@ namespace TShockAPI
var group = TShock.Groups.GetGroupByName(account.Group);
if (!TShock.Utils.AssertGroupValid(args.Player, group, true))
if (!TShock.Groups.AssertGroupValid(args.Player, group, true))
return true;
args.Player.Group = group;

View file

@ -212,28 +212,6 @@ namespace TShockAPI
} while (TilePlacementValid(tileX, tileY) && TileSolid(tileX, tileY));
}
/// <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">The player in question</param>
/// <param name="group">The group we want to assign them</param>
/// <param name="kick">Whether or not failing this check disconnects the player.</param>
/// <returns></returns>
public bool AssertGroupValid(TSPlayer player, Group group, bool kick)
{
if (group == null)
{
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;
}
return true;
}
/// <summary>
/// Determines if a tile is valid.
/// </summary>