diff --git a/TShockAPI/BackupManager.cs b/TShockAPI/BackupManager.cs
index ee60560c..f9e164cd 100644
--- a/TShockAPI/BackupManager.cs
+++ b/TShockAPI/BackupManager.cs
@@ -48,9 +48,9 @@ namespace TShockAPI
DoBackup(null);
DeleteOld(null);
});
- t.Name = "Backup Thread";
+ t.Name = GetString("Backup Thread");
t.Start();
-
+
// ThreadPool.QueueUserWorkItem(DoBackup);
// ThreadPool.QueueUserWorkItem(DeleteOld);
}
@@ -70,23 +70,23 @@ namespace TShockAPI
if (TShock.Config.Settings.ShowBackupAutosaveMessages)
{
- TSPlayer.All.SendInfoMessage("Server map saving...");
+ TSPlayer.All.SendInfoMessage(GetString("Server map saving..."));
}
- Console.WriteLine("Backing up world...");
+ Console.WriteLine(GetString("Backing up world..."));
SaveManager.Instance.SaveWorld();
- Console.WriteLine("World backed up.");
+ Console.WriteLine(GetString("World backed up."));
Console.ForegroundColor = ConsoleColor.Gray;
- TShock.Log.Info(string.Format("World backed up ({0}).", Main.worldPathName));
+ TShock.Log.Info(GetString("World backed up ({0}).", Main.worldPathName));
Main.ActiveWorldFileData._path = worldname;
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Backup failed!");
+ Console.WriteLine(GetString("Backup failed!"));
Console.ForegroundColor = ConsoleColor.Gray;
- TShock.Log.Error("Backup failed!");
+ TShock.Log.Error(GetString("Backup failed!"));
TShock.Log.Error(ex.ToString());
}
}
diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs
index 8e028c95..0cca694e 100644
--- a/TShockAPI/Bouncer.cs
+++ b/TShockAPI/Bouncer.cs
@@ -243,7 +243,7 @@ namespace TShockAPI
}
else
{
- throw new InvalidOperationException("Unrecognized player direction");
+ throw new InvalidOperationException(GetString("Unrecognized player direction"));
}
}
else
@@ -424,7 +424,7 @@ namespace TShockAPI
{
if (args.Player.RequestedSection)
{
- TShock.Log.ConsoleDebug("Bouncer / OnGetSection rejected GetSection packet from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGetSection rejected GetSection packet from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -432,8 +432,8 @@ namespace TShockAPI
if (String.IsNullOrEmpty(args.Player.Name))
{
- TShock.Log.ConsoleDebug("Bouncer / OnGetSection rejected empty player name.");
- args.Player.Kick("Your client sent a blank character name.", true, true);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGetSection rejected empty player name."));
+ args.Player.Kick(GetString("Your client sent a blank character name."), true, true);
args.Handled = true;
return;
}
@@ -458,45 +458,45 @@ namespace TShockAPI
if (Single.IsInfinity(vel.X) || Single.IsInfinity(vel.Y))
{
- TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to infinity) from {0}", args.Player.Name);
- args.Player.Kick("Detected DOOM set to ON position.", true, true);
+ 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);
args.Handled = true;
return;
}
if (Single.IsNaN(vel.X) || Single.IsNaN(vel.Y))
{
- TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to NaN) from {0}", args.Player.Name);
- args.Player.Kick("Detected DOOM set to ON position.", true, true);
+ 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);
args.Handled = true;
return;
}
if (vel.X > 50000 || vel.Y > 50000 || vel.X < -50000 || vel.Y < -50000)
{
- TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity +/- 50000) from {0}", args.Player.Name);
- args.Player.Kick("Detected DOOM set to ON position.", true, true);
+ TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity +/- 50000) from {0}", args.Player.Name));
+ args.Player.Kick(GetString("Detected DOOM set to ON position."), true, true);
args.Handled = true;
return;
}
if (pos.X < 0 || pos.Y < 0 || pos.X >= Main.maxTilesX * 16 - 16 || pos.Y >= Main.maxTilesY * 16 - 16)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name));
args.Handled = true;
return;
}
if (item < 0 || item >= args.Player.TPlayer.inventory.Length)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (inventory length) {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (inventory length) {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.LastNetPosition == Vector2.Zero)
{
- TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate *would have rejected* from (last network position zero) {0}", args.Player.Name);
+ TShock.Log.ConsoleInfo(GetString("Bouncer / OnPlayerUpdate *would have rejected* from (last network position zero) {0}", args.Player.Name));
// args.Handled = true;
// return;
}
@@ -514,23 +514,23 @@ namespace TShockAPI
// We need to tell them they were disabled and why, then revert the change.
if (args.Player.IsDisabledForStackDetection)
{
- args.Player.SendErrorMessage("Disabled. You went too far with hacked item stacks.");
+ args.Player.SendErrorMessage(GetString("Disabled. You went too far with hacked item stacks."));
}
else if (args.Player.IsDisabledForBannedWearable)
{
- args.Player.SendErrorMessage("Disabled. You went too far with banned armor.");
+ args.Player.SendErrorMessage(GetString("Disabled. You went too far with banned armor."));
}
else if (args.Player.IsDisabledForSSC)
{
- args.Player.SendErrorMessage("Disabled. You need to {0}login to load your saved data.", TShock.Config.Settings.CommandSpecifier);
+ args.Player.SendErrorMessage(GetString("Disabled. You need to {0}login to load your saved data.", TShock.Config.Settings.CommandSpecifier));
}
else if (TShock.Config.Settings.RequireLogin && !args.Player.IsLoggedIn)
{
- args.Player.SendErrorMessage("Account needed! Please {0}register or {0}login to play!", TShock.Config.Settings.CommandSpecifier);
+ args.Player.SendErrorMessage(GetString("Account needed! Please {0}register or {0}login to play!", TShock.Config.Settings.CommandSpecifier));
}
else if (args.Player.IsDisabledPendingTrashRemoval)
{
- args.Player.SendErrorMessage("You need to rejoin to ensure your trash can is cleared!");
+ args.Player.SendErrorMessage(GetString("You need to rejoin to ensure your trash can is cleared!"));
}
// ??
@@ -540,11 +540,11 @@ namespace TShockAPI
{
args.Player.Spawn(PlayerSpawnContext.RecallFromItem);
}
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (??) {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (??) {0}", args.Player.Name));
args.Handled = true;
return;
}
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (below ??) {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (below ??) {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -552,7 +552,7 @@ namespace TShockAPI
// Corpses don't move
if (args.Player.Dead)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (corpses don't move) {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerUpdate rejected from (corpses don't move) {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -582,7 +582,7 @@ namespace TShockAPI
{
if (!TShock.Utils.TilePlacementValid(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (tile placement valid) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (tile placement valid) {0} {1} {2}", args.Player.Name, action, editData));
args.Handled = true;
return;
}
@@ -591,7 +591,7 @@ namespace TShockAPI
// This check ensures that build permission is always checked no matter what
if (!args.Player.HasBuildPermission(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from build from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from build from {0} {1} {2}", args.Player.Name, action, editData));
GetRollbackRectSize(tileX, tileY, out byte width, out byte length, out int offsetY);
args.Player.SendTileRect((short)(tileX - width), (short)(tileY + offsetY), (byte)(width * 2), (byte)(length + 1));
@@ -603,7 +603,7 @@ namespace TShockAPI
((action == EditAction.PlaceTile || action == EditAction.ReplaceTile) && editData >= Main.maxTileSets) ||
((action == EditAction.PlaceWall || action == EditAction.ReplaceWall) && editData >= Main.maxWallTypes))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from editData out of bounds {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from editData out of bounds {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -611,14 +611,14 @@ namespace TShockAPI
if (action == EditAction.KillTile && Main.tile[tileX, tileY].type == TileID.MagicalIceBlock)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit super accepted from (ice block) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit super accepted from (ice block) {0} {1} {2}", args.Player.Name, action, editData));
args.Handled = false;
return;
}
if (args.Player.Dead && TShock.Config.Settings.PreventDeadModification)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (pdm) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (pdm) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -632,9 +632,9 @@ namespace TShockAPI
{
if (TShock.TileBans.TileIsBanned(editData, args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (tb) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (tb) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
- args.Player.SendErrorMessage("You do not have permission to place this tile.");
+ args.Player.SendErrorMessage(GetString("You do not have permission to place this tile."));
args.Handled = true;
return;
}
@@ -654,8 +654,8 @@ namespace TShockAPI
// If none found then it can't be a false positive so deny the action
if (!PlaceStyleCorrectors.TryGetValue(actualTileToBeCreated, out PlaceStyleCorrector corrector))
{
- TShock.Log.ConsoleError("Bouncer / OnTileEdit rejected from (placestyle) {0} {1} {2} placeStyle: {3} expectedStyle: {4}",
- args.Player.Name, action, editData, requestedPlaceStyle, actualItemPlaceStyle);
+ TShock.Log.ConsoleError(GetString("Bouncer / OnTileEdit rejected from (placestyle) {0} {1} {2} placeStyle: {3} expectedStyle: {4}",
+ args.Player.Name, action, editData, requestedPlaceStyle, actualItemPlaceStyle));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -665,8 +665,8 @@ namespace TShockAPI
var correctedPlaceStyle = corrector(tplayer, requestedPlaceStyle, actualItemPlaceStyle);
if (requestedPlaceStyle != correctedPlaceStyle)
{
- TShock.Log.ConsoleError("Bouncer / OnTileEdit rejected from (placestyle) {0} {1} {2} placeStyle: {3} expectedStyle: {4}",
- args.Player.Name, action, editData, requestedPlaceStyle, correctedPlaceStyle);
+ TShock.Log.ConsoleError(GetString("Bouncer / OnTileEdit rejected from (placestyle) {0} {1} {2} placeStyle: {3} expectedStyle: {4}",
+ args.Player.Name, action, editData, requestedPlaceStyle, correctedPlaceStyle));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -681,7 +681,7 @@ namespace TShockAPI
// If the tile is an axe tile and they aren't selecting an axe, they're hacking.
if (Main.tileAxe[tile.type] && ((args.Player.TPlayer.mount.Type != 8 && selectedItem.axe == 0) && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (axe) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (axe) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -689,7 +689,7 @@ namespace TShockAPI
// If the tile is a hammer tile and they aren't selecting a hammer, they're hacking.
else if (Main.tileHammer[tile.type] && ((args.Player.TPlayer.mount.Type != 8 && selectedItem.hammer == 0) && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (hammer) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (hammer) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -705,8 +705,8 @@ namespace TShockAPI
!ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0
&& !TileID.Sets.BreakableWhenPlacing[tile.type])
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (pick) {0} {1} {2}", args.Player.Name, action,
- editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (pick) {0} {1} {2}", args.Player.Name, action,
+ editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -717,7 +717,7 @@ namespace TShockAPI
// If they aren't selecting a hammer, they could be hacking.
if (selectedItem.hammer == 0 && !ItemID.Sets.Explosives[selectedItem.netID] && args.Player.RecentFuse == 0 && selectedItem.createWall == 0)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (hammer2) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (hammer2) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -736,7 +736,7 @@ namespace TShockAPI
!args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(p.Type) && GetDataHandlers.projectileCreatesTile[p.Type] == editData &&
!p.Killed && Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X)))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2} selectedItem:{3} itemCreateTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2} selectedItem:{3} itemCreateTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -747,7 +747,7 @@ namespace TShockAPI
if ((action == EditAction.PlaceTile && TShock.Config.Settings.PreventInvalidPlaceStyle) &&
requestedPlaceStyle > GetMaxPlaceStyle(editData))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (ms1) {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (ms1) {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -756,7 +756,7 @@ namespace TShockAPI
/// Handle placement action if the player is using an Ice Rod but not placing the iceblock.
if (selectedItem.netID == ItemID.IceRod && editData != TileID.MagicalIceBlock)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from using ice rod but not placing ice block {0} {1} {2}", args.Player.Name, action, editData);
+ 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;
}
@@ -766,7 +766,7 @@ namespace TShockAPI
/// These would get caught up in the below check because Terraria does not set their createTile field.
if (selectedItem.netID != ItemID.IceRod && selectedItem.netID != ItemID.DirtBomb && selectedItem.netID != ItemID.StickyBomb)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from tile placement not matching selected item createTile {0} {1} {2} selectedItemID:{3} createTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile);
+ 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.netID, selectedItem.createTile));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -775,7 +775,7 @@ namespace TShockAPI
/// 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("Bouncer / OnTileEdit rejected from wall placement not matching selected item createWall {0} {1} {2} selectedItemID:{3} createWall:{4}", args.Player.Name, action, editData, selectedItem.netID, 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.netID, selectedItem.createWall));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -784,8 +784,8 @@ namespace TShockAPI
{
if (TShock.Utils.HasWorldReachedMaxChests())
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (chestcap) {0} {1} {2}", args.Player.Name, action, editData);
- args.Player.SendErrorMessage("The world's chest limit has been reached - unable to place more.");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from (chestcap) {0} {1} {2}", args.Player.Name, action, editData));
+ args.Player.SendErrorMessage(GetString("The world's chest limit has been reached - unable to place more."));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -803,7 +803,7 @@ namespace TShockAPI
&& selectedItem.type != ItemID.MulticolorWrench
&& selectedItem.type != ItemID.WireKite)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from place wire from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from place wire from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -817,7 +817,7 @@ namespace TShockAPI
&& selectedItem.type != ItemID.WireKite
&& selectedItem.type != ItemID.MulticolorWrench)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from wire cutter from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from wire cutter from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -828,7 +828,7 @@ namespace TShockAPI
// If they aren't selecting the actuator and don't have the Presserator equipped, they're hacking.
if (selectedItem.type != ItemID.Actuator && !args.Player.TPlayer.autoActuator)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from actuator/presserator from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from actuator/presserator from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -838,7 +838,7 @@ namespace TShockAPI
{
if (action == EditAction.KillWall || action == EditAction.ReplaceWall)
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from sts allow cut from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from sts allow cut from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -849,7 +849,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from disable from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from disable from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -858,7 +858,7 @@ namespace TShockAPI
if (!args.Player.HasModifiedIceSuccessfully(tileX, tileY, editData, action)
&& !args.Player.HasBuildPermission(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from ice/build from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from ice/build from {0} {1} {2}", args.Player.Name, action, editData));
GetRollbackRectSize(tileX, tileY, out byte width, out byte length, out int offsetY);
args.Player.SendTileRect((short)(tileX - width), (short)(tileY + offsetY), (byte)(width * 2), (byte)(length + 1));
@@ -888,7 +888,7 @@ namespace TShockAPI
return;
}
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from explosives/fuses from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from explosives/fuses from {0} {1} {2}", args.Player.Name, action, editData));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -898,16 +898,16 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnTileKillThresholdBroken)
{
- args.Player.Kick(string.Format("Tile kill threshold exceeded {0}.", TShock.Config.Settings.TileKillThreshold));
+ args.Player.Kick(GetString("Tile kill threshold exceeded {0}.", TShock.Config.Settings.TileKillThreshold));
}
else
{
- args.Player.Disable("Reached TileKill threshold.", DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Reached TileKill threshold."), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 4);
}
-
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from tile kill threshold from {0}, (value: {1})", args.Player.Name, args.Player.TileKillThreshold);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile kill threshold they were disabled for to TShock so we can improve this!");
+
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from tile kill threshold from {0}, (value: {1})", args.Player.Name, args.Player.TileKillThreshold));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the tile kill threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
@@ -916,23 +916,23 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnTilePlaceThresholdBroken)
{
- args.Player.Kick(string.Format("Tile place threshold exceeded {0}.", TShock.Config.Settings.TilePlaceThreshold));
+ args.Player.Kick(GetString("Tile place threshold exceeded {0}.", TShock.Config.Settings.TilePlaceThreshold));
}
else
{
- args.Player.Disable("Reached TilePlace threshold.", DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Reached TilePlace threshold."), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 4);
}
-
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from tile place threshold from {0}, (value: {1})", args.Player.Name, args.Player.TilePlaceThreshold);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile place threshold they were disabled for to TShock so we can improve this!");
+
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from tile place threshold from {0}, (value: {1})", args.Player.Name, args.Player.TilePlaceThreshold));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the tile place threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from throttled from {0} {1} {2}", args.Player.Name, action, editData);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from throttled from {0} {1} {2}"), args.Player.Name, action, editData);
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -965,8 +965,8 @@ namespace TShockAPI
}
catch
{
- TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from weird confusing flow control from {0}", args.Player.Name);
- TShock.Log.ConsoleDebug("If you're seeing this message and you know what that player did, please report it to TShock for further investigation.");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnTileEdit rejected from weird confusing flow control from {0}", args.Player.Name));
+ TShock.Log.ConsoleDebug(GetString("If you're seeing this message and you know what that player did, please report it to TShock for further investigation."));
args.Player.SendTileSquareCentered(tileX, tileY, 4);
args.Handled = true;
return;
@@ -1054,7 +1054,7 @@ namespace TShockAPI
{
// Causes item duplications. Will be re added later if necessary
//args.Player.SendData(PacketTypes.ItemDrop, "", id);
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from attempt crash from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from attempt crash from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1064,7 +1064,7 @@ namespace TShockAPI
// will break item pickups on the client.
if (prefix > PrefixID.Count)
{
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from prefix check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from prefix check from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
@@ -1079,7 +1079,7 @@ namespace TShockAPI
{
// Causes item duplications. Will be re added if necessary
//args.Player.SendData(PacketTypes.ItemDrop, "", id);
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from dupe range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from dupe range check from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1090,7 +1090,7 @@ namespace TShockAPI
if (!args.Player.IsInRange((int)(pos.X / 16f), (int)(pos.Y / 16f)))
{
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from range check from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
return;
@@ -1100,7 +1100,7 @@ namespace TShockAPI
// only if the client isn't picking up the item
if (Main.item[id].active && Main.item[id].netID != type)
{
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from item drop/pickup check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from item drop/pickup check from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
return;
@@ -1110,7 +1110,7 @@ namespace TShockAPI
item.netDefaults(type);
if ((stacks > item.maxStack || stacks <= 0) || (TShock.ItemBans.DataModel.ItemIsBanned(EnglishLanguage.GetItemNameById(item.type), args.Player) && !args.Player.HasPermission(Permissions.allowdroppingbanneditems)))
{
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from drop item ban check / max stack check / min stack check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from drop item ban check / max stack check / min stack check from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
return;
@@ -1120,8 +1120,8 @@ namespace TShockAPI
if ((Main.ServerSideCharacter) && (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond - args.Player.LoginMS < TShock.ServerSideCharacterConfig.Settings.LogonDiscardThreshold))
{
//Player is probably trying to sneak items onto the server in their hands!!!
- TShock.Log.ConsoleInfo("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.Name);
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from sneaky from {0}", args.Player.Name);
+ TShock.Log.ConsoleInfo(GetString("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.Name));
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from sneaky from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
return;
@@ -1130,7 +1130,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnItemDrop rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnItemDrop rejected from disabled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ItemDrop, "", id);
args.Handled = true;
return;
@@ -1154,7 +1154,7 @@ namespace TShockAPI
if (index > Main.maxProjectiles)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from above projectile limit from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from above projectile limit from {0}", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1162,9 +1162,9 @@ namespace TShockAPI
if (TShock.ProjectileBans.ProjectileIsBanned(type, args.Player))
{
- args.Player.Disable(String.Format("Player does not have permission to create projectile {0}.", type), DisableFlags.WriteToLogAndConsole);
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from permission check from {0} {1}", args.Player.Name, type);
- args.Player.SendErrorMessage("You do not have permission to create that projectile.");
+ args.Player.Disable(GetString("Player does not have permission to create projectile {0}.", type), DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from permission check from {0} {1}", args.Player.Name, type));
+ args.Player.SendErrorMessage(GetString("You do not have permission to create that projectile."));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1172,8 +1172,8 @@ namespace TShockAPI
if (damage > TShock.Config.Settings.MaxProjDamage && !args.Player.HasPermission(Permissions.ignoredamagecap))
{
- args.Player.Disable(String.Format("Projectile damage is higher than {0}.", TShock.Config.Settings.MaxProjDamage), DisableFlags.WriteToLogAndConsole);
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from projectile damage limit from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxProjDamage);
+ args.Player.Disable(GetString("Projectile damage is higher than {0}.", TShock.Config.Settings.MaxProjDamage), DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from projectile damage limit from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxProjDamage));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1181,7 +1181,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from disabled from {0}", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1210,7 +1210,7 @@ namespace TShockAPI
!Handlers.LandGolfBallInCupHandler.GolfBallItemIDs.Contains(args.Player.TPlayer.HeldItem.type) &&
!args.Player.RecentlyCreatedProjectiles.Any(p => p.Type == ProjectileID.GolfClubHelper))
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile please report to tshock about this! normally this is a reject from {0} {1} (golf)", args.Player.Name, type);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile please report to tshock about this! normally this is a reject from {0} {1} (golf)", args.Player.Name, type));
}
// Main.projHostile contains projectiles that can harm players
@@ -1218,7 +1218,7 @@ namespace TShockAPI
// possible for players to create. (Source: Ijwu, QuiCM)
if (Main.projHostile[type])
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from hostile projectile from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from hostile projectile from {0}", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1229,7 +1229,7 @@ namespace TShockAPI
// Death does not create a tombstone projectile by default
if (type == ProjectileID.Tombstone)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from tombstones from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from tombstones from {0}", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1249,12 +1249,12 @@ namespace TShockAPI
|| (type >= ProjectileID.MartianTurretBolt && type <= ProjectileID.RayGunnerLaser)
|| type == ProjectileID.CultistBossLightningOrb)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from weird check from {0} {1}", args.Player.Name, type);
- TShock.Log.Debug("Certain projectiles have been ignored for cheat detection.");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from weird check from {0} {1}", args.Player.Name, type));
+ TShock.Log.Debug(GetString("Certain projectiles have been ignored for cheat detection."));
}
else
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile please report to tshock about this! normally this is a reject from {0} {1}", args.Player.Name, type);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile please report to tshock about this! normally this is a reject from {0} {1}", args.Player.Name, type));
// args.Player.Disable(String.Format("Does not have projectile permission to update projectile. ({0})", type), DisableFlags.WriteToLogAndConsole);
// args.Player.RemoveProjectile(ident, owner);
}
@@ -1266,23 +1266,23 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnProjectileThresholdBroken)
{
- args.Player.Kick(string.Format("Projectile update threshold exceeded {0}.", TShock.Config.Settings.ProjectileThreshold));
+ args.Player.Kick(GetString("Projectile update threshold exceeded {0}.", TShock.Config.Settings.ProjectileThreshold));
}
else
{
- args.Player.Disable("Reached projectile update threshold.", DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Reached projectile update threshold."), DisableFlags.WriteToLogAndConsole);
args.Player.RemoveProjectile(ident, owner);
}
-
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from projectile update threshold from {0} {1}/{2}", args.Player.Name, args.Player.ProjectileThreshold, TShock.Config.Settings.ProjectileThreshold);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the projectile update threshold they were disabled for to TShock so we can improve this!");
+
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from projectile update threshold from {0} {1}/{2}", args.Player.Name, args.Player.ProjectileThreshold, TShock.Config.Settings.ProjectileThreshold));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the projectile update threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from bouncer throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from bouncer throttle from {0}", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1295,7 +1295,7 @@ namespace TShockAPI
(Projectile_MaxValuesAI2[type] < ai[1] || Projectile_MinValuesAI2[type] > ai[1]))
)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from bouncer modified AI from {0}.", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from bouncer modified AI from {0}.", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1311,7 +1311,7 @@ namespace TShockAPI
*/
if (TShock.Config.Settings.DisableModifiedZenith && type == ProjectileID.FinalFractal && (ai[0] < -100 || ai[0] > 101) && !Terraria.Graphics.FinalFractalHelper._fractalProfiles.ContainsKey((int)ai[1]))
{
- TShock.Log.ConsoleDebug("Bouncer / OnNewProjectile rejected from bouncer modified Zenith projectile from {0}.", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from bouncer modified Zenith projectile from {0}.", args.Player.Name));
args.Player.RemoveProjectile(ident, owner);
args.Handled = true;
return;
@@ -1321,7 +1321,7 @@ namespace TShockAPI
{
if (type == ProjectileID.CrystalShard && TShock.Config.Settings.ProjIgnoreShrapnel) // Ignore crystal shards
{
- TShock.Log.Debug("Ignoring shrapnel per config..");
+ TShock.Log.Debug(GetString("Ignoring shrapnel per config.."));
}
else if (!Main.projectile[index].active)
{
@@ -1362,23 +1362,23 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnDamageThresholdBroken)
{
- args.Player.Kick(string.Format("NPC damage exceeded {0}.", TShock.Config.Settings.MaxDamage));
+ args.Player.Kick(GetString("NPC damage exceeded {0}.", TShock.Config.Settings.MaxDamage));
}
else
{
- args.Player.Disable(String.Format("NPC damage exceeded {0}.", TShock.Config.Settings.MaxDamage), DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("NPC damage exceeded {0}.", TShock.Config.Settings.MaxDamage), DisableFlags.WriteToLogAndConsole);
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
}
-
- TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from damage threshold from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxDamage);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the damage threshold they were disabled for to TShock so we can improve this!");
+
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCStrike rejected from damage threshold from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxDamage));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the damage threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCStrike rejected from disabled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
args.Handled = true;
return;
@@ -1387,7 +1387,7 @@ namespace TShockAPI
if (TShock.Config.Settings.RangeChecks &&
!args.Player.IsInRange((int)(Main.npc[id].position.X / 16f), (int)(Main.npc[id].position.Y / 16f), 128))
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCStrike rejected from range checks from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
args.Handled = true;
return;
@@ -1395,7 +1395,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCStrike rejected from bouncer throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCStrike rejected from bouncer throttle from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
args.Handled = true;
return;
@@ -1409,14 +1409,14 @@ namespace TShockAPI
{
if (args.ProjectileIndex < 0)
{
- TShock.Log.ConsoleDebug("Bouncer / OnProjectileKill rejected from negative projectile index from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnProjectileKill rejected from negative projectile index from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnProjectileKill rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnProjectileKill rejected from disabled from {0}", args.Player.Name));
args.Player.RemoveProjectile(args.ProjectileIdentity, args.ProjectileOwner);
args.Handled = true;
return;
@@ -1424,7 +1424,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnProjectileKill rejected from bouncer throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnProjectileKill rejected from bouncer throttle from {0}", args.Player.Name));
args.Player.RemoveProjectile(args.ProjectileIdentity, args.ProjectileOwner);
args.Handled = true;
return;
@@ -1444,14 +1444,14 @@ namespace TShockAPI
if (args.Player.TPlayer.chest != id)
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestItemChange rejected from chest mismatch from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestItemChange rejected from chest mismatch from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestItemChange rejected from disable from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestItemChange rejected from disable from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.ChestItem, "", id, slot);
args.Handled = true;
return;
@@ -1459,14 +1459,14 @@ namespace TShockAPI
if (!args.Player.HasBuildPermission(Main.chest[id].x, Main.chest[id].y) && TShock.Config.Settings.RegionProtectChests)
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestItemChange rejected from region protection? from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestItemChange rejected from region protection? from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.IsInRange(Main.chest[id].x, Main.chest[id].y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestItemChange rejected from range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestItemChange rejected from range check from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1479,21 +1479,21 @@ namespace TShockAPI
{
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestOpen rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestOpen rejected from disabled from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.IsInRange(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestOpen rejected from range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestOpen rejected from range check from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.HasBuildPermission(args.X, args.Y) && TShock.Config.Settings.RegionProtectChests)
{
- TShock.Log.ConsoleDebug("Bouncer / OnChestOpen rejected from region check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnChestOpen rejected from region check from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1514,14 +1514,14 @@ namespace TShockAPI
if (!TShock.Utils.TilePlacementValid(tileX, tileY) || (args.Player.Dead && TShock.Config.Settings.PreventDeadModification))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from invalid check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from invalid check from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from disabled from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -1529,7 +1529,7 @@ namespace TShockAPI
if (args.Player.SelectedItem.placeStyle != style)
{
- TShock.Log.ConsoleError(string.Format("Bouncer / OnPlaceChest / rejected from invalid place style from {0}", args.Player.Name));
+ TShock.Log.ConsoleError(GetString("Bouncer / OnPlaceChest / rejected from invalid place style from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -1541,7 +1541,7 @@ namespace TShockAPI
&& Main.tile[tileX, tileY].type != TileID.Containers2
&& (!TShock.Utils.HasWorldReachedMaxChests() && Main.tile[tileX, tileY].type != TileID.Dirt)) //Chest
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from weird check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from weird check from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -1552,7 +1552,7 @@ namespace TShockAPI
if ((TShock.Utils.TilePlacementValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == TileID.Teleporter) ||
(TShock.Utils.TilePlacementValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == TileID.Teleporter))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from weird placement check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from weird placement check from {0}", args.Player.Name));
//Prevent a dresser from being placed on a teleporter, as this can cause client and server crashes.
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
@@ -1562,7 +1562,7 @@ namespace TShockAPI
if (!args.Player.HasBuildPermission(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from invalid permission from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from invalid permission from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -1570,7 +1570,7 @@ namespace TShockAPI
if (!args.Player.IsInRange(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceChest rejected from range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceChest rejected from range check from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 3);
args.Handled = true;
return;
@@ -1607,7 +1607,7 @@ namespace TShockAPI
|| (args.Zone2[4] && !hasStardustTower)
)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerZone rejected from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerZone rejected from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1621,7 +1621,7 @@ namespace TShockAPI
{
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerAnimation rejected from disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerAnimation rejected from disabled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerAnimation, "", args.Player.Index);
args.Handled = true;
return;
@@ -1629,7 +1629,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerAnimation rejected from throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerAnimation rejected from throttle from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerAnimation, "", args.Player.Index);
args.Handled = true;
return;
@@ -1648,14 +1648,14 @@ namespace TShockAPI
if (!TShock.Utils.TilePlacementValid(tileX, tileY) || (args.Player.Dead && TShock.Config.Settings.PreventDeadModification))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected invalid check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected invalid check from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected disabled from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1669,12 +1669,12 @@ namespace TShockAPI
}
else
{
- args.Player.Disable("Reached TileLiquid threshold.", DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Reached TileLiquid threshold."), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
}
-
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected from liquid threshold from {0} {1}/{2}", args.Player.Name, args.Player.TileLiquidThreshold, TShock.Config.Settings.TileLiquidThreshold);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the tile liquid threshold they were disabled for to TShock so we can improve this!");
+
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected from liquid threshold from {0} {1}/{2}", args.Player.Name, args.Player.TileLiquidThreshold, TShock.Config.Settings.TileLiquidThreshold));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the tile liquid threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
@@ -1748,9 +1748,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Lava && !(bucket == 2 || bucket == 0 || bucket == 5 || bucket == 6))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 1 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Spreading lava without holding a lava bucket", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 1 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Spreading lava without holding a lava bucket"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1758,9 +1758,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Lava && TShock.ItemBans.DataModel.ItemIsBanned("Lava Bucket", args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected lava bucket from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Using banned lava bucket without permissions", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected lava bucket from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Using banned lava bucket without permissions"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1768,9 +1768,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Water && !(bucket == 1 || bucket == 0 || bucket == 4))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 2 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Spreading water without holding a water bucket", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 2 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Spreading water without holding a water bucket"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1778,9 +1778,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Water && TShock.ItemBans.DataModel.ItemIsBanned("Water Bucket", args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 3 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Using banned water bucket without permissions", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 3 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Using banned water bucket without permissions"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1788,9 +1788,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Honey && !(bucket == 3 || bucket == 0 || bucket == 7))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 4 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Spreading honey without holding a honey bucket", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 4 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Spreading honey without holding a honey bucket"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1798,9 +1798,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Honey && TShock.ItemBans.DataModel.ItemIsBanned("Honey Bucket", args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 5 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Using banned honey bucket without permissions", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 5 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Using banned honey bucket without permissions"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1808,9 +1808,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Shimmer && bucket != 8)
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 6 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Spreading shimmer without holding a honey bucket", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 6 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Spreading shimmer without holding a honey bucket"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1819,9 +1819,9 @@ namespace TShockAPI
if (!wasThereABombNearby && type == LiquidType.Shimmer &&
TShock.ItemBans.DataModel.ItemIsBanned("Bottomless Shimmer Bucket", args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected bucket check 7 from {0}", args.Player.Name);
- args.Player.SendErrorMessage("You do not have permission to perform this action.");
- args.Player.Disable("Using banned bottomless shimmer bucket without permissions", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected bucket check 7 from {0}", args.Player.Name));
+ args.Player.SendErrorMessage(GetString("You do not have permission to perform this action."));
+ args.Player.Disable(GetString("Using banned bottomless shimmer bucket without permissions"), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1830,7 +1830,7 @@ namespace TShockAPI
if (!args.Player.HasBuildPermission(tileX, tileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected build permission from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected build permission from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1838,7 +1838,7 @@ namespace TShockAPI
if (!wasThereABombNearby && !args.Player.IsInRange(tileX, tileY, 16))
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected range checks from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1846,7 +1846,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnLiquidSet rejected throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnLiquidSet rejected throttle from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(tileX, tileY, 1);
args.Handled = true;
return;
@@ -1864,21 +1864,21 @@ namespace TShockAPI
if (id >= Main.maxPlayers)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected player cap from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected player cap from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (TShock.Players[id] == null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected null check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected null check from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (type >= Main.maxBuffTypes)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected invalid buff type {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected invalid buff type {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1886,7 +1886,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected disabled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1894,7 +1894,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected throttled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected throttled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1905,7 +1905,7 @@ namespace TShockAPI
if (!args.Player.IsInRange(targetPlayer.TileX, targetPlayer.TileY, 50))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected range check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected range check from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1913,7 +1913,7 @@ namespace TShockAPI
if (buffLimit == null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected non-whitelisted buff {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected non-whitelisted buff {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1921,7 +1921,7 @@ namespace TShockAPI
if (buffLimit.CanOnlyBeAppliedToSender && id != args.Player.Index)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected applied to non-sender from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected applied to non-sender from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1929,7 +1929,7 @@ namespace TShockAPI
if (!buffLimit.CanBeAddedWithoutHostile && !targetPlayer.TPlayer.hostile)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected hostile/pvp from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected hostile/pvp from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1937,7 +1937,7 @@ namespace TShockAPI
if (time <= 0 || time > buffLimit.MaxTicks)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerBuff rejected time too long from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerBuff rejected time too long from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
args.Handled = true;
return;
@@ -1955,7 +1955,7 @@ namespace TShockAPI
if (id >= Main.npc.Length)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCAddBuff rejected out of bounds NPC update from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected out of bounds NPC update from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -1964,14 +1964,14 @@ namespace TShockAPI
if (npc == null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCAddBuff rejected null npc from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected null npc from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCAddBuff rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected disabled from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2002,8 +2002,8 @@ namespace TShockAPI
if (detectedNPCBuffTimeCheat)
{
- TShock.Log.ConsoleDebug("Bouncer / OnNPCAddBuff rejected abnormal buff ({0}) added to {1} ({2}) from {3}.", type, npc.TypeName, npc.netID, args.Player.Name);
- args.Player.Kick($"Added buff to {npc.TypeName} NPC abnormally.", true);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnNPCAddBuff rejected abnormal buff ({0}) added to {1} ({2}) from {3}.", type, npc.TypeName, npc.netID, args.Player.Name));
+ args.Player.Kick(GetString($"Added buff to {npc.TypeName} NPC abnormally."), true);
args.Handled = true;
}
}
@@ -2021,7 +2021,7 @@ namespace TShockAPI
{
args.Player.SendData(PacketTypes.UpdateNPCHome, "", id, Main.npc[id].homeTileX, Main.npc[id].homeTileY,
Convert.ToByte(Main.npc[id].homeless));
- TShock.Log.ConsoleDebug("Bouncer / OnUpdateNPCHome rejected npc home build permission from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnUpdateNPCHome rejected npc home build permission from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2031,7 +2031,7 @@ namespace TShockAPI
{
args.Player.SendData(PacketTypes.UpdateNPCHome, "", id, Main.npc[id].homeTileX, Main.npc[id].homeTileY,
Convert.ToByte(Main.npc[id].homeless));
- TShock.Log.ConsoleDebug("Bouncer / OnUpdateNPCHome rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnUpdateNPCHome rejected range checks from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2047,7 +2047,7 @@ namespace TShockAPI
if (amount <= 0 || Main.player[plr] == null || !Main.player[plr].active)
{
- TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer rejected null checks");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnHealOtherPlayer rejected null checks"));
args.Handled = true;
return;
}
@@ -2057,8 +2057,8 @@ namespace TShockAPI
// and the healing you can do with that is 20% of your damage.
if (amount >= TShock.Config.Settings.MaxDamage * 0.2 && !args.Player.HasPermission(Permissions.ignoredamagecap))
{
- TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name);
- args.Player.Disable("HealOtherPlayer cheat attempt!", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnHealOtherPlayer 0.2 check from {0}", args.Player.Name));
+ args.Player.Disable(GetString("HealOtherPlayer cheat attempt!"), DisableFlags.WriteToLogAndConsole);
args.Handled = true;
return;
}
@@ -2067,21 +2067,21 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnHealOtherThresholdBroken)
{
- args.Player.Kick(string.Format("HealOtherPlayer threshold exceeded {0}.", TShock.Config.Settings.HealOtherThreshold));
+ args.Player.Kick(GetString("HealOtherPlayer threshold exceeded {0}.", TShock.Config.Settings.HealOtherThreshold));
}
- else
+ else
{
- args.Player.Disable("Reached HealOtherPlayer threshold.", DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Reached HealOtherPlayer threshold."), DisableFlags.WriteToLogAndConsole);
}
- TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer rejected heal other threshold from {0} {1}/{2}", args.Player.Name, args.Player.HealOtherThreshold, TShock.Config.Settings.HealOtherThreshold);
- TShock.Log.ConsoleDebug("If this player wasn't hacking, please report the HealOtherPlayer threshold they were disabled for to TShock so we can improve this!");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnHealOtherPlayer rejected heal other threshold from {0} {1}/{2}", args.Player.Name, args.Player.HealOtherThreshold, TShock.Config.Settings.HealOtherThreshold));
+ TShock.Log.ConsoleDebug(GetString("If this player wasn't hacking, please report the HealOtherPlayer threshold they were disabled for to TShock so we can improve this!"));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled() || args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnHealOtherPlayer rejected disabled/throttled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnHealOtherPlayer rejected disabled/throttled from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2102,11 +2102,11 @@ namespace TShockAPI
int y = args.Y;
short type = args.Type;
byte style = args.Style;
-
+
// if npc released outside allowed tile
if (x >= Main.maxTilesX * 16 - 16 || x < 0 || y >= Main.maxTilesY * 16 - 16 || y < 0)
{
- TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC rejected out of bounds from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnReleaseNPC rejected out of bounds from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2114,15 +2114,15 @@ namespace TShockAPI
// if player disabled
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC rejected npc release from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnReleaseNPC rejected npc release from {0}", args.Player.Name));
args.Handled = true;
return;
}
void rejectForCritterNotReleasedFromItem()
{
- TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC released different critter from {0}", args.Player.Name);
- args.Player.Kick("Released critter was not from its item.", true);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnReleaseNPC released different critter from {0}", args.Player.Name));
+ args.Player.Kick(GetString("Released critter was not from its item."), true);
args.Handled = true;
}
@@ -2165,12 +2165,12 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC rejected throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnReleaseNPC rejected throttle from {0}", args.Player.Name));
args.Handled = true;
return;
}
- }
-
+ }
+
/// Bouncer's PlaceObject hook reverts malicious tile placement.
/// The object that triggered the event.
/// The packet arguments that the event has.
@@ -2183,28 +2183,28 @@ namespace TShockAPI
if (!TShock.Utils.TilePlacementValid(x, y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected valid placements from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected valid placements from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (type < 0 || type >= Main.maxTileSets)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected out of bounds tile from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected out of bounds tile from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (x < 0 || x >= Main.maxTilesX)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected out of bounds tile x from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected out of bounds tile x from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (y < 0 || y >= Main.maxTilesY)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected out of bounds tile y from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected out of bounds tile y from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2213,7 +2213,7 @@ namespace TShockAPI
//These two items cause localised lag and rendering issues
if (type == TileID.FakeContainers && (style == 52 || style == 53))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected fake containers from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected fake containers from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2222,16 +2222,16 @@ namespace TShockAPI
// TODO: REMOVE. This does NOT look like Bouncer code.
if (TShock.TileBans.TileIsBanned(type, args.Player))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected banned tiles from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected banned tiles from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 1);
- args.Player.SendErrorMessage("You do not have permission to place this tile.");
+ args.Player.SendErrorMessage(GetString("You do not have permission to place this tile."));
args.Handled = true;
return;
}
if (args.Player.Dead && TShock.Config.Settings.PreventDeadModification)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected dead people don't do things from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected dead people don't do things from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2239,7 +2239,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected disabled from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2250,8 +2250,8 @@ namespace TShockAPI
if (type != TileID.LargePilesEcho && type != TileID.LargePiles2Echo && type != TileID.SmallPiles2x1Echo &&
type != TileID.SmallPiles1x1Echo && type != TileID.PlantDetritus3x2Echo && type != TileID.PlantDetritus2x2Echo)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected rubblemaker I can't believe it's not rubble! from {0}",
- args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected rubblemaker I can't believe it's not rubble! from {0}",
+ args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2261,7 +2261,7 @@ namespace TShockAPI
{
if (type != TileID.Saplings)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected Axe of Regrowth only places saplings {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected Axe of Regrowth only places saplings {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2274,7 +2274,7 @@ namespace TShockAPI
// without selecting the right item.
if (type != args.Player.TPlayer.inventory[args.Player.TPlayer.selectedItem].createTile)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected awkward tile creation/selection from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected awkward tile creation/selection from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2282,7 +2282,7 @@ namespace TShockAPI
if (args.Player.SelectedItem.placeStyle != style)
{
- TShock.Log.ConsoleError(string.Format("Bouncer / OnPlaceObject rejected object placement with invalid style from {0}", args.Player.Name));
+ TShock.Log.ConsoleError(GetString("Bouncer / OnPlaceObject rejected object placement with invalid style from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2292,7 +2292,7 @@ namespace TShockAPI
TileObjectData tileData = TileObjectData.GetTileData(type, style, 0);
if (tileData == null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected null tile data from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected null tile data from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2307,7 +2307,7 @@ namespace TShockAPI
if (!args.Player.HasModifiedIceSuccessfully(i, j, type, EditAction.PlaceTile)
&& !args.Player.HasBuildPermission(i, j))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected mad loop from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected mad loop from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(i, j, 4);
args.Handled = true;
return;
@@ -2323,7 +2323,7 @@ namespace TShockAPI
|| type != TileID.MysticSnakeRope)
&& !args.Player.IsInRange(x, y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected range checks from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2331,8 +2331,8 @@ namespace TShockAPI
if (args.Player.TilePlaceThreshold >= TShock.Config.Settings.TilePlaceThreshold)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceObject rejected tile place threshold from {0} {1}/{2}", args.Player.Name, args.Player.TilePlaceThreshold, TShock.Config.Settings.TilePlaceThreshold);
- args.Player.Disable("Reached TilePlace threshold.", DisableFlags.WriteToLogAndConsole);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceObject rejected tile place threshold from {0} {1}/{2}", args.Player.Name, args.Player.TilePlaceThreshold, TShock.Config.Settings.TilePlaceThreshold));
+ args.Player.Disable(GetString("Reached TilePlace threshold."), DisableFlags.WriteToLogAndConsole);
args.Player.SendTileSquareCentered(x, y, 4);
args.Handled = true;
return;
@@ -2355,28 +2355,28 @@ namespace TShockAPI
{
if (!TShock.Utils.TilePlacementValid(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected tile placement valid from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceTileEntity rejected tile placement valid from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceTileEntity rejected disabled from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.HasBuildPermission(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected permissions from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceTileEntity rejected permissions from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.IsInRange(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceTileEntity rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceTileEntity rejected range checks from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2389,14 +2389,14 @@ namespace TShockAPI
{
if (!TShock.Utils.TilePlacementValid(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected tile placement valid from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceItemFrame rejected tile placement valid from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceItemFrame rejected disabled from {0}", args.Player.Name));
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, args.ItemFrame.ID, 0, 1);
args.Handled = true;
return;
@@ -2404,7 +2404,7 @@ namespace TShockAPI
if (!args.Player.HasBuildPermission(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected permissions from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceItemFrame rejected permissions from {0}", args.Player.Name));
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, args.ItemFrame.ID, 0, 1);
args.Handled = true;
return;
@@ -2412,7 +2412,7 @@ namespace TShockAPI
if (!args.Player.IsInRange(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlaceItemFrame rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlaceItemFrame rejected range checks from {0}", args.Player.Name));
NetMessage.SendData((int)PacketTypes.UpdateTileEntity, -1, -1, NetworkText.Empty, args.ItemFrame.ID, 0, 1);
args.Handled = true;
return;
@@ -2425,9 +2425,9 @@ namespace TShockAPI
//belongs to the player who sent the packet.
if (args.Player.Index != args.TargetPlayerIndex)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerPortalTeleport rejected untargetable teleport from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected untargetable teleport from {0}", args.Player.Name));
//If the player who sent the packet is not the player being teleported, cancel this packet
- args.Player.Disable("Malicious portal attempt.", DisableFlags.WriteToLogAndConsole); //Todo: this message is not particularly clear - suggestions wanted
+ args.Player.Disable(GetString("Malicious portal attempt."), DisableFlags.WriteToLogAndConsole); //Todo: this message is not particularly clear - suggestions wanted
args.Handled = true;
return;
}
@@ -2436,7 +2436,7 @@ namespace TShockAPI
if (args.NewPosition.X > Main.maxTilesX || args.NewPosition.X < 0
|| args.NewPosition.Y > Main.maxTilesY || args.NewPosition.Y < 0)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected teleport out of bounds from {0}"), args.Player.Name);
args.Handled = true;
return;
}
@@ -2444,7 +2444,7 @@ namespace TShockAPI
//May as well reject teleport attempts if the player is being throttled
if (args.Player.IsBeingDisabled() || args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerPortalTeleport rejected disabled/throttled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerPortalTeleport rejected disabled/throttled from {0}"), args.Player.Name);
args.Handled = true;
return;
}
@@ -2457,21 +2457,21 @@ namespace TShockAPI
{
if (args.X < 0 || args.Y < 0 || args.X >= Main.maxTilesX || args.Y >= Main.maxTilesY)
{
- TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle rejected boundaries check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGemLockToggle rejected boundaries check from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!TShock.Utils.TilePlacementValid(args.X, args.Y) || (args.Player.Dead && TShock.Config.Settings.PreventDeadModification))
{
- TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle invalid placement/deadmod from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGemLockToggle invalid placement/deadmod from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGemLockToggle rejected disabled from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2480,7 +2480,7 @@ namespace TShockAPI
{
if (!args.Player.HasBuildPermission(args.X, args.Y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnGemLockToggle rejected permissions check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnGemLockToggle rejected permissions check from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2515,21 +2515,21 @@ namespace TShockAPI
if (!TShock.Utils.TilePlacementValid(x, y) || (args.Player.Dead && TShock.Config.Settings.PreventDeadModification))
{
- TShock.Log.ConsoleDebug("Bouncer / OnMassWireOperation rejected valid placement from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnMassWireOperation rejected valid placement from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnMassWireOperation rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnMassWireOperation rejected disabled from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.HasBuildPermission(x, y))
{
- TShock.Log.ConsoleDebug("Bouncer / OnMassWireOperation rejected build perms from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnMassWireOperation rejected build perms from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2550,7 +2550,7 @@ namespace TShockAPI
if (id >= Main.maxPlayers || TShock.Players[id] == null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected null check");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected null check"));
args.Handled = true;
return;
}
@@ -2559,15 +2559,15 @@ namespace TShockAPI
{
if (TShock.Config.Settings.KickOnDamageThresholdBroken)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected damage threshold from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxDamage);
- args.Player.Kick(string.Format("Player damage exceeded {0}.", TShock.Config.Settings.MaxDamage));
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected damage threshold from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxDamage));
+ args.Player.Kick(GetString("Player damage exceeded {0}.", TShock.Config.Settings.MaxDamage));
args.Handled = true;
return;
}
else
{
TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected damage threshold2 from {0} {1}/{2}", args.Player.Name, damage, TShock.Config.Settings.MaxDamage);
- args.Player.Disable(String.Format("Player damage exceeded {0}.", TShock.Config.Settings.MaxDamage), DisableFlags.WriteToLogAndConsole);
+ args.Player.Disable(GetString("Player damage exceeded {0}.", TShock.Config.Settings.MaxDamage), DisableFlags.WriteToLogAndConsole);
}
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
@@ -2577,7 +2577,7 @@ namespace TShockAPI
if (!TShock.Players[id].TPlayer.hostile && pvp && id != args.Player.Index)
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected hostile from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected hostile from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
args.Handled = true;
@@ -2586,7 +2586,7 @@ namespace TShockAPI
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected disabled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
args.Handled = true;
@@ -2595,7 +2595,7 @@ namespace TShockAPI
if (!args.Player.IsInRange(TShock.Players[id].TileX, TShock.Players[id].TileY, 100))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected range checks from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
args.Handled = true;
@@ -2604,7 +2604,7 @@ namespace TShockAPI
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected throttled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected throttled from {0}", args.Player.Name));
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
args.Handled = true;
@@ -2612,18 +2612,18 @@ namespace TShockAPI
}
/*
- * PlayerDeathReason does not initially contain any information, so all fields have values -1 or null.
+ * PlayerDeathReason does not initially contain any information, so all fields have values -1 or null.
* We can use this to determine the real cause of death.
- *
+ *
* If the player was not specified, that is, the player index is -1, then it is definitely a custom cause, as you can only deal damage with a projectile or another player.
* This is how everything else works. If an NPC is specified, its value is not -1, which is a custom cause.
- *
+ *
* Checking whether this damage came from the player is necessary, because the damage from the player can come even when it is hit by a NPC
*/
- if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index &&
+ if (TShock.Config.Settings.DisableCustomDeathMessages && id != args.Player.Index &&
(reason._sourcePlayerIndex == -1 || reason._sourceNPCIndex != -1 || reason._sourceOtherIndex != -1 || reason._sourceCustomReason != null))
{
- TShock.Log.ConsoleDebug("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnPlayerDamage rejected custom death message from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2640,16 +2640,16 @@ namespace TShockAPI
if (damage > 42000) //Abnormal values have the potential to cause infinite loops in the server.
{
- TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected high damage from {0} {1}", args.Player.Name, damage);
- args.Player.Kick("Failed to shade polygon normals.", true, true);
- TShock.Log.ConsoleError("Death Exploit Attempt: Damage {0}", damage);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnKillMe rejected high damage from {0} {1}", args.Player.Name, damage));
+ args.Player.Kick(GetString("Failed to shade polygon normals."), true, true);
+ TShock.Log.ConsoleError(GetString("Death Exploit Attempt: Damage {0}", damage));
args.Handled = true;
return;
}
if (id >= Main.maxPlayers)
{
- TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected index check from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnKillMe rejected index check from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2659,14 +2659,14 @@ namespace TShockAPI
{
if (playerDeathReason.GetDeathText(TShock.Players[id].Name).ToString().Length > 500)
{
- TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected bad length death text from {0}", args.Player.Name);
- TShock.Players[id].Kick("Death reason outside of normal bounds.", true);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnKillMe rejected bad length death text from {0}", args.Player.Name));
+ TShock.Players[id].Kick(GetString("Death reason outside of normal bounds."), true);
args.Handled = true;
return;
}
if (TShock.Config.Settings.DisableCustomDeathMessages && playerDeathReason._sourceCustomReason != null)
{
- TShock.Log.ConsoleDebug("Bouncer / OnKillMe rejected custom death message from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnKillMe rejected custom death message from {0}", args.Player.Name));
args.Handled = true;
return;
}
@@ -2685,31 +2685,31 @@ namespace TShockAPI
if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for not using a fishing rod! - From {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected for not using a fishing rod! - From {0}", args.Player.Name));
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.
{
- TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for not finding active bobber projectile! - From {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected for not finding active bobber projectile! - From {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!FishableNpcIDs.Contains(args.NpcID))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected for the NPC not being on the fishable NPCs list! - From {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected for the NPC not being on the fishable NPCs list! - From {0}", args.Player.Name));
args.Handled = true;
return;
}
if (args.NpcID == NPCID.DukeFishron && !args.Player.HasPermission(Permissions.summonboss))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected summon boss permissions from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected summon boss permissions from {0}", args.Player.Name));
args.Handled = true;
return;
}
if (!args.Player.IsInRange(args.TileX, args.TileY, 55))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFishOutNPC rejected range checks from {0}", args.Player.Name));
args.Handled = true;
}
}
@@ -2723,21 +2723,21 @@ namespace TShockAPI
{
if (!TShock.Utils.TilePlacementValid(args.TileX, args.TileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected tile placement valid from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFoodPlatterTryPlacing rejected tile placement valid from {0}", args.Player.Name));
args.Handled = true;
return;
}
if ((args.Player.SelectedItem.type != args.ItemID && args.Player.ItemInHand.type != args.ItemID))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected item not placed by hand from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFoodPlatterTryPlacing rejected item not placed by hand from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(args.TileX, args.TileY, 1);
args.Handled = true;
return;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFoodPlatterTryPlacing rejected disabled from {0}", args.Player.Name));
Item item = new Item();
item.netDefaults(args.ItemID);
args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix);
@@ -2748,7 +2748,7 @@ namespace TShockAPI
if (!args.Player.HasBuildPermission(args.TileX, args.TileY))
{
- TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected permissions from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFoodPlatterTryPlacing rejected permissions from {0}", args.Player.Name));
Item item = new Item();
item.netDefaults(args.ItemID);
args.Player.GiveItemCheck(args.ItemID, item.Name, args.Stack, args.Prefix);
@@ -2759,7 +2759,7 @@ namespace TShockAPI
if (!args.Player.IsInRange(args.TileX, args.TileY, range: 13)) // To my knowledge, max legit tile reach with accessories.
{
- TShock.Log.ConsoleDebug("Bouncer / OnFoodPlatterTryPlacing rejected range checks from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString("Bouncer / OnFoodPlatterTryPlacing rejected range checks from {0}", args.Player.Name));
args.Player.SendTileSquareCentered(args.TileX, args.TileY, 1);
args.Handled = true;
return;
diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs
index 220d778e..42892100 100644
--- a/TShockAPI/DB/BanManager.cs
+++ b/TShockAPI/DB/BanManager.cs
@@ -78,8 +78,8 @@ namespace TShockAPI.DB
}
catch (DllNotFoundException)
{
- System.Console.WriteLine("Possible problem with your database - is Sqlite3.dll present?");
- throw new Exception("Could not find a database library (probably Sqlite3.dll)");
+ System.Console.WriteLine(GetString("Possible problem with your database - is Sqlite3.dll present?"));
+ throw new Exception(GetString("Could not find a database library (probably Sqlite3.dll)"));
}
EnsureBansCollection();
@@ -205,12 +205,12 @@ namespace TShockAPI.DB
{
if (ban.ExpirationDateTime == DateTime.MaxValue)
{
- player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason}");
+ player.Disconnect(GetParticularString("{0} is ban number, {1} is ban reason", $"#{ban.TicketNumber} - You are banned: {ban.Reason}"));
return true;
}
TimeSpan ts = ban.ExpirationDateTime - DateTime.UtcNow;
- player.Disconnect($"#{ban.TicketNumber} - You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)");
+ player.Disconnect(GetParticularString("{0} is ban number, {1} is ban reason, {2} is a timestamp", $"#{ban.TicketNumber} - You are banned: {ban.Reason} ({ban.GetPrettyExpirationString()} remaining)"));
return true;
}
@@ -255,7 +255,7 @@ namespace TShockAPI.DB
//E.g., if a previous ban has expired, a new ban is valid.
//However, if a previous ban on the provided identifier is still in effect, a new ban is not valid
args.Valid = !Bans.Any(b => b.Value.Identifier == args.Identifier && b.Value.ExpirationDateTime > DateTime.UtcNow);
- args.Message = args.Valid ? null : "a current ban for this identifier already exists.";
+ args.Message = args.Valid ? null : GetString("The ban is invalid because a current ban for this identifier already exists.");
}
}
@@ -292,7 +292,7 @@ namespace TShockAPI.DB
if (!args.Valid)
{
- string message = $"Ban was not valid: {(args.Message ?? "no further information provided.")}";
+ string message = args.Message ?? GetString("The ban was not valid for an unknown reason.");
return new AddBanResult { Message = message };
}
@@ -311,7 +311,7 @@ namespace TShockAPI.DB
if (ticketId == 0)
{
- return new AddBanResult { Message = "Database insert failed." };
+ return new AddBanResult { Message = GetString("Inserting the ban into the database failed.") };
}
Ban b = new Ban(ticketId, args.Identifier, args.Reason, args.BanningUser, args.BanDateTime, args.ExpirationDateTime);
@@ -633,19 +633,19 @@ namespace TShockAPI.DB
///
/// IP identifier
///
- public static Identifier IP = Register("ip:", $"An identifier for an IP Address in octet format. Eg., '{"127.0.0.1".Color(Utils.RedHighlight)}'.");
+ public static Identifier IP = Register("ip:", GetString($"An identifier for an IP Address in octet format. e.g., '{"127.0.0.1".Color(Utils.RedHighlight)}'."));
///
/// UUID identifier
///
- public static Identifier UUID = Register("uuid:", "An identifier for a UUID.");
+ public static Identifier UUID = Register("uuid:", GetString("An identifier for a UUID."));
///
/// Player name identifier
///
- public static Identifier Name = Register("name:", "An identifier for a character name.");
+ public static Identifier Name = Register("name:", GetString("An identifier for a character name."));
///
/// User account identifier
///
- public static Identifier Account = Register("acc:", "An identifier for a TShock User Account name.");
+ public static Identifier Account = Register("acc:", GetString("An identifier for a TShock User Account name."));
private Identifier(string prefix, string description)
{
diff --git a/TShockAPI/DB/CharacterManager.cs b/TShockAPI/DB/CharacterManager.cs
index c351cdd1..4e2e07d1 100644
--- a/TShockAPI/DB/CharacterManager.cs
+++ b/TShockAPI/DB/CharacterManager.cs
@@ -171,7 +171,7 @@ namespace TShockAPI.DB
if (player.HasPermission(Permissions.bypassssc) && !fromCommand)
{
- TShock.Log.ConsoleInfo("Skipping SSC save (due to tshock.ignore.ssc) for " + player.Account.Name);
+ TShock.Log.ConsoleInfo(GetParticularString("{0} is a player name", $"Skipping SSC save (due to tshock.ignore.ssc) for {player.Account.Name}"));
return false;
}
@@ -241,7 +241,7 @@ namespace TShockAPI.DB
if (player.HasPermission(Permissions.bypassssc))
{
- TShock.Log.ConsoleInfo("Skipping SSC save (due to tshock.ignore.ssc) for " + player.Account.Name);
+ TShock.Log.ConsoleInfo(GetParticularString("{0} is a player name", "Skipping SSC save (due to tshock.ignore.ssc) for {player.Account.Name}"));
return true;
}
diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs
index 750dc7a2..8e0e3192 100644
--- a/TShockAPI/DB/GroupManager.cs
+++ b/TShockAPI/DB/GroupManager.cs
@@ -208,14 +208,14 @@ namespace TShockAPI.DB
{
if (!GroupExists(TShock.Config.Settings.DefaultGuestGroupName))
{
- TShock.Log.ConsoleError("The guest group could not be found. This may indicate a typo in the configuration file, or that the group was renamed or deleted.");
- throw new Exception("The guest group could not be found.");
+ TShock.Log.ConsoleError(GetString("The guest group could not be found. This may indicate a typo in the configuration file, or that the group was renamed or deleted."));
+ throw new Exception(GetString("The guest group could not be found."));
}
if (!GroupExists(TShock.Config.Settings.DefaultRegistrationGroupName))
{
- TShock.Log.ConsoleError("The default usergroup could not be found. This may indicate a typo in the configuration file, or that the group was renamed or deleted.");
- throw new Exception("The default usergroup could not be found.");
+ TShock.Log.ConsoleError(GetString("The default usergroup could not be found. This may indicate a typo in the configuration file, or that the group was renamed or deleted."));
+ throw new Exception(GetString("The default usergroup could not be found."));
}
}
@@ -232,9 +232,9 @@ namespace TShockAPI.DB
if (group == null)
{
if (kick)
- player.Disconnect("Your account's group could not be loaded. Please contact server administrators about this.");
+ player.Disconnect(GetString("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.");
+ player.SendErrorMessage(GetString("Your account's group could not be loaded. Please contact server administrators about this."));
return false;
}
@@ -306,7 +306,7 @@ namespace TShockAPI.DB
var parent = groups.FirstOrDefault(gp => gp.Name == parentname);
if (parent == null || name == parentname)
{
- var error = "Invalid parent {0} for group {1}".SFormat(parentname, group.Name);
+ var error = GetString($"Invalid parent group {parentname} for group {group.Name}");
TShock.Log.ConsoleError(error);
throw new GroupManagerException(error);
}
@@ -321,7 +321,7 @@ namespace TShockAPI.DB
groups.Add(group);
}
else
- throw new GroupManagerException("Failed to add group '" + name + ".'");
+ throw new GroupManagerException(GetString($"Failed to add group {name}."));
}
///
@@ -344,7 +344,7 @@ namespace TShockAPI.DB
{
parent = GetGroupByName(parentname);
if (parent == null || parent == group)
- throw new GroupManagerException("Invalid parent \"{0}\" for group \"{1}\".".SFormat(parentname, name));
+ throw new GroupManagerException(GetString($"Invalid parent group {parentname} for group {name}."));
// Check if the new parent would cause loops.
List groupChain = new List { group, parent };
@@ -353,7 +353,7 @@ namespace TShockAPI.DB
{
if (groupChain.Contains(checkingGroup))
throw new GroupManagerException(
- string.Format("Invalid parent \"{0}\" for group \"{1}\" would cause loops in the parent chain.", parentname, name));
+ GetString($"Parenting group {group} to {parentname} would cause loops in the parent chain."));
groupChain.Add(checkingGroup);
checkingGroup = checkingGroup.Parent;
@@ -366,7 +366,7 @@ namespace TShockAPI.DB
newGroup.Suffix = suffix;
string query = "UPDATE GroupList SET Parent=@0, Commands=@1, ChatColor=@2, Suffix=@3, Prefix=@4 WHERE GroupName=@5";
if (database.Query(query, parentname, newGroup.Permissions, newGroup.ChatColor, suffix, prefix, name) != 1)
- throw new GroupManagerException(string.Format("Failed to update group \"{0}\".", name));
+ throw new GroupManagerException(GetString($"Failed to update group \"{name}\"."));
group.ChatColor = chatcolor;
group.Permissions = permissions;
@@ -417,7 +417,7 @@ namespace TShockAPI.DB
groups.Remove(oldGroup);
groups.Add(newGroup);
- // We need to check if the old group has been referenced as a parent and update those references accordingly
+ // We need to check if the old group has been referenced as a parent and update those references accordingly
using (var command = db.CreateCommand())
{
command.CommandText = "UPDATE GroupList SET Parent = @0 WHERE Parent = @1";
@@ -460,24 +460,24 @@ namespace TShockAPI.DB
}
transaction.Commit();
- return $"Group \"{name}\" has been renamed to \"{newName}\".";
+ return GetString($"Group {name} has been renamed to {newName}.");
}
catch (Exception ex)
{
- TShock.Log.Error($"An exception has occurred during database transaction: {ex.Message}");
+ TShock.Log.Error(GetString($"An exception has occurred during database transaction: {ex.Message}"));
try
{
transaction.Rollback();
}
catch (Exception rollbackEx)
{
- TShock.Log.Error($"An exception has occurred during database rollback: {rollbackEx.Message}");
+ TShock.Log.Error(GetString($"An exception has occurred during database rollback: {rollbackEx.Message}"));
}
}
}
}
- throw new GroupManagerException($"Failed to rename group \"{name}\".");
+ throw new GroupManagerException(GetString($"Failed to rename group {name}."));
}
///
@@ -492,25 +492,25 @@ namespace TShockAPI.DB
{
if (exceptions)
throw new GroupNotExistException(name);
- return "Error: Group doesn't exist.";
+ return GetString($"Group {name} doesn't exist.");
}
if (name == Group.DefaultGroup.Name)
{
if (exceptions)
- throw new GroupManagerException("Unable to remove default guest group.");
- return "Error: Unable to remove the default guest group.";
+ throw new GroupManagerException(GetString("You can't remove the default guest group."));
+ return GetString("You can't remove the default guest group.");
}
if (database.Query("DELETE FROM GroupList WHERE GroupName=@0", name) == 1)
{
groups.Remove(TShock.Groups.GetGroupByName(name));
- return "Group " + name + " has been deleted successfully.";
+ return GetString($"Group {name} has been deleted successfully.");
}
if (exceptions)
- throw new GroupManagerException("Failed to delete group '" + name + ".'");
- return "Failed to delete group '" + name + ".'";
+ throw new GroupManagerException(GetString($"Failed to delete group {name}."));
+ return GetString($"Failed to delete group {name}.");
}
///
@@ -522,7 +522,7 @@ namespace TShockAPI.DB
public String AddPermissions(String name, List permissions)
{
if (!GroupExists(name))
- return "Error: Group doesn't exist.";
+ return GetString($"Group {name} doesn't exist.");
var group = TShock.Groups.GetGroupByName(name);
var oldperms = group.Permissions; // Store old permissions in case of error
@@ -545,7 +545,7 @@ namespace TShockAPI.DB
public String DeletePermissions(String name, List permissions)
{
if (!GroupExists(name))
- return "Error: Group doesn't exist.";
+ return GetString($"Group {name} doesn't exist.");
var group = TShock.Groups.GetGroupByName(name);
var oldperms = group.Permissions; // Store old permissions in case of error
@@ -575,7 +575,7 @@ namespace TShockAPI.DB
string groupName = reader.Get("GroupName");
if (groupName == "superadmin")
{
- TShock.Log.ConsoleInfo("WARNING: Group \"superadmin\" is defined in the database even though it's a reserved group name.");
+ TShock.Log.ConsoleWarn(GetString("Group \"superadmin\" is defined in the database even though it's a reserved group name."));
continue;
}
@@ -592,7 +592,7 @@ namespace TShockAPI.DB
catch (ArgumentException)
{
// Just in case somebody messed with the unique primary key.
- TShock.Log.ConsoleError("ERROR: Group name \"{0}\" occurs more than once. Keeping current group settings.");
+ TShock.Log.ConsoleError(GetString($"The group {groupName} appeared more than once. Keeping current group settings."));
return;
}
}
@@ -628,14 +628,13 @@ namespace TShockAPI.DB
if (group.Parent == null)
{
TShock.Log.ConsoleError(
- "ERROR: Group \"{0}\" is referencing non existent parent group \"{1}\", parent reference was removed.",
- group.Name, parentGroupName);
+ GetString($"Group {group.Name} is referencing a non existent parent group {parentGroupName}, parent reference was removed."));
}
else
{
if (group.Parent == group)
- TShock.Log.ConsoleInfo(
- "WARNING: Group \"{0}\" is referencing itself as parent group, parent reference was removed.", group.Name);
+ TShock.Log.ConsoleWarn(
+ GetString($"Group {group.Name} is referencing itself as parent group; parent reference was removed."));
List groupChain = new List { group };
Group checkingGroup = group;
@@ -644,8 +643,7 @@ namespace TShockAPI.DB
if (groupChain.Contains(checkingGroup.Parent))
{
TShock.Log.ConsoleError(
- "ERROR: Group \"{0}\" is referencing parent group \"{1}\" which is already part of the parent chain. Parent reference removed.",
- checkingGroup.Name, checkingGroup.Parent.Name);
+ GetString($"Group \"{checkingGroup.Name}\" is referencing parent group {checkingGroup.Parent.Name} which is already part of the parent chain. Parent reference removed."));
checkingGroup.Parent = null;
break;
@@ -664,7 +662,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- TShock.Log.ConsoleError("Error on reloading groups: " + ex);
+ TShock.Log.ConsoleError(GetString($"Error on reloading groups: {ex}"));
}
}
}
@@ -707,7 +705,7 @@ namespace TShockAPI.DB
///
/// The group name.
public GroupExistsException(string name)
- : base("Group '" + name + "' already exists")
+ : base(GetString($"Group {name} already exists"))
{
}
}
@@ -724,7 +722,7 @@ namespace TShockAPI.DB
///
/// The group name.
public GroupNotExistException(string name)
- : base("Group '" + name + "' does not exist")
+ : base(GetString($"Group {name} does not exist"))
{
}
}
diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs
index 03f67202..c2be131d 100644
--- a/TShockAPI/DB/IQueryBuilder.cs
+++ b/TShockAPI/DB/IQueryBuilder.cs
@@ -316,8 +316,7 @@ namespace TShockAPI.DB
{
if (x.DefaultCurrentTimestamp && x.Type != MySqlDbType.DateTime)
{
- throw new SqlColumnException("Can't set to true SqlColumn.DefaultCurrentTimestamp " +
- "when the MySqlDbType is not DateTime");
+ throw new SqlColumnException(GetString("Can't set to true SqlColumn.DefaultCurrentTimestamp when the MySqlDbType is not DateTime"));
}
});
}
@@ -343,7 +342,7 @@ namespace TShockAPI.DB
public string UpdateValue(string table, List values, List wheres)
{
if (0 == values.Count)
- throw new ArgumentException("No values supplied");
+ throw new ArgumentException(GetString("No values supplied"));
return "UPDATE {0} SET {1} {2}".SFormat(EscapeTableName(table), string.Join(", ", values.Select(v => v.Name + " = " + v.Value)), BuildWhere(wheres));
}
diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs
index eb9314cd..0e6cabe0 100644
--- a/TShockAPI/DB/ProjectileManager.cs
+++ b/TShockAPI/DB/ProjectileManager.cs
@@ -220,7 +220,7 @@ namespace TShockAPI.DB
}
if (traversed.Contains(cur))
{
- throw new InvalidOperationException("Infinite group parenting ({0})".SFormat(cur.Name));
+ throw new InvalidOperationException(GetString($"Infinite group parenting ({cur.Name})"));
}
traversed.Add(cur);
cur = cur.Parent;
@@ -255,4 +255,4 @@ namespace TShockAPI.DB
return ID + (AllowedGroups.Count > 0 ? " (" + String.Join(",", AllowedGroups) + ")" : "");
}
}
-}
\ No newline at end of file
+}
diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs
index 60ff0ed5..1a284ff3 100644
--- a/TShockAPI/DB/RegionManager.cs
+++ b/TShockAPI/DB/RegionManager.cs
@@ -99,13 +99,13 @@ namespace TShockAPI.DB
if (Int32.TryParse(splitids[i], out userid)) // if unparsable, it's not an int, so silently skip
r.AllowedIDs.Add(userid);
else
- TShock.Log.Warn("One of your UserIDs is not a usable integer: " + splitids[i]);
+ TShock.Log.Warn(GetString($"One of your UserIDs is not a usable integer: {splitids[i]}"));
}
}
catch (Exception e)
{
- TShock.Log.Error("Your database contains invalid UserIDs (they should be ints).");
- TShock.Log.Error("A lot of things will fail because of this. You must manually delete and re-create the allowed field.");
+ TShock.Log.Error(GetString("Your database contains invalid UserIDs (they should be integers)."));
+ TShock.Log.Error(GetString("A lot of things will fail because of this. You must manually delete and re-create the allowed field."));
TShock.Log.Error(e.ToString());
TShock.Log.Error(e.StackTrace);
}
@@ -283,7 +283,7 @@ namespace TShockAPI.DB
if (region.InArea(x, y))
{
if (top == null || region.Z > top.Z)
- top = region;
+ top = region;
}
}
return top == null || top.HasPermissionToBuildInRegion(ply);
@@ -313,7 +313,7 @@ namespace TShockAPI.DB
}
///
- /// Checks if any regions exist at the given (x, y) coordinate
+ /// Checks if any regions exist at the given (x, y) coordinate
/// and returns an IEnumerable containing their IDs
///
/// X coordinate
@@ -390,7 +390,7 @@ namespace TShockAPI.DB
default:
return false;
}
-
+
foreach (var region in Regions.Where(r => r.Name == regionName))
region.Area = new Rectangle(X, Y, width, height);
int q = database.Query("UPDATE Regions SET X1 = @0, Y1 = @1, width = @2, height = @3 WHERE RegionName = @4 AND WorldID=@5", X, Y, width,
@@ -404,7 +404,7 @@ namespace TShockAPI.DB
}
return false;
}
-
+
///
/// Renames a region
///
@@ -438,7 +438,7 @@ namespace TShockAPI.DB
return result;
}
-
+
///
/// Removes an allowed user from a region
///
@@ -769,7 +769,7 @@ namespace TShockAPI.DB
*/
return x >= Area.X && x <= Area.X + Area.Width && y >= Area.Y && y <= Area.Y + Area.Height;
}
-
+
///
/// Checks if a given player has permission to build in the region
///
@@ -785,7 +785,7 @@ namespace TShockAPI.DB
{
if (!ply.HasBeenNaggedAboutLoggingIn)
{
- ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red);
+ ply.SendMessage(GetString("You must be logged in to take advantage of protected regions."), Color.Red);
ply.HasBeenNaggedAboutLoggingIn = true;
}
return false;
diff --git a/TShockAPI/DB/ResearchDatastore.cs b/TShockAPI/DB/ResearchDatastore.cs
index cb7d933c..0d2429d7 100644
--- a/TShockAPI/DB/ResearchDatastore.cs
+++ b/TShockAPI/DB/ResearchDatastore.cs
@@ -50,8 +50,8 @@ namespace TShockAPI.DB
}
catch (DllNotFoundException)
{
- Console.WriteLine("Possible problem with your database - is Sqlite3.dll present?");
- throw new Exception("Could not find a database library (probably Sqlite3.dll)");
+ TShock.Log.ConsoleWarn(GetString("Possible problem with your database - is Sqlite3.dll present?"));
+ throw new Exception(GetString("Could not find a database library (probably Sqlite3.dll)"));
}
}
@@ -84,7 +84,7 @@ namespace TShockAPI.DB
where WorldId = @0
group by itemId";
- try {
+ try {
using (var reader = database.QueryReader(sql, Main.worldID))
{
while (reader.Read())
diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs
index 586d4f47..bd918e73 100644
--- a/TShockAPI/DB/TileManager.cs
+++ b/TShockAPI/DB/TileManager.cs
@@ -220,7 +220,7 @@ namespace TShockAPI.DB
}
if (traversed.Contains(cur))
{
- throw new InvalidOperationException("Infinite group parenting ({0})".SFormat(cur.Name));
+ throw new InvalidOperationException(GetString($"Infinite group parenting ({cur.Name})"));
}
traversed.Add(cur);
cur = cur.Parent;
@@ -255,4 +255,4 @@ namespace TShockAPI.DB
return ID + (AllowedGroups.Count > 0 ? " (" + String.Join(",", AllowedGroups) + ")" : "");
}
}
-}
\ No newline at end of file
+}
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index e2af578b..0354989e 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -78,7 +78,7 @@ namespace TShockAPI.DB
// Detect duplicate user using a regexp as Sqlite doesn't have well structured exceptions
if (Regex.IsMatch(ex.Message, "Username.*not unique|UNIQUE constraint failed: Users\\.Username"))
throw new UserAccountExistsException(account.Name);
- throw new UserAccountManagerException("AddUser SQL returned an error (" + ex.Message + ")", ex);
+ throw new UserAccountManagerException(GetString($"AddUser SQL returned an error ({ex.Message})"), ex);
}
if (1 > ret)
@@ -109,7 +109,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("RemoveUser SQL returned an error", ex);
+ throw new UserAccountManagerException(GetString("RemoveUser SQL returned an error"), ex);
}
}
@@ -131,7 +131,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("SetUserPassword SQL returned an error", ex);
+ throw new UserAccountManagerException(GetString("SetUserPassword SQL returned an error"), ex);
}
}
@@ -151,7 +151,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("SetUserUUID SQL returned an error", ex);
+ throw new UserAccountManagerException(GetString("SetUserUUID SQL returned an error"), ex);
}
}
@@ -168,7 +168,7 @@ namespace TShockAPI.DB
if (_database.Query("UPDATE Users SET UserGroup = @0 WHERE Username = @1;", group, account.Name) == 0)
throw new UserAccountNotExistException(account.Name);
-
+
try
{
// Update player group reference for any logged in player
@@ -179,7 +179,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("SetUserGroup SQL returned an error", ex);
+ throw new UserAccountManagerException(GetString("SetUserGroup SQL returned an error"), ex);
}
}
@@ -194,7 +194,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("UpdateLogin SQL returned an error", ex);
+ throw new UserAccountManagerException(GetString("UpdateLogin SQL returned an error"), ex);
}
}
@@ -215,7 +215,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- TShock.Log.ConsoleError("FetchHashedPasswordAndGroup SQL returned an error: " + ex);
+ TShock.Log.ConsoleError(GetString($"FetchHashedPasswordAndGroup SQL returned an error: {ex}"));
}
return -1;
}
@@ -288,10 +288,10 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new UserAccountManagerException("GetUser SQL returned an error (" + ex.Message + ")", ex);
+ throw new UserAccountManagerException(GetString($"GetUser SQL returned an error {ex.Message}"), ex);
}
if (multiple)
- throw new UserAccountManagerException(String.Format("Multiple user accounts found for {0} '{1}'", type, arg));
+ throw new UserAccountManagerException(GetString($"Multiple user accounts found for {type} '{arg}'"));
throw new UserAccountNotExistException(account.Name);
}
@@ -447,7 +447,7 @@ namespace TShockAPI.DB
}
catch (SaltParseException)
{
- TShock.Log.ConsoleError("Error: Unable to verify the password hash for user {0} ({1})", Name, ID);
+ TShock.Log.ConsoleError(GetString($"Unable to verify the password hash for user {Name} ({ID})"));
return false;
}
return false;
@@ -465,7 +465,7 @@ namespace TShockAPI.DB
}
catch (FormatException)
{
- TShock.Log.ConsoleError("Warning: Not upgrading work factor because bcrypt hash in an invalid format.");
+ TShock.Log.ConsoleWarn(GetString("Not upgrading work factor because bcrypt hash in an invalid format."));
return;
}
@@ -488,7 +488,8 @@ namespace TShockAPI.DB
{
if (password.Trim().Length < Math.Max(4, TShock.Config.Settings.MinimumPasswordLength))
{
- throw new ArgumentOutOfRangeException("password", "Password must be > " + TShock.Config.Settings.MinimumPasswordLength + " characters.");
+ int minLength = TShock.Config.Settings.MinimumPasswordLength;
+ throw new ArgumentOutOfRangeException("password", GetString($"Password must be at least {minLength} characters."));
}
try
{
@@ -496,7 +497,7 @@ namespace TShockAPI.DB
}
catch (ArgumentOutOfRangeException)
{
- TShock.Log.ConsoleError("Invalid BCrypt work factor in config file! Creating new hash using default work factor.");
+ TShock.Log.ConsoleError(GetString("Invalid BCrypt work factor in config file! Creating new hash using default work factor."));
Password = BCrypt.Net.BCrypt.HashPassword(password.Trim());
}
}
@@ -508,7 +509,8 @@ namespace TShockAPI.DB
{
if (password.Trim().Length < Math.Max(4, TShock.Config.Settings.MinimumPasswordLength))
{
- throw new ArgumentOutOfRangeException("password", "Password must be > " + TShock.Config.Settings.MinimumPasswordLength + " characters.");
+ int minLength = TShock.Config.Settings.MinimumPasswordLength;
+ throw new ArgumentOutOfRangeException("password", GetString($"Password must be at least {minLength} characters."));
}
Password = BCrypt.Net.BCrypt.HashPassword(password.Trim(), workFactor);
}
@@ -607,7 +609,7 @@ namespace TShockAPI.DB
/// The name of the user account that already exists.
/// A UserAccountExistsException object with the user's name passed in the message.
public UserAccountExistsException(string name)
- : base("User account '" + name + "' already exists")
+ : base(GetString($"User account {name} already exists"))
{
}
}
@@ -620,7 +622,7 @@ namespace TShockAPI.DB
/// The user account name to be pasesd in the message.
/// A new UserAccountNotExistException object with a message containing the user account name that does not exist.
public UserAccountNotExistException(string name)
- : base("User account '" + name + "' does not exist")
+ : base(GetString($"User account {name} does not exist"))
{
}
}
@@ -633,7 +635,7 @@ namespace TShockAPI.DB
/// The group name.
/// A new GroupNotExistsException with the group that does not exist's name in the message.
public GroupNotExistsException(string group)
- : base("Group '" + group + "' does not exist")
+ : base(GetString($"Group {group} does not exist"))
{
}
}
diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs
index 5785becb..b5a2c618 100644
--- a/TShockAPI/Extensions/DbExt.cs
+++ b/TShockAPI/Extensions/DbExt.cs
@@ -76,7 +76,7 @@ namespace TShockAPI.DB
}
catch (Exception ex)
{
- throw new Exception("Fatal TShock initialization exception: failed to connect to MySQL database. See inner exception for details.", ex);
+ throw new Exception(GetString("Fatal TShock initialization exception: failed to connect to MySQL database. See inner exception for details."), ex);
}
}
@@ -251,7 +251,7 @@ namespace TShockAPI.DB
if (typeof(T) != (t = reader.GetFieldType(column)))
{
string columnName = reader.GetName(column);
- throw new InvalidCastException($"Received type '{typeof(T).Name}', however column '{columnName}' expects type '{t.Name}'");
+ throw new InvalidCastException(GetString($"Received type '{typeof(T).Name}', however column '{columnName}' expects type '{t.Name}'"));
}
if (reader.IsDBNull(column))
diff --git a/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs b/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
index 71cdc2eb..156cc7fb 100644
--- a/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
+++ b/TShockAPI/Handlers/DisplayDollItemSyncHandler.cs
@@ -18,7 +18,7 @@ namespace TShockAPI.Handlers
/// 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("You do not have permission to modify a Mannequin in a protected area!");
+ args.Player.SendErrorMessage(GetString("You do not have permission to modify a Mannequin in a protected area!"));
args.Handled = true;
return;
}
diff --git a/TShockAPI/Handlers/EmojiHandler.cs b/TShockAPI/Handlers/EmojiHandler.cs
index ab0fb92e..bddd15c5 100644
--- a/TShockAPI/Handlers/EmojiHandler.cs
+++ b/TShockAPI/Handlers/EmojiHandler.cs
@@ -16,7 +16,7 @@ namespace TShockAPI.Handlers
{
if (!args.Player.HasPermission(Permissions.sendemoji))
{
- args.Player.SendErrorMessage("You do not have permission to send emotes!");
+ args.Player.SendErrorMessage(GetString("You do not have permission to send emotes!"));
args.Handled = true;
return;
}
diff --git a/TShockAPI/Handlers/IllegalPerSe/EmojiPlayerMismatch.cs b/TShockAPI/Handlers/IllegalPerSe/EmojiPlayerMismatch.cs
index 79fb6c9b..0c6c5ed6 100644
--- a/TShockAPI/Handlers/IllegalPerSe/EmojiPlayerMismatch.cs
+++ b/TShockAPI/Handlers/IllegalPerSe/EmojiPlayerMismatch.cs
@@ -16,7 +16,7 @@ namespace TShockAPI.Handlers.IllegalPerSe
{
if (args.PlayerIndex != args.Player.Index)
{
- TShock.Log.ConsoleError($"IllegalPerSe: Emoji packet rejected for ID spoofing. Expected {args.Player.Index}, received {args.PlayerIndex} from {args.Player.Name}.");
+ TShock.Log.ConsoleError(GetString($"IllegalPerSe: Emoji packet rejected for ID spoofing. Expected {args.Player.Index}, received {args.PlayerIndex} from {args.Player.Name}."));
args.Handled = true;
return;
}
diff --git a/TShockAPI/Handlers/LandGolfBallInCupHandler.cs b/TShockAPI/Handlers/LandGolfBallInCupHandler.cs
index 96c94454..6af3c133 100644
--- a/TShockAPI/Handlers/LandGolfBallInCupHandler.cs
+++ b/TShockAPI/Handlers/LandGolfBallInCupHandler.cs
@@ -89,7 +89,7 @@ namespace TShockAPI.Handlers
{
if (args.PlayerIndex != args.Player.Index)
{
- TShock.Log.ConsoleDebug($"LandGolfBallInCupHandler: Packet rejected for ID spoofing. Expected {args.Player.Index}, received {args.PlayerIndex} from {args.Player.Name}.");
+ TShock.Log.ConsoleDebug(GetString($"LandGolfBallInCupHandler: Packet rejected for ID spoofing. Expected {args.Player.Index}, received {args.PlayerIndex} from {args.Player.Name}."));
args.Handled = true;
return;
}
@@ -97,21 +97,21 @@ namespace TShockAPI.Handlers
if (args.TileX > Main.maxTilesX || args.TileX < 0
|| args.TileY > Main.maxTilesY || args.TileY < 0)
{
- TShock.Log.ConsoleDebug($"LandGolfBallInCupHandler: X and Y position is out of world bounds! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"LandGolfBallInCupHandler: X and Y position is out of world bounds! - From {args.Player.Name}"));
args.Handled = true;
return;
}
if (!Main.tile[args.TileX, args.TileY].active() && Main.tile[args.TileX, args.TileY].type != TileID.GolfHole)
{
- TShock.Log.ConsoleDebug($"LandGolfBallInCupHandler: Tile at packet position X:{args.TileX} Y:{args.TileY} is not a golf hole! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"LandGolfBallInCupHandler: Tile at packet position X:{args.TileX} Y:{args.TileY} is not a golf hole! - From {args.Player.Name}"));
args.Handled = true;
return;
}
if (!GolfBallProjectileIDs.Contains(args.ProjectileType))
{
- TShock.Log.ConsoleDebug($"LandGolfBallInCupHandler: Invalid golf ball projectile ID {args.ProjectileType}! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"LandGolfBallInCupHandler: Invalid golf ball projectile ID {args.ProjectileType}! - From {args.Player.Name}"));
args.Handled = true;
return;
}
@@ -120,14 +120,14 @@ namespace TShockAPI.Handlers
var usedGolfClub = args.Player.RecentlyCreatedProjectiles.Any(e => e.Type == ProjectileID.GolfClubHelper);
if (!usedGolfClub && !usedGolfBall)
{
- TShock.Log.ConsoleDebug($"GolfPacketHandler: Player did not have create a golf club projectile the last 5 seconds! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"GolfPacketHandler: Player did not have create a golf club projectile the last 5 seconds! - From {args.Player.Name}"));
args.Handled = true;
return;
}
if (!GolfClubItemIDs.Contains(args.Player.SelectedItem.type))
{
- TShock.Log.ConsoleDebug($"LandGolfBallInCupHandler: Item selected is not a golf club! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"LandGolfBallInCupHandler: Item selected is not a golf club! - From {args.Player.Name}"));
args.Handled = true;
return;
}
diff --git a/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs b/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs
index edd50bdb..1b617981 100644
--- a/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs
+++ b/TShockAPI/Handlers/NetModules/CreativePowerHandler.cs
@@ -50,7 +50,7 @@ namespace TShockAPI.Handlers.NetModules
{
if (!PowerToPermissionMap.ContainsKey(powerType))
{
- TShock.Log.ConsoleDebug("CreativePowerHandler received permission check request for unknown creative power");
+ TShock.Log.ConsoleDebug(GetString("CreativePowerHandler received permission check request for unknown creative power"));
return false;
}
@@ -65,7 +65,7 @@ namespace TShockAPI.Handlers.NetModules
if (!player.HasPermission(permission))
{
- player.SendErrorMessage("You do not have permission to {0}.", PermissionToDescriptionMap[permission]);
+ player.SendErrorMessage(PermissionToDescriptionMap[permission]);
return false;
}
@@ -100,18 +100,18 @@ namespace TShockAPI.Handlers.NetModules
///
public static Dictionary PermissionToDescriptionMap = new Dictionary
{
- { Permissions.journey_timefreeze, "freeze the time of the server" },
- { Permissions.journey_timeset, "modify the time of the server" },
- { Permissions.journey_godmode, "toggle godmode" },
- { Permissions.journey_windstrength, "modify the wind strength of the server" },
- { Permissions.journey_rainstrength, "modify the rain strength of the server" },
- { Permissions.journey_timespeed, "modify the time speed of the server" },
- { Permissions.journey_rainfreeze, "freeze the rain strength of the server" },
- { Permissions.journey_windfreeze, "freeze the wind strength of the server" },
- { Permissions.journey_placementrange, "modify the tile placement range of your character" },
- { Permissions.journey_setdifficulty, "modify the world difficulty of the server" },
- { Permissions.journey_biomespreadfreeze, "freeze the biome spread of the server" },
- { Permissions.journey_setspawnrate, "modify the NPC spawn rate of the server" },
+ { Permissions.journey_timefreeze, GetString("You do not have permission to freeze the time of the server.") },
+ { Permissions.journey_timeset, GetString("You do not have permission to modify the time of the server.") },
+ { Permissions.journey_godmode, GetString("You do not have permission to toggle godmode.") },
+ { Permissions.journey_windstrength, GetString("You do not have permission to modify the wind strength of the server.") },
+ { Permissions.journey_rainstrength, GetString("You do not have permission to modify the rain strength of the server.") },
+ { Permissions.journey_timespeed, GetString("You do not have permission to modify the time speed of the server.") },
+ { Permissions.journey_rainfreeze, GetString("You do not have permission to freeze the rain strength of the server.") },
+ { Permissions.journey_windfreeze, GetString("You do not have permission to freeze the wind strength of the server.") },
+ { Permissions.journey_placementrange, GetString("You do not have permission to modify the tile placement range of your character.") },
+ { Permissions.journey_setdifficulty, GetString("You do not have permission to modify the world difficulty of the server.") },
+ { Permissions.journey_biomespreadfreeze, GetString("You do not have permission to freeze the biome spread of the server.") },
+ { Permissions.journey_setspawnrate, GetString("You do not have permission to modify the NPC spawn rate of the server.") },
};
}
}
diff --git a/TShockAPI/Handlers/NetModules/CreativeUnlocksHandler.cs b/TShockAPI/Handlers/NetModules/CreativeUnlocksHandler.cs
index 68fe4f1a..92aff26b 100644
--- a/TShockAPI/Handlers/NetModules/CreativeUnlocksHandler.cs
+++ b/TShockAPI/Handlers/NetModules/CreativeUnlocksHandler.cs
@@ -52,8 +52,7 @@ namespace TShockAPI.Handlers.NetModules
if (!Main.GameModeInfo.IsJourneyMode)
{
TShock.Log.ConsoleDebug(
- "NetModuleHandler received attempt to unlock sacrifice while not in journey mode from",
- player.Name
+ GetString($"NetModuleHandler received attempt to unlock sacrifice while not in journey mode from {player.Name}")
);
rejectPacket = true;
@@ -63,9 +62,7 @@ namespace TShockAPI.Handlers.NetModules
if (UnknownField != 0)
{
TShock.Log.ConsoleDebug(
- "CreativeUnlocksHandler received non-vanilla unlock request. Random field value: {0} but should be 0 from {1}",
- UnknownField,
- player.Name
+ GetString($"CreativeUnlocksHandler received non-vanilla unlock request. Random field value: {UnknownField} but should be 0 from {player.Name}")
);
rejectPacket = true;
@@ -74,7 +71,7 @@ namespace TShockAPI.Handlers.NetModules
if (!player.HasPermission(Permissions.journey_contributeresearch))
{
- player.SendErrorMessage("You do not have permission to contribute research.");
+ player.SendErrorMessage(GetString("You do not have permission to contribute research."));
rejectPacket = true;
return;
}
diff --git a/TShockAPI/Handlers/NetModules/PylonHandler.cs b/TShockAPI/Handlers/NetModules/PylonHandler.cs
index 10a30b68..d62b25c3 100644
--- a/TShockAPI/Handlers/NetModules/PylonHandler.cs
+++ b/TShockAPI/Handlers/NetModules/PylonHandler.cs
@@ -51,7 +51,7 @@ namespace TShockAPI.Handlers.NetModules
if (!player.HasPermission(Permissions.pylon))
{
rejectPacket = true;
- player.SendErrorMessage("You do not have permission to teleport using pylons.");
+ player.SendErrorMessage(GetString("You do not have permission to teleport using pylons."));
return;
}
}
diff --git a/TShockAPI/Handlers/RequestTileEntityInteractionHandler.cs b/TShockAPI/Handlers/RequestTileEntityInteractionHandler.cs
index b2505307..a0c6367d 100644
--- a/TShockAPI/Handlers/RequestTileEntityInteractionHandler.cs
+++ b/TShockAPI/Handlers/RequestTileEntityInteractionHandler.cs
@@ -11,7 +11,7 @@ using static TShockAPI.GetDataHandlers;
namespace TShockAPI.Handlers
{
///
- ///
+ ///
///
public class RequestTileEntityInteractionHandler : IPacketHandler
{
@@ -19,20 +19,20 @@ namespace TShockAPI.Handlers
{
if (args.TileEntity is TEHatRack && !args.Player.HasBuildPermissionForTileObject(args.TileEntity.Position.X, args.TileEntity.Position.Y, TEHatRack.entityTileWidth, TEHatRack.entityTileHeight, false))
{
- args.Player.SendErrorMessage("You do not have permission to modify a Hat Rack in a protected area!");
+ args.Player.SendErrorMessage(GetString("You do not have permission to modify a Hat Rack in a protected area!"));
args.Handled = true;
return;
}
else if (args.TileEntity is TEDisplayDoll && !args.Player.HasBuildPermissionForTileObject(args.TileEntity.Position.X, args.TileEntity.Position.Y, TEDisplayDoll.entityTileWidth, TEDisplayDoll.entityTileHeight, false))
{
- args.Player.SendErrorMessage("You do not have permission to modify a Mannequin in a protected area!");
+ args.Player.SendErrorMessage(GetString("You do not have permission to modify a Mannequin in a protected area!"));
args.Handled = true;
return;
}
else if (!args.Player.HasBuildPermission(args.TileEntity.Position.X, args.TileEntity.Position.Y, false))
{
- args.Player.SendErrorMessage("You do not have permission to modify a TileEntity in a protected area!");
- TShock.Log.ConsoleDebug($"RequestTileEntityInteractionHandler: Rejected packet due to lack of building permissions! - From {args.Player.Name} | Position X:{args.TileEntity.Position.X} Y:{args.TileEntity.Position.Y}, TileEntity type: {args.TileEntity.type}, Tile type: {Main.tile[args.TileEntity.Position.X, args.TileEntity.Position.Y].type}");
+ args.Player.SendErrorMessage(GetString("You do not have permission to modify a TileEntity in a protected area!"));
+ TShock.Log.ConsoleDebug(GetString($"RequestTileEntityInteractionHandler: Rejected packet due to lack of building permissions! - From {args.Player.Name} | Position X:{args.TileEntity.Position.X} Y:{args.TileEntity.Position.Y}, TileEntity type: {args.TileEntity.type}, Tile type: {Main.tile[args.TileEntity.Position.X, args.TileEntity.Position.Y].type}"));
args.Handled = true;
return;
}
diff --git a/TShockAPI/Handlers/SendTileRectHandler.cs b/TShockAPI/Handlers/SendTileRectHandler.cs
index 7fcbf2c8..258da63f 100644
--- a/TShockAPI/Handlers/SendTileRectHandler.cs
+++ b/TShockAPI/Handlers/SendTileRectHandler.cs
@@ -126,7 +126,7 @@ namespace TShockAPI.Handlers
if (args.Handled == true)
{
TSPlayer.All.SendTileRect(args.TileX, args.TileY, args.Width, args.Length);
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect reimplemented from carbonara from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect reimplemented from carbonara from {args.Player.Name}"));
}
}
@@ -289,13 +289,13 @@ namespace TShockAPI.Handlers
// More in depth checks should take place in handlers for the Place Object (79), Update Tile Entity (86), and Place Tile Entity (87) packets
if (!args.Player.HasBuildPermissionForTileObject(realX, realY, width, height))
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect rejected from no permission for tile object from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from no permission for tile object from {args.Player.Name}"));
return;
}
if (TShock.TileBans.TileIsBanned((short)tileType))
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect rejected for banned tile");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / SendTileRect rejected for banned tile"));
return;
}
@@ -410,7 +410,7 @@ namespace TShockAPI.Handlers
TileID.Sets.Conversion.MossBrick[tile.type] && TileID.Sets.Conversion.MossBrick[newTile.Type]
)
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect processing a tile conversion update - [{0}] -> [{1}]", tile.type, newTile.Type);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect processing a tile conversion update - [{tile.type}] -> [{newTile.Type}]"));
UpdateServerTileState(tile, newTile, TileDataType.Tile);
}
@@ -425,7 +425,7 @@ namespace TShockAPI.Handlers
WallID.Sets.Conversion.NewWall4[tile.wall] && WallID.Sets.Conversion.NewWall4[newTile.Wall]
)
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect processing a wall conversion update - [{0}] -> [{1}]", tile.wall, newTile.Wall);
+ TShock.Log.ConsoleDebug($"Bouncer / SendTileRect processing a wall conversion update - [{tile.wall}] -> [{newTile.Wall}]");
UpdateServerTileState(tile, newTile, TileDataType.Wall);
}
}
@@ -554,27 +554,27 @@ namespace TShockAPI.Handlers
{
if (args.Player.HasPermission(Permissions.allowclientsideworldedit))
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect accepted clientside world edit from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect accepted clientside world edit from {args.Player.Name}"));
args.Handled = false;
return true;
}
if (args.Width > 4 || args.Length > 4) // as of 1.4.3.6 this is the biggest size the client will send in any case
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect rejected from non-vanilla tilemod from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from non-vanilla tilemod from {args.Player.Name}"));
return true;
}
if (args.Player.IsBouncerThrottled())
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect rejected from throttle from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from throttle from {args.Player.Name}"));
args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width);
return true;
}
if (args.Player.IsBeingDisabled())
{
- TShock.Log.ConsoleDebug("Bouncer / SendTileRect rejected from being disabled from {0}", args.Player.Name);
+ TShock.Log.ConsoleDebug(GetString($"Bouncer / SendTileRect rejected from being disabled from {args.Player.Name}"));
args.Player.SendTileRect(args.TileX, args.TileY, args.Length, args.Width);
return true;
}
@@ -606,7 +606,7 @@ namespace TShockAPI.Handlers
}
}
- TShock.Log.ConsoleDebug("Bouncer / SendTileRectHandler - rejected tile object because object dimensions fall outside the tile rect (excessive size)");
+ TShock.Log.ConsoleDebug(GetString("Bouncer / SendTileRectHandler - rejected tile object because object dimensions fall outside the tile rect (excessive size)"));
return false;
}
diff --git a/TShockAPI/Handlers/SyncTilePickingHandler.cs b/TShockAPI/Handlers/SyncTilePickingHandler.cs
index d7ad1e13..45a3ebc2 100644
--- a/TShockAPI/Handlers/SyncTilePickingHandler.cs
+++ b/TShockAPI/Handlers/SyncTilePickingHandler.cs
@@ -20,7 +20,7 @@ namespace TShockAPI.Handlers
if (args.TileX > Main.maxTilesX || args.TileX < 0
|| args.TileY > Main.maxTilesY || args.TileY < 0)
{
- TShock.Log.ConsoleDebug($"SyncTilePickingHandler: X and Y position is out of world bounds! - From {args.Player.Name}");
+ TShock.Log.ConsoleDebug(GetString($"SyncTilePickingHandler: X and Y position is out of world bounds! - From {args.Player.Name}"));
args.Handled = true;
return;
}
diff --git a/TShockAPI/ILog.cs b/TShockAPI/ILog.cs
index 4c560f1f..fc024865 100644
--- a/TShockAPI/ILog.cs
+++ b/TShockAPI/ILog.cs
@@ -50,6 +50,19 @@ namespace TShockAPI
/// The format arguments.
void ConsoleInfo(string format, params object[] args);
+ ///
+ /// Writes a warning message to the log and to the console.
+ ///
+ /// The message to be written.
+ void ConsoleWarn(string message);
+
+ ///
+ /// Writes a warning message to the log and to the console.
+ ///
+ /// The format of the message to be written.
+ /// The format arguments.
+ void ConsoleWarn(string format, params object[] args);
+
///
/// Writes an error message to the log and to the console.
///
diff --git a/TShockAPI/Modules/ModuleManager.cs b/TShockAPI/Modules/ModuleManager.cs
index c1458fb6..679e40bc 100644
--- a/TShockAPI/Modules/ModuleManager.cs
+++ b/TShockAPI/Modules/ModuleManager.cs
@@ -53,7 +53,7 @@ namespace TShockAPI.Modules
public void InitialiseModule(Type moduleType, object[] parameters)
{
if (!typeof(Module).IsAssignableFrom(moduleType))
- throw new NotSupportedException($"Cannot load module {moduleType.FullName} as it does not derive from {typeof(Module).FullName}");
+ throw new NotSupportedException(GetString($"Cannot load module {moduleType.FullName} as it does not derive from {typeof(Module).FullName}"));
var args = new List