Rename methods that were ambiguous in meaning.

This renames some methods in the Utils class to better reflect what they
do or what they provide back. It should be clearer what these methods
are for now than before.
This commit is contained in:
Lucas Nicodemus 2017-12-29 08:50:13 -07:00
parent 332e6b2518
commit 4eebaf6c44
4 changed files with 7 additions and 5 deletions

View file

@ -78,6 +78,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Removed `Utils.HasBanExpired()` and replaced with `Bans.RemoveBanIfExpired()`. (@hakusaro)
* Removed `Utils.SendFileToUser()` and replaced with `TSPlayer.SendFileTextAsMessage()`. (@hakusaro)
* Removed `Utils.GetGroup()` also have you seen `Groups.GetGroupByName()`? (@hakusaro)
* `Utils.MaxChests()` is now `Utils.HasWorldReachedMaxChests()`. (@hakusaro)
* `Utils.GetIPv4Address()` is now `Utils.GetIPv4AddressFromHostname()`. (@hakusaro)
## TShock 4.3.25
* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6.

View file

@ -627,7 +627,7 @@ namespace TShockAPI
&& Main.tile[tileX, tileY].type != TileID.Containers
&& Main.tile[tileX, tileY].type != TileID.Dressers
&& Main.tile[tileX, tileY].type != TileID.Containers2
&& (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != TileID.Dirt)) //Chest
&& (!TShock.Utils.HasWorldReachedMaxChests() && Main.tile[tileX, tileY].type != TileID.Dirt)) //Chest
{
args.Player.SendTileSquare(tileX, tileY, 3);
args.Handled = true;
@ -1409,7 +1409,7 @@ namespace TShockAPI
}
if (action == EditAction.PlaceTile && (editData == TileID.Containers || editData == TileID.Containers2))
{
if (TShock.Utils.MaxChests())
if (TShock.Utils.HasWorldReachedMaxChests())
{
args.Player.SendErrorMessage("The world's chest limit has been reached - unable to place more.");
args.Player.SendTileSquare(tileX, tileY, 3);

View file

@ -154,7 +154,7 @@ namespace TShockAPI
{
if (string.IsNullOrWhiteSpace(line))
continue;
contains = TShock.Utils.GetIPv4Address(line).Equals(ip);
contains = TShock.Utils.GetIPv4AddressFromHostname(line).Equals(ip);
if (contains)
return true;
}

View file

@ -483,7 +483,7 @@ namespace TShockAPI
/// Returns an IPv4 address from a DNS query
/// </summary>
/// <param name="hostname">string ip</param>
public string GetIPv4Address(string hostname)
public string GetIPv4AddressFromHostname(string hostname)
{
try
{
@ -502,7 +502,7 @@ namespace TShockAPI
/// Checks if world has hit the max number of chests
/// </summary>
/// <returns>True if the entire chest array is used</returns>
public bool MaxChests()
public bool HasWorldReachedMaxChests()
{
for (int i = 0; i < Main.chest.Length; i++)
{