Add reasons to all Disable() usages

This commit is contained in:
Deathmax 2012-01-14 10:40:06 +08:00
parent 7ab577282e
commit 71117ae0b5
3 changed files with 23 additions and 27 deletions

View file

@ -1241,7 +1241,7 @@ namespace TShockAPI
if (tiletype == 48 && !args.Player.Group.HasPermission(Permissions.usebanneditem) &&
TShock.Itembans.ItemIsBanned("Spike", args.Player))
{
args.Player.Disable();
args.Player.Disable("Using banned spikes without permissions");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -1254,7 +1254,7 @@ namespace TShockAPI
if (tiletype == 141 && !args.Player.Group.HasPermission(Permissions.usebanneditem) &&
TShock.Itembans.ItemIsBanned("Explosives", args.Player))
{
args.Player.Disable();
args.Player.Disable("Using banned explosives tile without permissions");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -1285,14 +1285,14 @@ namespace TShockAPI
if (args.Player.TileKillThreshold >= TShock.Config.TileKillThreshold)
{
args.Player.Disable();
args.Player.Disable("Reached TileKill threshold");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
if (args.Player.TilePlaceThreshold >= TShock.Config.TilePlaceThreshold)
{
args.Player.Disable();
args.Player.Disable("Reached TilePlace threshold");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -1457,7 +1457,7 @@ namespace TShockAPI
TShock.Itembans.ItemIsBanned(args.TPlayer.inventory[item].name, args.Player))
{
control -= 32;
args.Player.Disable();
args.Player.Disable("Using banned item");
args.Player.SendMessage(
string.Format("You cannot use {0} on this server. Your actions are being ignored.",
args.TPlayer.inventory[item].name), Color.Red);
@ -1531,14 +1531,14 @@ namespace TShockAPI
if (args.Player.Index != owner)
{
args.Player.Disable();
args.Player.Disable("Owner and player ID does not match to update projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
if (dmg > 175)
{
args.Player.Disable();
args.Player.Disable("Projectile damage is higher than 175");
args.Player.RemoveProjectile(ident, owner);
return true;
}
@ -1551,14 +1551,14 @@ namespace TShockAPI
if (TShock.CheckProjectilePermission(args.Player, index, type))
{
args.Player.Disable();
args.Player.Disable("Does not have projectile permission to update projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
if (args.Player.ProjectileThreshold >= TShock.Config.ProjectileThreshold)
{
args.Player.Disable();
args.Player.Disable("Reached projectile update threshold");
args.Player.RemoveProjectile(ident, owner);
return true;
}
@ -1582,12 +1582,6 @@ namespace TShockAPI
var ident = args.Data.ReadInt16();
var owner = args.Data.ReadInt8();
if (args.Player.Index != owner)
{
args.Player.Disable();
return true;
}
var index = TShock.Utils.SearchProjectile(ident);
if (index > Main.maxProjectiles || index < 0)
@ -1599,7 +1593,7 @@ namespace TShockAPI
if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100) // workaround for skeletron prime projectiles
{
args.Player.Disable();
args.Player.Disable("Owner and player ID does not match to kill projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
@ -1612,7 +1606,7 @@ namespace TShockAPI
if (TShock.CheckProjectilePermission(args.Player, index, type) && type != 102 && type != 100)
{
args.Player.Disable();
args.Player.Disable("Does not have projectile permission to kill projectile");
args.Player.RemoveProjectile(ident, owner);
return true;
}
@ -1676,7 +1670,7 @@ namespace TShockAPI
if (args.Player.TileLiquidThreshold >= TShock.Config.TileLiquidThreshold)
{
args.Player.Disable();
args.Player.Disable("Reached TileLiquid threshold");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -1699,7 +1693,7 @@ namespace TShockAPI
if (lava && bucket != 2 && !args.Player.Group.HasPermission(Permissions.usebanneditem) &&
TShock.Itembans.ItemIsBanned("Lava Bucket", args.Player))
{
args.Player.Disable();
args.Player.Disable("Using banned lava bucket without permissions");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -1707,7 +1701,7 @@ namespace TShockAPI
if (!lava && bucket != 1 && !args.Player.Group.HasPermission(Permissions.usebanneditem) &&
TShock.Itembans.ItemIsBanned("Water Bucket", args.Player))
{
args.Player.Disable();
args.Player.Disable("Using banned water bucket without permissions");
args.Player.SendTileSquare(tileX, tileY);
return true;
}
@ -2035,7 +2029,7 @@ namespace TShockAPI
if (dmg > 175)
{
args.Player.Disable();
args.Player.Disable("Player damage exceeded 175");
args.Player.SendData(PacketTypes.PlayerHp, "", id);
args.Player.SendData(PacketTypes.PlayerUpdate, "", id);
return true;
@ -2088,7 +2082,7 @@ namespace TShockAPI
if (dmg > 175)
{
args.Player.Disable();
args.Player.Disable("NPC damage exceeded 175");
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
return true;
}

View file

@ -357,12 +357,14 @@ namespace TShockAPI
SendData(PacketTypes.PlayerTeam, "", Index);
}
public virtual void Disable()
public virtual void Disable(string reason = "")
{
LastThreat = DateTime.UtcNow;
SetBuff(33, 330, true); //Weak
SetBuff(32, 330, true); //Slow
SetBuff(23, 330, true); //Cursed
if (!string.IsNullOrEmpty(reason))
Log.ConsoleInfo(string.Format("Player {0} has been disabled for {1}", Name, reason));
}
public virtual void Whoopie(object time)

View file

@ -484,7 +484,7 @@ namespace TShockAPI
{
if (player.TileKillThreshold >= Config.TileKillThreshold)
{
player.Disable();
player.Disable("Reached TileKill threshold");
TSPlayer.Server.RevertTiles(player.TilesDestroyed);
player.TilesDestroyed.Clear();
}
@ -497,7 +497,7 @@ namespace TShockAPI
{
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
{
player.Disable();
player.Disable("Reached TilePlace threshold");
TSPlayer.Server.RevertTiles(player.TilesCreated);
player.TilesCreated.Clear();
}
@ -508,7 +508,7 @@ namespace TShockAPI
}
if (player.TileLiquidThreshold >= Config.TileLiquidThreshold)
{
player.Disable();
player.Disable("Reached TileLiquid threshold");
}
if (player.TileLiquidThreshold > 0)
{
@ -516,7 +516,7 @@ namespace TShockAPI
}
if (player.ProjectileThreshold >= Config.ProjectileThreshold)
{
player.Disable();
player.Disable("Reached Projectile threshold");
}
if (player.ProjectileThreshold > 0)
{