diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs
index 94328f57..958d3af1 100644
--- a/TShockAPI/Bouncer.cs
+++ b/TShockAPI/Bouncer.cs
@@ -458,7 +458,7 @@ namespace TShockAPI
}
args.Player.RequestedSection = true;
- if (String.IsNullOrEmpty(args.Player.Name))
+ if (string.IsNullOrEmpty(args.Player.Name))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnGetSection rejected empty player name."));
args.Player.Kick(GetString("Your client sent a blank character name."), true, true);
@@ -484,7 +484,7 @@ namespace TShockAPI
var pos = args.Position;
var vel = args.Velocity;
- if (Single.IsInfinity(vel.X) || Single.IsInfinity(vel.Y))
+ if (float.IsInfinity(vel.X) || float.IsInfinity(vel.Y))
{
TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to infinity) from {0}", args.Player.Name));
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
@@ -492,7 +492,7 @@ namespace TShockAPI
return;
}
- if (Single.IsNaN(vel.X) || Single.IsNaN(vel.Y))
+ if (float.IsNaN(vel.X) || float.IsNaN(vel.Y))
{
TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to NaN) from {0}", args.Player.Name));
args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
@@ -797,17 +797,17 @@ namespace TShockAPI
return;
}
- /// Handle placement action if the player is using an Ice Rod but not placing the iceblock.
+ // Handle placement action if the player is using an Ice Rod but not placing the iceblock.
if (selectedItem.type == ItemID.IceRod && editData != TileID.MagicalIceBlock)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from using ice rod but not placing ice block {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
}
- /// If they aren't selecting the item which creates the tile, they're hacking.
+ // If they aren't selecting the item which creates the tile, they're hacking.
if ((action == EditAction.PlaceTile || action == EditAction.ReplaceTile) && editData != selectedItem.createTile)
{
- /// These would get caught up in the below check because Terraria does not set their createTile field.
+ // These would get caught up in the below check because Terraria does not set their createTile field.
if (selectedItem.type != ItemID.IceRod && selectedItem.type != ItemID.DirtBomb && selectedItem.type != ItemID.StickyBomb && (args.Player.TPlayer.mount.Type != MountID.DiggingMoleMinecart || editData != TileID.MinecartTrack))
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from tile placement not matching selected item createTile {0} {1} {2} selectedItemID:{3} createTile:{4}", args.Player.Name, action, editData, selectedItem.type, selectedItem.createTile));
@@ -816,7 +816,7 @@ namespace TShockAPI
return;
}
}
- /// If they aren't selecting the item which creates the wall, they're hacking.
+ // If they aren't selecting the item which creates the wall, they're hacking.
if ((action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && editData != selectedItem.createWall)
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from wall placement not matching selected item createWall {0} {1} {2} selectedItemID:{3} createWall:{4}", args.Player.Name, action, editData, selectedItem.type, selectedItem.createWall));
@@ -1263,7 +1263,7 @@ namespace TShockAPI
return;
}
- /// If the projectile is a directional projectile, check if the player is holding their respected item to validate the projectile creation.
+ // If the projectile is a directional projectile, check if the player is holding their respected item to validate the projectile creation.
if (directionalProjectiles.ContainsKey(type))
{
if (directionalProjectiles[type] == args.Player.TPlayer.HeldItem.type)
@@ -1273,14 +1273,14 @@ namespace TShockAPI
}
}
- /// If the created projectile is a golf club, check if the player is holding one of the golf club items to validate the projectile creation.
+ // If the created projectile is a golf club, check if the player is holding one of the golf club items to validate the projectile creation.
if (type == ProjectileID.GolfClubHelper && Handlers.LandGolfBallInCupHandler.GolfClubItemIDs.Contains(args.Player.TPlayer.HeldItem.type))
{
args.Handled = false;
return;
}
- /// If the created projectile is a golf ball and the player is not holding a golf club item and neither a golf ball item and neither they have had a golf club projectile created recently.
+ // If the created projectile is a golf ball and the player is not holding a golf club item and neither a golf ball item and neither they have had a golf club projectile created recently.
if (Handlers.LandGolfBallInCupHandler.GolfBallProjectileIDs.Contains(type) &&
!Handlers.LandGolfBallInCupHandler.GolfClubItemIDs.Contains(args.Player.TPlayer.HeldItem.type) &&
!Handlers.LandGolfBallInCupHandler.GolfBallItemIDs.Contains(args.Player.TPlayer.HeldItem.type) &&
@@ -2820,7 +2820,7 @@ namespace TShockAPI
///
internal void OnFishOutNPC(object sender, GetDataHandlers.FishOutNPCEventArgs args)
{
- /// Getting recent projectiles of the player and selecting the first that is a bobber.
+ // Getting recent projectiles of the player and selecting the first that is a bobber.
var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index].bobber);
if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type))
@@ -2829,7 +2829,7 @@ namespace TShockAPI
args.Handled = true;
return;
}
- if (projectile.Type == 0 || projectile.Killed) /// The bobber projectile is never killed when the NPC spawns. Type can only be 0 if no recent projectile is found that is named Bobber.
+ if (projectile.Type == 0 || projectile.Killed) // The bobber projectile is never killed when the NPC spawns. Type can only be 0 if no recent projectile is found that is named Bobber.
{
TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected for not finding active bobber projectile! - From {0}", args.Player.Name));
args.Handled = true;
@@ -3062,7 +3062,7 @@ namespace TShockAPI
///
private static Dictionary directionalProjectiles = new Dictionary()
{
- ///Spears
+ //Spears
{ ProjectileID.DarkLance, ItemID.DarkLance},
{ ProjectileID.Trident, ItemID.Trident},
{ ProjectileID.Spear, ItemID.Spear},
@@ -3082,7 +3082,7 @@ namespace TShockAPI
{ ProjectileID.MonkStaffT2, ItemID.MonkStaffT2},
{ ProjectileID.ThunderSpear, ItemID.ThunderSpear},
{ ProjectileID.GladiusStab, ItemID.Gladius},
- /// ShortSwords
+ // ShortSwords
{ ProjectileID.RulerStab, ItemID.Ruler },
{ ProjectileID.CopperShortswordStab, ItemID.CopperShortsword },
{ ProjectileID.TinShortswordStab, ItemID.TinShortsword },
diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 682b4ff8..49c3c234 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -740,7 +740,7 @@ namespace TShockAPI
///
///
///
- private static List ParseParameters(string str)
+ private static List ParseParameters(string str)
{
var ret = new List();
var sb = new StringBuilder();
@@ -857,7 +857,7 @@ namespace TShockAPI
}
else if (args.Parameters.Count == 2 && TShock.Config.Settings.AllowLoginAnyUsername)
{
- if (String.IsNullOrEmpty(args.Parameters[0]))
+ if (string.IsNullOrEmpty(args.Parameters[0]))
{
args.Player.SendErrorMessage(GetString("Bad login attempt."));
return;
@@ -890,7 +890,7 @@ namespace TShockAPI
}
else if (account.VerifyPassword(password) ||
(usingUUID && account.UUID == args.Player.UUID && !TShock.Config.Settings.DisableUUIDLogin &&
- !String.IsNullOrWhiteSpace(args.Player.UUID)))
+ !string.IsNullOrWhiteSpace(args.Player.UUID)))
{
var group = TShock.Groups.GetGroupByName(account.Group);
@@ -1300,14 +1300,14 @@ namespace TShockAPI
return;
}
- string username = String.Join(" ", args.Parameters);
+ string username = string.Join(" ", args.Parameters);
if (!string.IsNullOrWhiteSpace(username))
{
var account = TShock.UserAccounts.GetUserAccountByName(username);
if (account != null)
{
DateTime LastSeen;
- string Timezone = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours.ToString("+#;-#");
+ string Timezone = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now).Hours.ToString("+#;-#");
if (DateTime.TryParse(account.LastAccessed, out LastSeen))
{
@@ -1359,7 +1359,7 @@ namespace TShockAPI
else
{
string reason = args.Parameters.Count > 1
- ? String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1))
+ ? string.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1))
: GetString("Misbehaviour.");
if (!players[0].Kick(reason, !args.Player.RealPlayer, false, args.Player.Name))
{
@@ -2066,13 +2066,13 @@ namespace TShockAPI
}
}
- string reason = ((args.Parameters.Count > 0) ? GetString("Server shutting down: ") + String.Join(" ", args.Parameters) : GetString("Server shutting down!"));
+ string reason = ((args.Parameters.Count > 0) ? GetString("Server shutting down: ") + string.Join(" ", args.Parameters) : GetString("Server shutting down!"));
TShock.Utils.StopServer(true, reason);
}
private static void OffNoSave(CommandArgs args)
{
- string reason = ((args.Parameters.Count > 0) ? GetString("Server shutting down: ") + String.Join(" ", args.Parameters) : GetString("Server shutting down."));
+ string reason = ((args.Parameters.Count > 0) ? GetString("Server shutting down: ") + string.Join(" ", args.Parameters) : GetString("Server shutting down."));
Netplay.SaveOnServerExit = false;
TShock.Utils.StopServer(false, reason);
}
@@ -2082,7 +2082,7 @@ namespace TShockAPI
args.Player.SendInfoMessage(GetString("An update check has been queued. If an update is available, you will be notified shortly."));
try
{
- TShock.UpdateManager.UpdateCheckAsync(null);
+ _ = TShock.UpdateManager.UpdateCheckAsync(null);
}
catch (Exception)
{
@@ -2174,8 +2174,8 @@ namespace TShockAPI
if (args.Parameters.Count < 1)
{
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}worldevent .", Specifier));
- args.Player.SendErrorMessage(GetString("Valid event types: {0}.", String.Join(", ", _validEvents)));
- args.Player.SendErrorMessage(GetString("Valid invasion types if spawning an invasion: {0}.", String.Join(", ", _validInvasions)));
+ args.Player.SendErrorMessage(GetString("Valid event types: {0}.", string.Join(", ", _validEvents)));
+ args.Player.SendErrorMessage(GetString("Valid invasion types if spawning an invasion: {0}.", string.Join(", ", _validInvasions)));
return;
}
@@ -2267,7 +2267,7 @@ namespace TShockAPI
return;
default:
- args.Player.SendErrorMessage(GetString("Invalid event type. Valid event types: {0}.", String.Join(", ", _validEvents)));
+ args.Player.SendErrorMessage(GetString("Invalid event type. Valid event types: {0}.", string.Join(", ", _validEvents)));
return;
}
}
@@ -2360,7 +2360,7 @@ namespace TShockAPI
if (args.Parameters.Count < 2)
{
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}worldevent invasion [invasion type] [invasion wave].", Specifier));
- args.Player.SendErrorMessage(GetString("Valid invasion types: {0}.", String.Join(", ", _validInvasions)));
+ args.Player.SendErrorMessage(GetString("Valid invasion types: {0}.", string.Join(", ", _validInvasions)));
return;
}
@@ -2428,7 +2428,7 @@ namespace TShockAPI
break;
default:
- args.Player.SendErrorMessage(GetString("Invalid invasion type. Valid invasion types: {0}.", String.Join(", ", _validInvasions)));
+ args.Player.SendErrorMessage(GetString("Invalid invasion type. Valid invasion types: {0}.", string.Join(", ", _validInvasions)));
break;
}
}
@@ -2576,7 +2576,7 @@ namespace TShockAPI
if (args.Parameters.Count < 1)
{
args.Player.SendErrorMessage(GetString("Invalid syntax. Proper syntax: {0}worldmode .", Specifier));
- args.Player.SendErrorMessage(GetString("Valid world modes: {0}", String.Join(", ", _worldModes.Keys)));
+ args.Player.SendErrorMessage(GetString("Valid world modes: {0}", string.Join(", ", _worldModes.Keys)));
return;
}
@@ -2586,7 +2586,7 @@ namespace TShockAPI
{
if (mode < 0 || mode > 3)
{
- args.Player.SendErrorMessage(GetString("Invalid world mode. Valid world modes: {0}", String.Join(", ", _worldModes.Keys)));
+ args.Player.SendErrorMessage(GetString("Invalid world mode. Valid world modes: {0}", string.Join(", ", _worldModes.Keys)));
return;
}
}
@@ -2596,7 +2596,7 @@ namespace TShockAPI
}
else
{
- args.Player.SendErrorMessage(GetString("Invalid mode world mode. Valid modes: {0}", String.Join(", ", _worldModes.Keys)));
+ args.Player.SendErrorMessage(GetString("Invalid mode world mode. Valid modes: {0}", string.Join(", ", _worldModes.Keys)));
return;
}
@@ -3089,7 +3089,7 @@ namespace TShockAPI
return;
}
- string playerName = String.Join(" ", args.Parameters);
+ string playerName = string.Join(" ", args.Parameters);
var players = TSPlayer.FindByNameOrID(playerName);
if (players.Count == 0)
{
@@ -3172,7 +3172,7 @@ namespace TShockAPI
var player = args.Player.Name;
if (args.Parameters.Count > 0)
{
- player = String.Join(" ", args.Parameters);
+ player = string.Join(" ", args.Parameters);
}
var players = TSPlayer.FindByNameOrID(player);
@@ -3308,7 +3308,7 @@ namespace TShockAPI
{
string warpName = args.Parameters[1];
bool state = false;
- if (Boolean.TryParse(args.Parameters[2], out state))
+ if (bool.TryParse(args.Parameters[2], out state))
{
if (TShock.Warps.Hide(args.Parameters[1], state))
{
@@ -3367,7 +3367,7 @@ namespace TShockAPI
}
else
{
- string warpName = String.Join(" ", args.Parameters);
+ string warpName = string.Join(" ", args.Parameters);
var warp = TShock.Warps.Find(warpName);
if (warp != null)
{
@@ -3402,7 +3402,7 @@ namespace TShockAPI
string groupName = args.Parameters[1];
args.Parameters.RemoveRange(0, 2);
- string permissions = String.Join(",", args.Parameters);
+ string permissions = string.Join(",", args.Parameters);
try
{
@@ -3649,7 +3649,7 @@ namespace TShockAPI
{
string newColor = args.Parameters[2];
- String[] parts = newColor.Split(',');
+ string[] parts = newColor.Split(',');
byte r;
byte g;
byte b;
@@ -4061,7 +4061,7 @@ namespace TShockAPI
return;
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
TShock.ProjectileBans.AddNewBan(id);
args.Player.SendSuccessMessage(GetString("Banned projectile {0}.", id));
@@ -4081,7 +4081,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@@ -4118,7 +4118,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
TShock.ProjectileBans.RemoveBan(id);
args.Player.SendSuccessMessage(GetString("Unbanned projectile {0}.", id));
@@ -4139,7 +4139,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id > 0 && id < Terraria.ID.ProjectileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@@ -4199,7 +4199,7 @@ namespace TShockAPI
int pageNumber;
if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out pageNumber))
return;
- IEnumerable projectileIds = from projectileBan in TShock.ProjectileBans.ProjectileBans
+ IEnumerable projectileIds = from projectileBan in TShock.ProjectileBans.ProjectileBans
select projectileBan.ID;
PaginationTools.SendPage(args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(projectileIds),
new PaginationTools.Settings
@@ -4237,7 +4237,7 @@ namespace TShockAPI
return;
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
TShock.TileBans.AddNewBan(id);
args.Player.SendSuccessMessage(GetString("Banned tile {0}.", id));
@@ -4257,7 +4257,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@@ -4294,7 +4294,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
TShock.TileBans.RemoveBan(id);
args.Player.SendSuccessMessage(GetString("Unbanned tile {0}.", id));
@@ -4315,7 +4315,7 @@ namespace TShockAPI
}
short id;
- if (Int16.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
+ if (short.TryParse(args.Parameters[1], out id) && id >= 0 && id < Terraria.ID.TileID.Count)
{
if (!TShock.Groups.GroupExists(args.Parameters[2]))
{
@@ -4375,7 +4375,7 @@ namespace TShockAPI
int pageNumber;
if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, args.Player, out pageNumber))
return;
- IEnumerable tileIds = from tileBan in TShock.TileBans.TileBans
+ IEnumerable tileIds = from tileBan in TShock.TileBans.TileBans
select tileBan.ID;
PaginationTools.SendPage(args.Player, pageNumber, PaginationTools.BuildLinesFromTerms(tileIds),
new PaginationTools.Settings
@@ -4465,7 +4465,7 @@ namespace TShockAPI
return;
}
- if (String.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
+ if (string.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
{
TShock.Config.Settings.DefaultMaximumSpawns = NPC.defaultMaxSpawns = 5;
if (args.Silent)
@@ -4505,7 +4505,7 @@ namespace TShockAPI
return;
}
- if (String.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
+ if (string.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
{
TShock.Config.Settings.DefaultSpawnRate = NPC.defaultSpawnRate = 600;
if (args.Silent)
@@ -4714,7 +4714,7 @@ namespace TShockAPI
{
if (!args.Player.TempPoints.Any(p => p == Point.Zero))
{
- string regionName = String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
+ string regionName = string.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
var x = Math.Min(args.Player.TempPoints[0].X, args.Player.TempPoints[1].X);
var y = Math.Min(args.Player.TempPoints[0].Y, args.Player.TempPoints[1].Y);
var width = Math.Abs(args.Player.TempPoints[0].X - args.Player.TempPoints[1].X);
@@ -4771,7 +4771,7 @@ namespace TShockAPI
{
if (args.Parameters.Count > 1)
{
- string regionName = String.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
+ string regionName = string.Join(" ", args.Parameters.GetRange(1, args.Parameters.Count - 1));
if (TShock.Regions.DeleteRegion(regionName))
{
args.Player.SendInfoMessage(GetString("Deleted region \"{0}\".", regionName));
@@ -5429,7 +5429,7 @@ namespace TShockAPI
}
int givenCode;
- if (!Int32.TryParse(args.Parameters[0], out givenCode) || givenCode != TShock.SetupToken)
+ if (!int.TryParse(args.Parameters[0], out givenCode) || givenCode != TShock.SetupToken)
{
args.Player.SendErrorMessage(GetString("Incorrect setup code. This incident has been logged."));
TShock.Log.Warn(args.Player.IP + " attempted to use an incorrect setup code.");
@@ -5458,7 +5458,7 @@ namespace TShockAPI
if (args.Player.mute)
args.Player.SendErrorMessage(GetString("You are muted."));
else
- TSPlayer.All.SendMessage(GetString("*{0} {1}", args.Player.Name, String.Join(" ", args.Parameters)), 205, 133, 63);
+ TSPlayer.All.SendMessage(GetString("*{0} {1}", args.Player.Name, string.Join(" ", args.Parameters)), 205, 133, 63);
}
private static void PartyChat(CommandArgs args)
@@ -5474,7 +5474,7 @@ namespace TShockAPI
args.Player.SendErrorMessage(GetString("You are muted."));
else if (playerTeam != 0)
{
- string msg = GetString("<{0}> {1}", args.Player.Name, String.Join(" ", args.Parameters));
+ string msg = GetString("<{0}> {1}", args.Player.Name, string.Join(" ", args.Parameters));
foreach (TSPlayer player in TShock.Players)
{
if (player != null && player.Active && player.Team == playerTeam)
@@ -5522,7 +5522,7 @@ namespace TShockAPI
{
string reason = GetString("No reason specified.");
if (args.Parameters.Count > 1)
- reason = String.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1);
+ reason = string.Join(" ", args.Parameters.ToArray(), 1, args.Parameters.Count - 1);
var plr = players[0];
plr.mute = true;
if (args.Silent)
@@ -5995,7 +5995,7 @@ namespace TShockAPI
return;
}
- string targetName = String.Join(" ", args.Parameters);
+ string targetName = string.Join(" ", args.Parameters);
var players = TSPlayer.FindByNameOrID(targetName);
if (players.Count == 0)
@@ -6039,7 +6039,7 @@ namespace TShockAPI
args.Player.SendErrorMessage(GetString("You do not have permission to respawn another player."));
return;
}
- string plStr = String.Join(" ", args.Parameters);
+ string plStr = string.Join(" ", args.Parameters);
var players = TSPlayer.FindByNameOrID(plStr);
if (players.Count == 0)
{
@@ -6785,7 +6785,7 @@ namespace TShockAPI
args.Player.SendErrorMessage(GetString("You do not have permission to god mode another player."));
return;
}
- string plStr = String.Join(" ", args.Parameters);
+ string plStr = string.Join(" ", args.Parameters);
var players = TSPlayer.FindByNameOrID(plStr);
if (players.Count == 0)
{
diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs
index 09d6983f..0a9b1683 100644
--- a/TShockAPI/DB/BanManager.cs
+++ b/TShockAPI/DB/BanManager.cs
@@ -107,6 +107,7 @@ namespace TShockAPI.DB
SqlType.Mysql => database.QueryScalar("SELECT COUNT(table_name) FROM information_schema.tables WHERE table_schema = @0 and table_name = 'Bans'", TShock.Config.Settings.MySqlDbName),
SqlType.Sqlite => database.QueryScalar("SELECT COUNT(name) FROM sqlite_master WHERE type='table' AND name = 'Bans'"),
SqlType.Postgres => database.QueryScalar("SELECT COUNT(table_name) FROM information_schema.tables WHERE table_name = 'Bans'"),
+ _ => 0,
};
if (res != 0)
diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs
index 69546797..77427e1b 100644
--- a/TShockAPI/DB/CharacterManager.cs
+++ b/TShockAPI/DB/CharacterManager.cs
@@ -186,6 +186,7 @@ namespace TShockAPI.DB
/// Inserts player data to the tsCharacter database table
///
/// player to take data from
+ /// If , the permission will be checked
/// true if inserted successfully
public bool InsertPlayerData(TSPlayer player, bool fromCommand = false)
{
diff --git a/TShockAPI/DB/DbBuilder.cs b/TShockAPI/DB/DbBuilder.cs
index 98aedcdf..643e5525 100644
--- a/TShockAPI/DB/DbBuilder.cs
+++ b/TShockAPI/DB/DbBuilder.cs
@@ -35,7 +35,6 @@ public sealed class DbBuilder
///
/// Builds a DB connection based on the provided configuration.
///
- /// The TShock configuration.
///
/// Default settings will result in a local sqlite database file named "tshock.db" in the current directory to be used as server DB.
///
diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs
index 4d34098e..28529ce3 100644
--- a/TShockAPI/DB/GroupManager.cs
+++ b/TShockAPI/DB/GroupManager.cs
@@ -172,7 +172,6 @@ namespace TShockAPI.DB
Permissions.item,
Permissions.give,
Permissions.heal,
- Permissions.immunetoban,
Permissions.usebanneditem,
Permissions.allowclientsideworldedit,
Permissions.buff,
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index b02090a8..3f12798d 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -347,10 +347,10 @@ namespace TShockAPI.DB
}
///
- /// Gets all user accounts from the database with a username that starts with or contains
+ /// Gets all user accounts from the database with a username that starts with or contains
///
/// Rough username search. "n" will match "n", "na", "nam", "name", etc
- /// If is not the first part of the username. If true then "name" would match "name", "username", "wordsnamewords", etc
+ /// If is not the first part of the username. If true then "name" would match "name", "username", "wordsnamewords", etc
/// Matching users or null if exception is thrown
public List GetUserAccountsByName(string username, bool notAtStart = false)
{
diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs
index efbf68b7..a7f471a4 100644
--- a/TShockAPI/Extensions/DbExt.cs
+++ b/TShockAPI/Extensions/DbExt.cs
@@ -184,27 +184,27 @@ namespace TShockAPI.DB
(s, i) => s.IsDBNull(i) ? null : (object)s.GetByte(i)
},
{
- typeof (Int16),
+ typeof (short),
(s, i) => s.GetInt16(i)
},
{
- typeof (Int16?),
+ typeof (short?),
(s, i) => s.IsDBNull(i) ? null : (object)s.GetInt16(i)
},
{
- typeof (Int32),
+ typeof (int),
(s, i) => s.GetInt32(i)
},
{
- typeof (Int32?),
+ typeof (int?),
(s, i) => s.IsDBNull(i) ? null : (object)s.GetInt32(i)
},
{
- typeof (Int64),
+ typeof (long),
(s, i) => s.GetInt64(i)
},
{
- typeof (Int64?),
+ typeof (long?),
(s, i) => s.IsDBNull(i) ? null : (object)s.GetInt64(i)
},
{
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index 6c1183cd..5c13cfc0 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -1556,11 +1556,11 @@ namespace TShockAPI
///
/// X Location
///
- public Int32 X { get; set; }
+ public int X { get; set; }
///
/// Y Location
///
- public Int32 Y { get; set; }
+ public int Y { get; set; }
///
/// Type
///
@@ -1574,7 +1574,7 @@ namespace TShockAPI
/// NPCStrike - Called when an NPC is attacked
///
public static HandlerList PaintTile = new HandlerList();
- private static bool OnPaintTile(TSPlayer player, MemoryStream data, Int32 x, Int32 y, byte t, byte ct)
+ private static bool OnPaintTile(TSPlayer player, MemoryStream data, int x, int y, byte t, byte ct)
{
if (PaintTile == null)
return false;
@@ -1600,11 +1600,11 @@ namespace TShockAPI
///
/// X Location
///
- public Int32 X { get; set; }
+ public int X { get; set; }
///
/// Y Location
///
- public Int32 Y { get; set; }
+ public int Y { get; set; }
///
/// Type
///
@@ -1618,7 +1618,7 @@ namespace TShockAPI
/// Called When a wall is painted
///
public static HandlerList PaintWall = new HandlerList();
- private static bool OnPaintWall(TSPlayer player, MemoryStream data, Int32 x, Int32 y, byte t, byte cw)
+ private static bool OnPaintWall(TSPlayer player, MemoryStream data, int x, int y, byte t, byte cw)
{
if (PaintWall == null)
return false;
@@ -1644,7 +1644,7 @@ namespace TShockAPI
///
/// ???
///
- public Int16 ID { get; set; }
+ public short ID { get; set; }
///
/// Flag is a bit field
/// if the first bit is set -> 0 = player, 1 = NPC
@@ -1674,7 +1674,7 @@ namespace TShockAPI
/// NPCStrike - Called when an NPC is attacked
///
public static HandlerList Teleport = new HandlerList();
- private static bool OnTeleport(TSPlayer player, MemoryStream data, Int16 id, byte f, float x, float y, byte style, int extraInfo)
+ private static bool OnTeleport(TSPlayer player, MemoryStream data, short id, byte f, float x, float y, byte style, int extraInfo)
{
if (Teleport == null)
return false;
@@ -4625,7 +4625,8 @@ namespace TShockAPI
{
0 => NetItem.Loadout1Armor,
1 => NetItem.Loadout2Armor,
- 2 => NetItem.Loadout3Armor
+ 2 => NetItem.Loadout3Armor,
+ _ => throw new NotImplementedException($"invalid lodout index {index}")
};
}
@@ -4635,7 +4636,8 @@ namespace TShockAPI
{
0 => NetItem.Loadout1Dye,
1 => NetItem.Loadout2Dye,
- 2 => NetItem.Loadout3Dye
+ 2 => NetItem.Loadout3Dye,
+ _ => throw new NotImplementedException($"invalid lodout index {index}")
};
}
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index 16aeb828..387ee031 100644
--- a/TShockAPI/Group.cs
+++ b/TShockAPI/Group.cs
@@ -208,7 +208,7 @@ namespace TShockAPI
public virtual bool HasPermission(string permission)
{
bool negated = false;
- if (String.IsNullOrEmpty(permission) || (RealHasPermission(permission, ref negated) && !negated))
+ if (string.IsNullOrEmpty(permission) || (RealHasPermission(permission, ref negated) && !negated))
{
return true;
}
@@ -220,7 +220,7 @@ namespace TShockAPI
for (int i = nodes.Length - 1; i >= 0; i--)
{
nodes[i] = "*";
- if (RealHasPermission(String.Join(".", nodes, 0, i + 1), ref negated))
+ if (RealHasPermission(string.Join(".", nodes, 0, i + 1), ref negated))
{
return !negated;
}
diff --git a/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs b/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
index 156cc7fb..4818c0c6 100644
--- a/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
+++ b/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
@@ -14,8 +14,8 @@ namespace TShockAPI.Handlers
{
public void OnReceive(object sender, DisplayDollItemSyncEventArgs args)
{
- /// If the player has no building permissions means that they couldn't even see the content of the doll in the first place.
- /// Thus, they would not be able to modify its content. This means that a hacker attempted to send this packet directly, or through raw bytes to tamper with the DisplayDoll. This is why I do not bother with making sure the player gets their item back.
+ // If the player has no building permissions means that they couldn't even see the content of the doll in the first place.
+ // Thus, they would not be able to modify its content. This means that a hacker attempted to send this packet directly, or through raw bytes to tamper with the DisplayDoll. This is why I do not bother with making sure the player gets their item back.
if (!args.Player.HasBuildPermission(args.DisplayDollEntity.Position.X, args.DisplayDollEntity.Position.Y, false))
{
args.Player.SendErrorMessage(GetString("You do not have permission to modify a Mannequin in a protected area!"));
diff --git a/TShockAPI/ILog.cs b/TShockAPI/ILog.cs
index fc024865..f1ba4085 100644
--- a/TShockAPI/ILog.cs
+++ b/TShockAPI/ILog.cs
@@ -145,6 +145,7 @@ namespace TShockAPI
/// Writes a debug string to the log file. Only works if the DebugLogs config option is set to true.
///
/// The message to be written.
+ /// format args
void ConsoleDebug(string message, params object[] args);
///
diff --git a/TShockAPI/NetItem.cs b/TShockAPI/NetItem.cs
index 7f0b89f9..5dcdb1cd 100644
--- a/TShockAPI/NetItem.cs
+++ b/TShockAPI/NetItem.cs
@@ -241,7 +241,7 @@ namespace TShockAPI
///
public override string ToString()
{
- return String.Format("{0},{1},{2},{3}", _netId, _stack, _prefixId, _favorited ? 1 : 0);
+ return string.Format("{0},{1},{2},{3}", _netId, _stack, _prefixId, _favorited ? 1 : 0);
}
///
@@ -259,10 +259,10 @@ namespace TShockAPI
if (comp.Length != 4)
throw new FormatException("String does not contain 4 sections.");
- int netId = Int32.Parse(comp[0]);
- int stack = Int32.Parse(comp[1]);
- byte prefixId = Byte.Parse(comp[2]);
- bool favorited = Int32.Parse(comp[3]) == 1;
+ int netId = int.Parse(comp[0]);
+ int stack = int.Parse(comp[1]);
+ byte prefixId = byte.Parse(comp[2]);
+ bool favorited = int.Parse(comp[3]) == 1;
return new NetItem(netId, stack, prefixId, favorited);
}
diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs
index 5bcf9de0..57c2ccb5 100644
--- a/TShockAPI/Permissions.cs
+++ b/TShockAPI/Permissions.cs
@@ -24,7 +24,6 @@ using System.Linq;
using System.Text;
// Since the permission nodes have annotations that say what they are, we don't need XML comments.
-#pragma warning disable 1591
namespace TShockAPI
{
diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs
index b8ec4e16..4b265485 100644
--- a/TShockAPI/Rest/Rest.cs
+++ b/TShockAPI/Rest/Rest.cs
@@ -221,7 +221,7 @@ namespace Rests
Ip = ip;
Port = port;
AssemblyName assembly = this.GetType().Assembly.GetName();
- serverHeader = new StringHeader("Server", String.Format("{0}/{1}", assembly.Name, assembly.Version));
+ serverHeader = new StringHeader("Server", string.Format("{0}/{1}", assembly.Name, assembly.Version));
}
///
diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs
index 5f7f8930..2b0d3ccd 100644
--- a/TShockAPI/Rest/RestManager.cs
+++ b/TShockAPI/Rest/RestManager.cs
@@ -155,7 +155,7 @@ namespace TShockAPI
///
/// Creates a new instance of
///
- public Token() : base("token", true, GetString("The REST authentication token."), typeof(String)) { }
+ public Token() : base("token", true, GetString("The REST authentication token."), typeof(string)) { }
}
///
@@ -300,7 +300,7 @@ namespace TShockAPI
[Description("Executes a remote command on the server, and returns the output of the command.")]
[RouteAttribute("/v3/server/rawcmd")]
[Permission(RestPermissions.restrawcommand)]
- [Noun("cmd", true, "The command and arguments to execute.", typeof(String))]
+ [Noun("cmd", true, "The command and arguments to execute.", typeof(string))]
[Token]
private object ServerCommandV3(RestRequestArgs args)
{
@@ -321,7 +321,7 @@ namespace TShockAPI
[Route("/v2/server/off")]
[Permission(RestPermissions.restmaintenance)]
[Noun("confirm", true, "Required to confirm that actually want to turn the server off.", typeof(bool))]
- [Noun("message", false, "The shutdown message.", typeof(String))]
+ [Noun("message", false, "The shutdown message.", typeof(string))]
[Noun("nosave", false, "Shutdown without saving.", typeof(bool))]
[Token]
private object ServerOff(RestRequestArgs args)
@@ -350,7 +350,7 @@ namespace TShockAPI
[Description("Broadcast a server wide message.")]
[Route("/v2/server/broadcast")]
- [Noun("msg", true, "The message to broadcast.", typeof(String))]
+ [Noun("msg", true, "The message to broadcast.", typeof(string))]
[Token]
private object ServerBroadcast(RestRequestArgs args)
{
@@ -484,9 +484,9 @@ namespace TShockAPI
[Description("Create a new TShock user account.")]
[Route("/v2/users/create")]
[Permission(RestPermissions.restmanageusers)]
- [Noun("user", true, "The user account name for the new account.", typeof(String))]
- [Noun("group", false, "The group the new account should be assigned.", typeof(String))]
- [Noun("password", true, "The password for the new account.", typeof(String))]
+ [Noun("user", true, "The user account name for the new account.", typeof(string))]
+ [Noun("group", false, "The group the new account should be assigned.", typeof(string))]
+ [Noun("password", true, "The password for the new account.", typeof(string))]
[Token]
private object UserCreateV2(RestRequestArgs args)
{
@@ -520,10 +520,10 @@ namespace TShockAPI
[Description("Update a users information.")]
[Route("/v2/users/update")]
[Permission(RestPermissions.restmanageusers)]
- [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(String))]
- [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(String))]
- [Noun("password", false, "The users new password, and at least this or group must be defined.", typeof(String))]
- [Noun("group", false, "The new group for the user, at least this or password must be defined.", typeof(String))]
+ [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(string))]
+ [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(string))]
+ [Noun("password", false, "The users new password, and at least this or group must be defined.", typeof(string))]
+ [Noun("group", false, "The new group for the user, at least this or password must be defined.", typeof(string))]
[Token]
private object UserUpdateV2(RestRequestArgs args)
{
@@ -571,8 +571,8 @@ namespace TShockAPI
[Description("Destroy a TShock user account.")]
[Route("/v2/users/destroy")]
[Permission(RestPermissions.restmanageusers)]
- [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(String))]
- [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(String))]
+ [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(string))]
+ [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(string))]
[Token]
private object UserDestroyV2(RestRequestArgs args)
{
@@ -595,8 +595,8 @@ namespace TShockAPI
[Description("List detailed information for a user account.")]
[Route("/v2/users/read")]
[Permission(RestPermissions.restviewusers)]
- [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(String))]
- [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(String))]
+ [Noun("user", true, "The search criteria (name or id of account to lookup).", typeof(string))]
+ [Noun("type", true, "The search criteria type (name for name lookup, id for id lookup).", typeof(string))]
[Token]
private object UserInfoV2(RestRequestArgs args)
{
@@ -615,10 +615,10 @@ namespace TShockAPI
[Description("Create a new ban entry.")]
[Route("/v3/bans/create")]
[Permission(RestPermissions.restmanagebans)]
- [Noun("identifier", true, "The identifier to ban.", typeof(String))]
- [Noun("reason", false, "The reason to assign to the ban.", typeof(String))]
- [Noun("start", false, "The datetime at which the ban should start.", typeof(String))]
- [Noun("end", false, "The datetime at which the ban should end.", typeof(String))]
+ [Noun("identifier", true, "The identifier to ban.", typeof(string))]
+ [Noun("reason", false, "The reason to assign to the ban.", typeof(string))]
+ [Noun("start", false, "The datetime at which the ban should start.", typeof(string))]
+ [Noun("end", false, "The datetime at which the ban should end.", typeof(string))]
[Token]
private object BanCreateV3(RestRequestArgs args)
{
@@ -675,7 +675,7 @@ namespace TShockAPI
[Description("Delete an existing ban entry.")]
[Route("/v3/bans/destroy")]
[Permission(RestPermissions.restmanagebans)]
- [Noun("ticketNumber", true, "The ticket number of the ban to delete.", typeof(String))]
+ [Noun("ticketNumber", true, "The ticket number of the ban to delete.", typeof(string))]
[Noun("fullDelete", false, "Whether or not to completely remove the ban from the system.", typeof(bool))]
[Token]
private object BanDestroyV3(RestRequestArgs args)
@@ -702,7 +702,7 @@ namespace TShockAPI
[Description("View the details of a specific ban.")]
[Route("/v3/bans/read")]
[Permission(RestPermissions.restviewbans)]
- [Noun("ticketNumber", true, "The ticket number to search for.", typeof(String))]
+ [Noun("ticketNumber", true, "The ticket number to search for.", typeof(string))]
[Token]
private object BanInfoV3(RestRequestArgs args)
{
@@ -923,7 +923,7 @@ namespace TShockAPI
[Description("Unmute a player.")]
[Route("/v2/players/unmute")]
[Permission(RestPermissions.restmute)]
- [Noun("player", true, "The player to mute.", typeof(String))]
+ [Noun("player", true, "The player to mute.", typeof(string))]
[Token]
private object PlayerUnMute(RestRequestArgs args)
{
@@ -933,7 +933,7 @@ namespace TShockAPI
[Description("Mute a player.")]
[Route("/v2/players/mute")]
[Permission(RestPermissions.restmute)]
- [Noun("player", true, "The player to mute.", typeof(String))]
+ [Noun("player", true, "The player to mute.", typeof(string))]
[Token]
private object PlayerMute(RestRequestArgs args)
{
@@ -967,7 +967,7 @@ namespace TShockAPI
[Description("Get information for a user.")]
[Route("/v3/players/read")]
[Permission(RestPermissions.restuserinfo)]
- [Noun("player", true, "The player to lookup", typeof(String))]
+ [Noun("player", true, "The player to lookup", typeof(string))]
[Token]
private object PlayerReadV3(RestRequestArgs args)
{
@@ -998,7 +998,7 @@ namespace TShockAPI
[Description("Get information for a user.")]
[Route("/v4/players/read")]
[Permission(RestPermissions.restuserinfo)]
- [Noun("player", true, "The player to lookup", typeof(String))]
+ [Noun("player", true, "The player to lookup", typeof(string))]
[Token]
private object PlayerReadV4(RestRequestArgs args)
{
@@ -1037,8 +1037,8 @@ namespace TShockAPI
[Description("Kick a player off the server.")]
[Route("/v2/players/kick")]
[Permission(RestPermissions.restkick)]
- [Noun("player", true, "The player to kick.", typeof(String))]
- [Noun("reason", false, "The reason the player was kicked.", typeof(String))]
+ [Noun("player", true, "The player to kick.", typeof(string))]
+ [Noun("reason", false, "The reason the player was kicked.", typeof(string))]
[Token]
private object PlayerKickV2(RestRequestArgs args)
{
@@ -1054,8 +1054,8 @@ namespace TShockAPI
[Description("Kill a player.")]
[Route("/v2/players/kill")]
[Permission(RestPermissions.restkill)]
- [Noun("player", true, "The player to kick.", typeof(String))]
- [Noun("from", false, "Who killed the player.", typeof(String))]
+ [Noun("player", true, "The player to kick.", typeof(string))]
+ [Noun("from", false, "Who killed the player.", typeof(string))]
[Token]
private object PlayerKill(RestRequestArgs args)
{
@@ -1091,7 +1091,7 @@ namespace TShockAPI
[Description("Display information of a group.")]
[Route("/v2/groups/read")]
[Permission(RestPermissions.restviewgroups)]
- [Noun("group", true, "The group name to get information on.", typeof(String))]
+ [Noun("group", true, "The group name to get information on.", typeof(string))]
[Token]
private object GroupInfo(RestRequestArgs args)
{
@@ -1113,7 +1113,7 @@ namespace TShockAPI
[Description("Delete a group.")]
[Route("/v2/groups/destroy")]
[Permission(RestPermissions.restmanagegroups)]
- [Noun("group", true, "The group name to delete.", typeof(String))]
+ [Noun("group", true, "The group name to delete.", typeof(string))]
[Token]
private object GroupDestroy(RestRequestArgs args)
{
@@ -1137,10 +1137,10 @@ namespace TShockAPI
[Description("Create a new group.")]
[Route("/v2/groups/create")]
[Permission(RestPermissions.restmanagegroups)]
- [Noun("group", true, "The name of the new group.", typeof(String))]
- [Noun("parent", false, "The name of the parent group.", typeof(String))]
- [Noun("permissions", false, "A comma separated list of permissions for the new group.", typeof(String))]
- [Noun("chatcolor", false, "A r,g,b string representing the color for this groups chat.", typeof(String))]
+ [Noun("group", true, "The name of the new group.", typeof(string))]
+ [Noun("parent", false, "The name of the parent group.", typeof(string))]
+ [Noun("permissions", false, "A comma separated list of permissions for the new group.", typeof(string))]
+ [Noun("chatcolor", false, "A r,g,b string representing the color for this groups chat.", typeof(string))]
[Token]
private object GroupCreate(RestRequestArgs args)
{
@@ -1161,10 +1161,10 @@ namespace TShockAPI
[Route("/v2/groups/update")]
[Permission(RestPermissions.restmanagegroups)]
- [Noun("group", true, "The name of the group to modify.", typeof(String))]
- [Noun("parent", false, "The name of the new parent for this group.", typeof(String))]
- [Noun("chatcolor", false, "The new chat color r,g,b.", typeof(String))]
- [Noun("permissions", false, "The new comma separated list of permissions.", typeof(String))]
+ [Noun("group", true, "The name of the group to modify.", typeof(string))]
+ [Noun("parent", false, "The name of the new parent for this group.", typeof(string))]
+ [Noun("chatcolor", false, "The new chat color r,g,b.", typeof(string))]
+ [Noun("permissions", false, "The new comma separated list of permissions.", typeof(string))]
[Token]
private object GroupUpdate(RestRequestArgs args)
{
@@ -1218,7 +1218,7 @@ namespace TShockAPI
var permission = method.GetCustomAttributes(false).Where(o => o is Permission);
if (permission.Any())
{
- sb.AppendLine(GetString("* **Permissions**: `{0}`", String.Join(", ", permission.Select(p => ((Permission)p).Name))));
+ sb.AppendLine(GetString("* **Permissions**: `{0}`", string.Join(", ", permission.Select(p => ((Permission)p).Name))));
}
else
{
@@ -1252,7 +1252,7 @@ namespace TShockAPI
}
sb.AppendLine();
sb.AppendLine(GetString("**Example Usage**: `{0}?{1}`", routeattr.Route,
- string.Join("&", nouns.Select(n => String.Format("{0}={0}", ((Noun)n).Name)))));
+ string.Join("&", nouns.Select(n => string.Format("{0}={0}", ((Noun)n).Name)))));
sb.AppendLine();
}
}
diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs
index ddb3db32..c65cfa3a 100644
--- a/TShockAPI/Rest/SecureRest.cs
+++ b/TShockAPI/Rest/SecureRest.cs
@@ -42,7 +42,7 @@ namespace Rests
public Dictionary Tokens { get; protected set; }
public Dictionary AppTokens { get; protected set; }
- private RNGCryptoServiceProvider _rng = new RNGCryptoServiceProvider();
+ private RandomNumberGenerator _rng = RandomNumberGenerator.Create();
public SecureRest(IPAddress ip, int port)
: base(ip, port)
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 4bc177f4..bd46950b 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -38,7 +38,7 @@ using Terraria.GameContent.Creative;
namespace TShockAPI
{
///
- /// Bitflags used with the method
+ /// Bitflags used with the method
///
[Flags]
public enum DisableFlags
@@ -121,7 +121,7 @@ namespace TShockAPI
/// If the string comes with tsi: or tsn:, we'll only return a list with one element,
/// either the player with the matching ID or name, respectively.
///
- /// Player name or ID
+ /// Player name or ID
/// A list of matching players
public static List FindByNameOrID(string search)
{
@@ -1404,7 +1404,7 @@ namespace TShockAPI
/// Initializes a new instance of the class.
///
/// The player's name.
- protected TSPlayer(String playerName)
+ protected TSPlayer(string playerName)
{
TilesDestroyed = new Dictionary();
TilesCreated = new Dictionary();
@@ -1943,7 +1943,6 @@ namespace TShockAPI
public void SendFileTextAsMessage(string file)
{
string foo = "";
- bool containsOldFormat = false;
using (var tr = new StreamReader(file))
{
Color lineColor;
@@ -1966,7 +1965,7 @@ namespace TShockAPI
}
foo = foo.Replace("%map%", (TShock.Config.Settings.UseServerName ? TShock.Config.Settings.ServerName : Main.worldName));
- foo = foo.Replace("%players%", String.Join(", ", players));
+ foo = foo.Replace("%players%", string.Join(", ", players));
foo = foo.Replace("%specifier%", TShock.Config.Settings.CommandSpecifier);
foo = foo.Replace("%onlineplayers%", TShock.Utils.GetActivePlayerCount().ToString());
foo = foo.Replace("%serverslots%", TShock.Config.Settings.MaxSlots.ToString());
diff --git a/TShockAPI/TSServerPlayer.cs b/TShockAPI/TSServerPlayer.cs
index 6c95de78..457eb5cf 100644
--- a/TShockAPI/TSServerPlayer.cs
+++ b/TShockAPI/TSServerPlayer.cs
@@ -76,14 +76,7 @@ namespace TShockAPI
foreach (var snippet in snippets)
{
- if (snippet.Color != null)
- {
- Console.ForegroundColor = PickNearbyConsoleColor(snippet.Color);
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Gray;
- }
+ Console.ForegroundColor = PickNearbyConsoleColor(snippet.Color);
Console.Write(snippet.Text);
}
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 5c3134ad..8070b153 100644
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -537,10 +537,10 @@ namespace TShockAPI
/// args - The PlayerPostLoginEventArgs object.
private void OnPlayerLogin(PlayerPostLoginEventArgs args)
{
- List KnownIps = new List();
+ List KnownIps = new List();
if (!string.IsNullOrWhiteSpace(args.Player.Account.KnownIps))
{
- KnownIps = JsonConvert.DeserializeObject>(args.Player.Account.KnownIps);
+ KnownIps = JsonConvert.DeserializeObject>(args.Player.Account.KnownIps);
}
if (KnownIps.Count == 0)
@@ -1358,7 +1358,7 @@ namespace TShockAPI
return;
}
- if (Config.Settings.KickEmptyUUID && String.IsNullOrWhiteSpace(player.UUID))
+ if (Config.Settings.KickEmptyUUID && string.IsNullOrWhiteSpace(player.UUID))
{
player.Kick(GetString("Your client sent a blank UUID. Configure it to send one or use a different client."), true, true, null, false);
args.Handled = true;
@@ -1481,7 +1481,7 @@ namespace TShockAPI
{
if (item.Value._name == args.CommandId._name)
{
- if (!String.IsNullOrEmpty(text))
+ if (!string.IsNullOrEmpty(text))
{
text = EnglishLanguage.GetCommandPrefixByName(item.Value._name) + ' ' + text;
}
@@ -1525,7 +1525,7 @@ namespace TShockAPI
}
else if (!TShock.Config.Settings.EnableChatAboveHeads)
{
- text = String.Format(Config.Settings.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
+ text = string.Format(Config.Settings.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
args.Text);
//Invoke the PlayerChat hook. If this hook event is handled then we need to prevent sending the chat message
@@ -1543,7 +1543,7 @@ namespace TShockAPI
{
Player ply = Main.player[args.Who];
string name = ply.name;
- ply.name = String.Format(Config.Settings.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix);
+ ply.name = string.Format(Config.Settings.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix);
//Update the player's name to format text nicely. This needs to be done because Terraria automatically formats messages against our will
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, NetworkText.FromLiteral(ply.name), args.Who, 0, 0, 0, 0);
@@ -1568,8 +1568,8 @@ namespace TShockAPI
//Reset their name
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, NetworkText.FromLiteral(name), args.Who, 0, 0, 0, 0);
- string msg = String.Format("<{0}> {1}",
- String.Format(Config.Settings.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix),
+ string msg = string.Format("<{0}> {1}",
+ string.Format(Config.Settings.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix),
text
);
diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj
index 5d5a322e..fe97ddee 100644
--- a/TShockAPI/TShockAPI.csproj
+++ b/TShockAPI/TShockAPI.csproj
@@ -29,6 +29,7 @@
Pryaxis & TShock Contributors
TShock is a toolbox for Terraria servers and communities.
TShock
+ $(NoWarn);CS1591
diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs
index 74333a39..945e98ce 100644
--- a/TShockAPI/Utils.cs
+++ b/TShockAPI/Utils.cs
@@ -249,7 +249,7 @@ namespace TShockAPI
public List- GetItemByIdOrName(string text)
{
int type = -1;
- if (Int32.TryParse(text, out type))
+ if (int.TryParse(text, out type))
{
if (type >= Terraria.ID.ItemID.Count)
return new List
- ();
@@ -335,11 +335,11 @@ namespace TShockAPI
if (!match.Success)
return null;
Item item = new Item();
- item.netDefaults(Int32.Parse(match.Groups["NetID"].Value));
- if (!String.IsNullOrWhiteSpace(match.Groups["Stack"].Value))
- item.stack = Int32.Parse(match.Groups["Stack"].Value);
- if (!String.IsNullOrWhiteSpace(match.Groups["Prefix"].Value))
- item.prefix = Byte.Parse(match.Groups["Prefix"].Value);
+ item.netDefaults(int.Parse(match.Groups["NetID"].Value));
+ if (!string.IsNullOrWhiteSpace(match.Groups["Stack"].Value))
+ item.stack = int.Parse(match.Groups["Stack"].Value);
+ if (!string.IsNullOrWhiteSpace(match.Groups["Prefix"].Value))
+ item.prefix = byte.Parse(match.Groups["Prefix"].Value);
return item;
}
@@ -921,7 +921,7 @@ namespace TShockAPI
/// The , surrounded by the color tag with the appropriated hex code.
public string ColorTag(string text, Color color)
{
- return String.Format("[c/{0}:{1}]", color.Hex3(), text);
+ return string.Format("[c/{0}:{1}]", color.Hex3(), text);
}
///
@@ -935,7 +935,7 @@ namespace TShockAPI
int stack = item.stack;
int prefix = item.prefix;
string options = stack > 1 ? "/s" + stack : prefix != 0 ? "/p" + prefix : "";
- return String.Format("[i{0}:{1}]", options, netID);
+ return string.Format("[i{0}:{1}]", options, netID);
}
///
diff --git a/TShockPluginManager/NugetCLI.cs b/TShockPluginManager/NugetCLI.cs
index 66fcea18..5744667f 100644
--- a/TShockPluginManager/NugetCLI.cs
+++ b/TShockPluginManager/NugetCLI.cs
@@ -181,7 +181,7 @@ namespace TShockPluginManager
}
static public void DumpGraph(SourcePackageDependencyInfo from, IEnumerable data, IEnumerable builtins, int level)
{
- var indent = new String('\t', level);
+ var indent = new string('\t', level);
Console.Write(indent);
CLIHelpers.WriteLine(C.GetString($"{from.Id} from {from.Source.PackageSource.Name} [{from.Source.PackageSource.Source}]"));