From b32058ac51f161a9ff65c64fc31a964f43c0ea6f Mon Sep 17 00:00:00 2001
From: quake1337 <3310937+bartico6@users.noreply.github.com>
Date: Sat, 7 Aug 2021 13:56:52 +0200
Subject: [PATCH] Remove the test method from Utils, re-route checks to
GroupManager
---
TShockAPI/Commands.cs | 2 +-
TShockAPI/GetDataHandlers.cs | 4 ++--
TShockAPI/Utils.cs | 22 ----------------------
3 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 276eee90..b2ad0264 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -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;
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index a9445105..af75c90c 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -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;
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index 717f08a2..92d45299 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -212,28 +212,6 @@ namespace TShockAPI
} while (TilePlacementValid(tileX, tileY) && TileSolid(tileX, tileY));
}
- ///
- /// Asserts that the group reference can be safely assigned to the player object.
- /// If this assertion fails, and is true, the player is disconnected. If is false, the player will receive an error message.
- ///
- /// The player in question
- /// The group we want to assign them
- /// Whether or not failing this check disconnects the player.
- ///
- 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;
- }
-
///
/// Determines if a tile is valid.
///