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 BanGriefers = true;
|
||||||
public bool BanKillTileAbusers = false;
|
public bool BanKillTileAbusers = false;
|
||||||
public bool KickKillTileAbusers = 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 banGriefer = true;
|
||||||
public static bool banTnt = false;
|
public static bool banTnt = false;
|
||||||
public static bool kickTnt = false;
|
public static bool kickTnt = false;
|
||||||
|
public static bool banBoom = true;
|
||||||
|
public static bool kickBoom = true;
|
||||||
|
|
||||||
public enum NPCList : int
|
public enum NPCList : int
|
||||||
{
|
{
|
||||||
WORLD_EATER = 0,
|
WORLD_EATER = 0,
|
||||||
|
|
@ -53,6 +56,8 @@ namespace TShockAPI
|
||||||
banGriefer = cfg.BanGriefers;
|
banGriefer = cfg.BanGriefers;
|
||||||
banTnt = cfg.BanKillTileAbusers;
|
banTnt = cfg.BanKillTileAbusers;
|
||||||
kickTnt = cfg.KickKillTileAbusers;
|
kickTnt = cfg.KickKillTileAbusers;
|
||||||
|
banBoom = cfg.BanExplosives;
|
||||||
|
kickBoom = cfg.KickExplosives;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteJsonConfiguration()
|
public static void WriteJsonConfiguration()
|
||||||
|
|
@ -80,6 +85,8 @@ namespace TShockAPI
|
||||||
cfg.BanGriefers = banGriefer;
|
cfg.BanGriefers = banGriefer;
|
||||||
cfg.BanKillTileAbusers = true;
|
cfg.BanKillTileAbusers = true;
|
||||||
cfg.KickKillTileAbusers = true;
|
cfg.KickKillTileAbusers = true;
|
||||||
|
cfg.BanExplosives = true;
|
||||||
|
cfg.KickExplosives = true;
|
||||||
|
|
||||||
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
||||||
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
|
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ namespace TShockAPI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ip"></param>
|
/// <param name="ip"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool CheckGreif(String ip)
|
public static bool Checkgrief(String ip)
|
||||||
{
|
{
|
||||||
ip = Tools.GetRealIP(ip);
|
ip = Tools.GetRealIP(ip);
|
||||||
if (!ConfigurationManager.banTnt) { return false; }
|
if (!ConfigurationManager.banTnt) { return false; }
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,41 @@ namespace TShockAPI
|
||||||
Tools.HandleCheater(ply);
|
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)
|
void OnGreetPlayer(int who, HandledEventArgs e)
|
||||||
|
|
@ -289,9 +324,9 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
Tools.Kick(ply, "You were flagged for cheating.");
|
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))
|
if (!FileTools.OnWhitelist(ip))
|
||||||
{
|
{
|
||||||
|
|
@ -323,9 +358,13 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (Main.player[i] != null)
|
if (Main.player[i] != null)
|
||||||
{
|
{
|
||||||
FileTools.WriteGrief((int)i);
|
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
|
||||||
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.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;
|
players[i].tileThreshold = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -254,10 +254,10 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds someone to greifers.txt
|
/// Adds someone to griefers.txt
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ply">int player</param>
|
/// <param name="ply">int player</param>
|
||||||
public static void HandleGreifer(int ply)
|
public static void HandleGriefer(int ply)
|
||||||
{
|
{
|
||||||
if (!TShock.players[ply].IsAdmin())
|
if (!TShock.players[ply].IsAdmin())
|
||||||
{
|
{
|
||||||
|
|
@ -269,7 +269,7 @@ namespace TShockAPI
|
||||||
Netplay.serverSock[ply].kill = true;
|
Netplay.serverSock[ply].kill = true;
|
||||||
Netplay.serverSock[ply].Reset();
|
Netplay.serverSock[ply].Reset();
|
||||||
NetMessage.syncPlayers();
|
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