Added Dynamite/Bomb projectile checks.
Fixed issue where Kill Tile Abuse doesn't check for config values.
This commit is contained in:
parent
60156af877
commit
f1d821a554
5 changed files with 57 additions and 9 deletions
|
|
@ -21,5 +21,7 @@ namespace TShockAPI
|
|||
public bool BanGriefers = true;
|
||||
public bool BanKillTileAbusers = false;
|
||||
public bool KickKillTileAbusers = false;
|
||||
public bool BanExplosives = true;
|
||||
public bool KickExplosives = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ namespace TShockAPI
|
|||
public static bool banGriefer = true;
|
||||
public static bool banTnt = false;
|
||||
public static bool kickTnt = false;
|
||||
public static bool banBoom = true;
|
||||
public static bool kickBoom = true;
|
||||
|
||||
public enum NPCList : int
|
||||
{
|
||||
WORLD_EATER = 0,
|
||||
|
|
@ -53,6 +56,8 @@ namespace TShockAPI
|
|||
banGriefer = cfg.BanGriefers;
|
||||
banTnt = cfg.BanKillTileAbusers;
|
||||
kickTnt = cfg.KickKillTileAbusers;
|
||||
banBoom = cfg.BanExplosives;
|
||||
kickBoom = cfg.KickExplosives;
|
||||
}
|
||||
|
||||
public static void WriteJsonConfiguration()
|
||||
|
|
@ -80,6 +85,8 @@ namespace TShockAPI
|
|||
cfg.BanGriefers = banGriefer;
|
||||
cfg.BanKillTileAbusers = true;
|
||||
cfg.KickKillTileAbusers = true;
|
||||
cfg.BanExplosives = true;
|
||||
cfg.KickExplosives = true;
|
||||
|
||||
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
||||
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
/// <param name="ip"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckGreif(String ip)
|
||||
public static bool Checkgrief(String ip)
|
||||
{
|
||||
ip = Tools.GetRealIP(ip);
|
||||
if (!ConfigurationManager.banTnt) { return false; }
|
||||
|
|
|
|||
|
|
@ -232,6 +232,41 @@ namespace TShockAPI
|
|||
Tools.HandleCheater(ply);
|
||||
}
|
||||
}
|
||||
else if (e.MsgID == 0x1B)
|
||||
{
|
||||
Int16 ident;
|
||||
float posx;
|
||||
float posy;
|
||||
float velx;
|
||||
float vely;
|
||||
float knockback;
|
||||
Int16 dmg;
|
||||
byte owner;
|
||||
byte type;
|
||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||
{
|
||||
ident = br.ReadInt16();
|
||||
posx = br.ReadSingle();
|
||||
posy = br.ReadSingle();
|
||||
velx = br.ReadSingle();
|
||||
vely = br.ReadSingle();
|
||||
knockback = br.ReadSingle();
|
||||
dmg = br.ReadInt16();
|
||||
owner = br.ReadByte();
|
||||
type = br.ReadByte();
|
||||
}
|
||||
if (type == 29 || type == 28)
|
||||
{
|
||||
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
|
||||
{
|
||||
int i = e.Msg.whoAmI;
|
||||
if (ConfigurationManager.banTnt)
|
||||
FileTools.WriteGrief((int)i);
|
||||
Tools.Kick((int)i, "Explosives was thrown.");
|
||||
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banBoom ? "banned" : "kicked") + " for throwing an explosive device.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnGreetPlayer(int who, HandledEventArgs e)
|
||||
|
|
@ -289,9 +324,9 @@ namespace TShockAPI
|
|||
{
|
||||
Tools.Kick(ply, "You were flagged for cheating.");
|
||||
}
|
||||
else if (FileTools.CheckGreif(ip))
|
||||
else if (FileTools.Checkgrief(ip))
|
||||
{
|
||||
Tools.Kick(ply, "You were flagged for kill tile abuse.");
|
||||
Tools.Kick(ply, "You were flagged for griefing (either kill tile abuse or explosives).");
|
||||
}
|
||||
if (!FileTools.OnWhitelist(ip))
|
||||
{
|
||||
|
|
@ -323,9 +358,13 @@ namespace TShockAPI
|
|||
{
|
||||
if (Main.player[i] != null)
|
||||
{
|
||||
FileTools.WriteGrief((int)i);
|
||||
Tools.Kick((int)i, "Kill tile abuse detected.");
|
||||
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
|
||||
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
|
||||
{
|
||||
if (ConfigurationManager.banTnt)
|
||||
FileTools.WriteGrief((int)i);
|
||||
Tools.Kick((int)i, "Kill tile abuse detected.");
|
||||
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
|
||||
}
|
||||
}
|
||||
players[i].tileThreshold = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,10 +254,10 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds someone to greifers.txt
|
||||
/// Adds someone to griefers.txt
|
||||
/// </summary>
|
||||
/// <param name="ply">int player</param>
|
||||
public static void HandleGreifer(int ply)
|
||||
public static void HandleGriefer(int ply)
|
||||
{
|
||||
if (!TShock.players[ply].IsAdmin())
|
||||
{
|
||||
|
|
@ -269,7 +269,7 @@ namespace TShockAPI
|
|||
Netplay.serverSock[ply].kill = true;
|
||||
Netplay.serverSock[ply].Reset();
|
||||
NetMessage.syncPlayers();
|
||||
Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for greifing.");
|
||||
Tools.Broadcast(cheater + " was " + (ConfigurationManager.banGriefer ? "banned " : "kicked ") + "for griefing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue