Renamed Solution... I'm picky and its easier to track what VS Solution is open in the taskbar.
Removed old kick/ban system for griefing and hacks. Cheating detection redone to stop inventory editors going above the normal limits. Revamped KillTile abuse detection to be always on. Removed old hacks/exploit detection for exploits fixed by Redigit properly. Removed some permissions and added one for killtile abuse detection. Removed old configurations that are not used anymore. AntiHack/Protection System COMPLETELY revamped to properly block and revert all actions that are abusive. Item Ban List is now the primary method to control various griefing items. To block Explosives or Sandguns or other items, use the Item Ban List. Banned items are able to exist in your inventory but the server will ignore all attempts to use those items. To protect against hack clients doing world edit type actions, use regions and spawn protection.
This commit is contained in:
parent
7e3fd905da
commit
8a62df9ebb
8 changed files with 514 additions and 534 deletions
|
|
@ -1731,14 +1731,6 @@ namespace TShockAPI
|
|||
private static void ShowConfiguration(CommandArgs args)
|
||||
{
|
||||
args.Player.SendMessage("TShock Config:");
|
||||
string lineOne = string.Format("BanCheater : {0}, KickCheater : {1}, BanGriefer : {2}, KickGriefer : {3}",
|
||||
TShock.Config.BanCheaters, TShock.Config.KickCheaters,
|
||||
TShock.Config.BanGriefers, TShock.Config.KickGriefers);
|
||||
args.Player.SendMessage(lineOne, Color.Yellow);
|
||||
string lineTwo = string.Format("BanTnt : {0}, KickTnt : {1}, BanBoom : {2}, KickBoom : {3}",
|
||||
TShock.Config.BanKillTileAbusers, TShock.Config.KickKillTileAbusers,
|
||||
TShock.Config.BanExplosives, TShock.Config.KickExplosives);
|
||||
args.Player.SendMessage(lineTwo, Color.Yellow);
|
||||
string lineThree = string.Format("RangeChecks : {0}, DisableBuild : {1}, ProtectSpawn : {2}, ProtectRadius : {3}",
|
||||
TShock.Config.RangeChecks, TShock.Config.DisableBuild,
|
||||
TShock.Config.SpawnProtection, TShock.Config.SpawnProtectionRadius);
|
||||
|
|
|
|||
|
|
@ -43,22 +43,6 @@ namespace TShockAPI
|
|||
public bool AlwaysPvP;
|
||||
[Description("Kicks players who edit save files for cheating.")]
|
||||
public bool KickCheaters = true;
|
||||
[Description("")]
|
||||
public bool BanCheaters = true;
|
||||
[Description("")]
|
||||
public bool KickGriefers = true;
|
||||
[Description("")]
|
||||
public bool BanGriefers = true;
|
||||
[Description("Bans players who attempt to kill tiles using TNT or exploits. Requires kick to be enabled.")]
|
||||
public bool BanKillTileAbusers = true;
|
||||
[Description("Kicks players who attempt to kill tiles using TNT or exploits.")]
|
||||
public bool KickKillTileAbusers = true;
|
||||
[Description("Bans players who attempt to throw a bomb or dynamite.")]
|
||||
public bool BanExplosives = true;
|
||||
[Description("Kicks players who attempt to throw a bomb or dynamite.")]
|
||||
public bool KickExplosives = true;
|
||||
[Description("Explosives won't break blocks")]
|
||||
public bool DisableExplosives = true;
|
||||
[Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")]
|
||||
public bool SpawnProtection = true;
|
||||
[Description("Radius from spawn tile for SpawnProtection.")]
|
||||
|
|
@ -72,7 +56,7 @@ namespace TShockAPI
|
|||
[Description("Disables any building; placing of blocks")]
|
||||
public bool DisableBuild;
|
||||
[Description("Kick a player if they exceed this number of tile kills within 1 second.")]
|
||||
public int TileThreshold = 60;
|
||||
public int TileThreshold = 120;
|
||||
[Description("#.#.#. = Red/Blue/Green - RGB Colors for the Admin Chat Color. Max value: 255")]
|
||||
public float[] SuperAdminChatRGB = { 255, 0, 0 };
|
||||
[Description("The Chat Prefix before an admin speaks. eg. *The prefix was set to \"(Admin) \", so.. (Admin) : Hi! Note: If you put a space after the prefix, it will look like this: (Admin) <TerrariaDude): Hi!")]
|
||||
|
|
@ -127,34 +111,12 @@ namespace TShockAPI
|
|||
[Description("")]
|
||||
public string MySqlPassword = "";
|
||||
[Description("")]
|
||||
public string RangeCheckBanReason = "Placing impossible to place blocks.";
|
||||
[Description("")]
|
||||
public string SendSectionAbuseReason = "SendSection abuse.";
|
||||
[Description("")]
|
||||
public string NPCSpawnAbuseReason = "Spawn NPC abuse";
|
||||
[Description("")]
|
||||
public string UpdatePlayerAbuseReason = "Update Player abuse";
|
||||
[Description("")]
|
||||
public string ExplosiveAbuseReason = "Throwing an explosive device.";
|
||||
[Description("")]
|
||||
public string KillMeAbuseReason = "Trying to execute KillMe on someone else.";
|
||||
[Description("")]
|
||||
public string IllogicalLiquidUseReason = "Manipulating liquid without bucket.";
|
||||
[Description("")]
|
||||
public string LiquidAbuseReason = "Placing impossible to place liquid.";
|
||||
[Description("")]
|
||||
public string TileKillAbuseReason = "Tile Kill abuse ({0})";
|
||||
[Description("")]
|
||||
public string MediumcoreBanReason = "Death results in a ban";
|
||||
[Description("")]
|
||||
public string MediumcoreKickReason = "Death results in a kick";
|
||||
[Description("")]
|
||||
public string ProjectileAbuseReason = "Projectile abuse";
|
||||
[Description("")]
|
||||
public string TileAbuseReason = "Tile abuse ({0})";
|
||||
[Description("")]
|
||||
public string GriefClientReason = "Grief client detected ({0})";
|
||||
[Description("")]
|
||||
public bool EnableDNSHostResolution;
|
||||
[Description("")]
|
||||
public bool EnableBanOnUsernames;
|
||||
|
|
@ -211,9 +173,6 @@ namespace TShockAPI
|
|||
[Description("Some weapons override the range checks, however malicious users can take advantage of this and send lots of packets of certain types. Disabling this will turn off weapons that affect this.")]
|
||||
public bool EnableRangeCheckOverrides = true;
|
||||
|
||||
[Description("Disabling this prevents players from being banned or kicked based on item stacks.")]
|
||||
public bool EnableItemStackChecks = true;
|
||||
|
||||
[Description("Kicks users using a proxy as identified with the GeoIP database")]
|
||||
public bool KickProxyUsers = true;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -23,15 +23,6 @@ namespace TShockAPI
|
|||
[Description("Allows you to use banned items")]
|
||||
public static readonly string usebanneditem;
|
||||
|
||||
[Description("Required to be able to place spikes")]
|
||||
public static readonly string canspike;
|
||||
|
||||
[Description("Required to be able to place/pickup water")]
|
||||
public static readonly string canwater;
|
||||
|
||||
[Description("Required to be able to place/pickup lava")]
|
||||
public static readonly string canlava;
|
||||
|
||||
[Description("Allows you to edit the spawn")]
|
||||
public static readonly string editspawn;
|
||||
|
||||
|
|
@ -41,14 +32,11 @@ namespace TShockAPI
|
|||
[Description("Prevents you from being banned")]
|
||||
public static readonly string immunetoban;
|
||||
|
||||
[Description("Prevents you from being kicked/banned by TShocks grief detections")]
|
||||
public static readonly string ignoregriefdetection;
|
||||
|
||||
[Description("Prevents you from being kicked/banned by TShocks cheat detections")]
|
||||
[Description("Prevents you from being kicked by TShocks cheat detections")]
|
||||
public static readonly string ignorecheatdetection;
|
||||
|
||||
[Description("Allows you to use explosives even when they are disabled")]
|
||||
public static readonly string useexplosives;
|
||||
[Description("Prevents you from being reverted by kill tile abuse detection")]
|
||||
public static readonly string ignorekilltiledetection;
|
||||
|
||||
[Description("Specific log messages are sent to users with this permission")]
|
||||
public static readonly string logs;
|
||||
|
|
@ -144,9 +132,6 @@ namespace TShockAPI
|
|||
[Description("User can change the homes of NPCs.")]
|
||||
public static readonly string movenpc;
|
||||
|
||||
[Description("Required to be able to place Explosives")]
|
||||
public static readonly string canexplosive;
|
||||
|
||||
[Description("Users can stop people from TPing to them")]
|
||||
public static readonly string tpallow;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace TShockAPI
|
|||
public Point[] TempPoints = new Point[2];
|
||||
public int AwaitingTempPoint { get; set; }
|
||||
public bool AwaitingName { get; set; }
|
||||
public DateTime LastExplosive { get; set; }
|
||||
public DateTime LastThreat { get; set; }
|
||||
public DateTime LastTileChangeNotify { get; set; }
|
||||
public bool InitSpawn;
|
||||
public bool DisplayLogs = true;
|
||||
|
|
|
|||
|
|
@ -476,10 +476,7 @@ namespace TShockAPI
|
|||
{
|
||||
if (player.TileThreshold >= Config.TileThreshold)
|
||||
{
|
||||
if (TShock.Utils.HandleTntUser(player, "Kill tile abuse detected."))
|
||||
{
|
||||
TSPlayer.Server.RevertKillTile(player.TilesDestroyed);
|
||||
}
|
||||
TSPlayer.Server.RevertKillTile(player.TilesDestroyed);
|
||||
}
|
||||
if (player.TileThreshold > 0)
|
||||
{
|
||||
|
|
@ -573,17 +570,10 @@ namespace TShockAPI
|
|||
|
||||
if (!TShock.Utils.ValidString(text))
|
||||
{
|
||||
TShock.Utils.Kick(tsplr, "Unprintable character in chat");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.whoAmI != ply)
|
||||
{
|
||||
e.Handled = TShock.Utils.HandleGriefer(tsplr, "Faking Chat");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tsplr.Group.HasPermission(Permissions.adminchat) && !text.StartsWith("/") && Config.AdminChatEnabled)
|
||||
{
|
||||
TShock.Utils.Broadcast(Config.AdminChatPrefix + "<" + tsplr.Name + "> " + text,
|
||||
|
|
@ -693,13 +683,9 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Stop accepting updates from player as this player is going to be kicked/banned during OnUpdate (different thread so can produce race conditions)
|
||||
if ((Config.BanKillTileAbusers || Config.KickKillTileAbusers) &&
|
||||
player.TileThreshold >= Config.TileThreshold && !player.Group.HasPermission(Permissions.ignoregriefdetection))
|
||||
if (player.TileThreshold >= Config.TileThreshold && !player.Group.HasPermission(Permissions.ignorekilltiledetection))
|
||||
{
|
||||
Log.Debug("Rejecting " + type + " from " + player.Name + " as this player is about to be kicked");
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
|
|
@ -747,7 +733,7 @@ namespace TShockAPI
|
|||
TShock.Utils.ShowFileToUser(player, "motd.txt");
|
||||
if (HackedHealth(player))
|
||||
{
|
||||
TShock.Utils.HandleCheater(player, "Hacked health.");
|
||||
TShock.Utils.ForceKick(player, "Health/Mana cheat detected. Please use a different character.");
|
||||
}
|
||||
if (Config.AlwaysPvP)
|
||||
{
|
||||
|
|
@ -936,6 +922,78 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
public static bool CheckProjectilePermission(TSPlayer player, int index, int type)
|
||||
{
|
||||
if (type == 43)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == 17 && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Dirt Wand")) //Dirt Wand Projectile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((type == 42 || type == 65 || type == 68) && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Sandgun")) //Sandgun Projectiles
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Projectile proj = new Projectile();
|
||||
proj.SetDefaults(type);
|
||||
|
||||
if (!player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(proj.name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (proj.hostile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CheckTilePermission(TSPlayer player, int tileX, int tileY)
|
||||
{
|
||||
if (TShock.Config.RangeChecks && ((Math.Abs(player.TileX - tileX) > 32) || (Math.Abs(player.TileY - tileY) > 32)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!player.Group.HasPermission(Permissions.canbuild))
|
||||
{
|
||||
player.SendMessage("You do not have permission to build!", Color.Red);
|
||||
return true;
|
||||
}
|
||||
if (!player.Group.HasPermission(Permissions.editspawn) && !TShock.Regions.CanBuild(tileX, tileY, player) && TShock.Regions.InArea(tileX, tileY))
|
||||
{
|
||||
player.SendMessage("Region protected from changes.", Color.Red);
|
||||
return true;
|
||||
}
|
||||
if (TShock.Config.DisableBuild)
|
||||
{
|
||||
if (!player.Group.HasPermission(Permissions.editspawn))
|
||||
{
|
||||
player.SendMessage("World protected from changes.", Color.Red);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (TShock.Config.SpawnProtection)
|
||||
{
|
||||
if (!player.Group.HasPermission(Permissions.editspawn))
|
||||
{
|
||||
var flag = TShock.CheckSpawn(tileX, tileY);
|
||||
if (flag)
|
||||
{
|
||||
player.SendMessage("Spawn protected from changes.", Color.Red);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CheckSpawn(int x, int y)
|
||||
{
|
||||
Vector2 tile = new Vector2(x, y);
|
||||
|
|
@ -967,7 +1025,7 @@ namespace TShockAPI
|
|||
{
|
||||
for (int h = y; h < y + 4; h++)
|
||||
{
|
||||
if (!Main.tile[i, h].active || !GetDataHandlers.BlacklistTiles[Main.tile[i, h].type])
|
||||
if (!Main.tile[i, h].active || !Main.tileSolid[Main.tile[i, h].type])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -455,32 +455,13 @@ namespace TShockAPI
|
|||
|
||||
public bool HandleCheater(TSPlayer player, string reason)
|
||||
{
|
||||
return HandleBadPlayer(player, "ignorecheatdetection", TShock.Config.BanCheaters, TShock.Config.KickCheaters, reason);
|
||||
return HandleBadPlayer(player, "ignorecheatdetection", TShock.Config.KickCheaters, reason);
|
||||
}
|
||||
|
||||
public bool HandleGriefer(TSPlayer player, string reason)
|
||||
{
|
||||
return HandleBadPlayer(player, Permissions.ignoregriefdetection, TShock.Config.BanGriefers, TShock.Config.KickGriefers, reason);
|
||||
}
|
||||
|
||||
public bool HandleTntUser(TSPlayer player, string reason)
|
||||
{
|
||||
return HandleBadPlayer(player, Permissions.ignoregriefdetection, TShock.Config.BanKillTileAbusers, TShock.Config.KickKillTileAbusers, reason);
|
||||
}
|
||||
|
||||
public bool HandleExplosivesUser(TSPlayer player, string reason)
|
||||
{
|
||||
return HandleBadPlayer(player, Permissions.ignoregriefdetection, TShock.Config.BanExplosives, TShock.Config.KickExplosives, reason);
|
||||
}
|
||||
|
||||
private bool HandleBadPlayer(TSPlayer player, string overridePermission, bool ban, bool kick, string reason)
|
||||
private bool HandleBadPlayer(TSPlayer player, string overridePermission, bool kick, string reason)
|
||||
{
|
||||
if (!player.Group.HasPermission(overridePermission) || !(player.Group.Name == "superadmin"))
|
||||
{
|
||||
if (ban)
|
||||
{
|
||||
return Ban(player, reason);
|
||||
}
|
||||
if (kick)
|
||||
{
|
||||
return Kick(player, reason);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue