Added try/catch statements.
This commit is contained in:
parent
0155156367
commit
ab67d9f137
1 changed files with 245 additions and 187 deletions
|
|
@ -137,6 +137,8 @@ namespace TShockAPI
|
||||||
NetHooks.OnPreGetData -= GetData;
|
NetHooks.OnPreGetData -= GetData;
|
||||||
NetHooks.OnGreetPlayer -= new NetHooks.GreetPlayerD(OnGreetPlayer);
|
NetHooks.OnGreetPlayer -= new NetHooks.GreetPlayerD(OnGreetPlayer);
|
||||||
NpcHooks.OnStrikeNpc -= new NpcHooks.StrikeNpcD(NpcHooks_OnStrikeNpc);
|
NpcHooks.OnStrikeNpc -= new NpcHooks.StrikeNpcD(NpcHooks_OnStrikeNpc);
|
||||||
|
ConfigurationManager.WriteJsonConfiguration();
|
||||||
|
Log.Info("Shutting down...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -145,228 +147,270 @@ namespace TShockAPI
|
||||||
|
|
||||||
void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.infiniteInvasion)
|
try
|
||||||
{
|
{
|
||||||
IncrementKills();
|
if (ConfigurationManager.infiniteInvasion)
|
||||||
if (Main.invasionSize < 10)
|
|
||||||
{
|
{
|
||||||
Main.invasionSize = 20000000;
|
IncrementKills();
|
||||||
|
if (Main.invasionSize < 10)
|
||||||
|
{
|
||||||
|
Main.invasionSize = 20000000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FileTools.WriteError(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetData(GetDataEventArgs e)
|
void GetData(GetDataEventArgs e)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
try
|
||||||
if (e.MsgID == 17)
|
|
||||||
{
|
{
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
if (Main.netMode != 2) { return; }
|
||||||
|
if (e.MsgID == 17)
|
||||||
{
|
{
|
||||||
byte type = br.ReadByte();
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
int x = br.ReadInt32();
|
|
||||||
int y = br.ReadInt32();
|
|
||||||
|
|
||||||
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active)
|
|
||||||
{
|
{
|
||||||
players[e.Msg.whoAmI].tileThreshold++;
|
byte type = br.ReadByte();
|
||||||
|
int x = br.ReadInt32();
|
||||||
|
int y = br.ReadInt32();
|
||||||
|
|
||||||
|
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active)
|
||||||
|
{
|
||||||
|
players[e.Msg.whoAmI].tileThreshold++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
else if (e.MsgID == 0x1e)
|
||||||
}
|
|
||||||
else if (e.MsgID == 0x1e)
|
|
||||||
{
|
|
||||||
byte id;
|
|
||||||
bool pvp;
|
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
|
||||||
{
|
{
|
||||||
id = br.ReadByte();
|
byte id;
|
||||||
pvp = br.ReadBoolean();
|
bool pvp;
|
||||||
}
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
Main.player[e.Msg.whoAmI].hostile = pvp;
|
{
|
||||||
if (id != e.Msg.whoAmI)
|
id = br.ReadByte();
|
||||||
Main.player[e.Msg.whoAmI].hostile = true;
|
pvp = br.ReadBoolean();
|
||||||
if (ConfigurationManager.permaPvp)
|
}
|
||||||
Main.player[e.Msg.whoAmI].hostile = true;
|
Main.player[e.Msg.whoAmI].hostile = pvp;
|
||||||
NetMessage.SendData(30, -1, -1, "", e.Msg.whoAmI);
|
if (id != e.Msg.whoAmI)
|
||||||
e.Handled = true;
|
Main.player[e.Msg.whoAmI].hostile = true;
|
||||||
}
|
if (ConfigurationManager.permaPvp)
|
||||||
else if (e.MsgID == 0x0A) //SendSection
|
Main.player[e.Msg.whoAmI].hostile = true;
|
||||||
{
|
NetMessage.SendData(30, -1, -1, "", e.Msg.whoAmI);
|
||||||
Tools.Broadcast(string.Format("{0}({1}) attempted sending a section", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
|
||||||
Tools.Kick(e.Msg.whoAmI, "SendSection abuse.");
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
else if (e.MsgID == 0x17) //Npc Data
|
|
||||||
{
|
|
||||||
Tools.Broadcast(string.Format("{0}({1}) attempted spawning an NPC", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
|
||||||
Tools.Kick(e.Msg.whoAmI, "Spawn NPC abuse");
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
else if (e.MsgID == 0x0D) //Update Player
|
|
||||||
{
|
|
||||||
byte plr = e.Msg.readBuffer[e.Index];
|
|
||||||
if (plr != e.Msg.whoAmI)
|
|
||||||
{
|
|
||||||
Tools.Kick(e.Msg.whoAmI, "Update Player abuse");
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
else if (e.MsgID == 0x0A) //SendSection
|
||||||
else if (e.MsgID == 0x10)
|
|
||||||
{
|
|
||||||
byte ply;
|
|
||||||
Int16 life, maxLife;
|
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
|
||||||
{
|
{
|
||||||
ply = br.ReadByte();
|
Tools.Broadcast(string.Format("{0}({1}) attempted sending a section", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
||||||
life = br.ReadInt16();
|
Tools.Kick(e.Msg.whoAmI, "SendSection abuse.");
|
||||||
maxLife = br.ReadInt16();
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
else if (e.MsgID == 0x17) //Npc Data
|
||||||
if (players[ply].syncHP)
|
{
|
||||||
|
Tools.Broadcast(string.Format("{0}({1}) attempted spawning an NPC", Main.player[e.Msg.whoAmI].name, e.Msg.whoAmI));
|
||||||
|
Tools.Kick(e.Msg.whoAmI, "Spawn NPC abuse");
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
else if (e.MsgID == 0x0D) //Update Player
|
||||||
|
{
|
||||||
|
byte plr = e.Msg.readBuffer[e.Index];
|
||||||
|
if (plr != e.Msg.whoAmI)
|
||||||
{
|
{
|
||||||
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
Tools.Kick(e.Msg.whoAmI, "Update Player abuse");
|
||||||
Tools.HandleCheater(ply);
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
players[ply].syncHP = true;
|
|
||||||
}
|
|
||||||
else if (e.MsgID == 0x2a)
|
|
||||||
{
|
|
||||||
byte ply;
|
|
||||||
Int16 mana, maxmana;
|
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
|
||||||
{
|
|
||||||
ply = br.ReadByte();
|
|
||||||
mana = br.ReadInt16();
|
|
||||||
maxmana = br.ReadInt16();
|
|
||||||
}
|
}
|
||||||
if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
|
else if (e.MsgID == 0x10)
|
||||||
if (players[ply].syncMP)
|
{
|
||||||
|
byte ply;
|
||||||
|
Int16 life, maxLife;
|
||||||
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
{
|
{
|
||||||
if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
|
ply = br.ReadByte();
|
||||||
Tools.HandleCheater(ply);
|
life = br.ReadInt16();
|
||||||
|
maxLife = br.ReadInt16();
|
||||||
}
|
}
|
||||||
else
|
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
||||||
players[ply].syncMP = true;
|
if (players[ply].syncHP)
|
||||||
}
|
|
||||||
else if (e.MsgID == 0x19)
|
|
||||||
{
|
|
||||||
byte ply;
|
|
||||||
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
|
||||||
{
|
|
||||||
ply = br.ReadByte();
|
|
||||||
}
|
|
||||||
if (e.Msg.whoAmI != ply)
|
|
||||||
{
|
|
||||||
//fuck you faggot
|
|
||||||
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 (!players[e.Msg.whoAmI].IsAdmin())
|
|
||||||
{
|
|
||||||
if (ConfigurationManager.kickBoom || ConfigurationManager.banBoom)
|
|
||||||
{
|
{
|
||||||
int i = e.Msg.whoAmI;
|
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
|
||||||
if (ConfigurationManager.banBoom)
|
Tools.HandleCheater(ply);
|
||||||
FileTools.WriteGrief((int)i);
|
}
|
||||||
Tools.Kick((int)i, "Explosives was thrown.");
|
else
|
||||||
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banBoom ? "banned" : "kicked") + " for throwing an explosive device.");
|
players[ply].syncHP = true;
|
||||||
e.Handled = true;
|
}
|
||||||
|
else if (e.MsgID == 0x2a)
|
||||||
|
{
|
||||||
|
byte ply;
|
||||||
|
Int16 mana, maxmana;
|
||||||
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
|
{
|
||||||
|
ply = br.ReadByte();
|
||||||
|
mana = br.ReadInt16();
|
||||||
|
maxmana = br.ReadInt16();
|
||||||
|
}
|
||||||
|
if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
|
||||||
|
if (players[ply].syncMP)
|
||||||
|
{
|
||||||
|
if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
|
||||||
|
Tools.HandleCheater(ply);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
players[ply].syncMP = true;
|
||||||
|
}
|
||||||
|
else if (e.MsgID == 0x19)
|
||||||
|
{
|
||||||
|
byte ply;
|
||||||
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
|
{
|
||||||
|
ply = br.ReadByte();
|
||||||
|
}
|
||||||
|
if (e.Msg.whoAmI != ply)
|
||||||
|
{
|
||||||
|
//fuck you faggot
|
||||||
|
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 (!players[e.Msg.whoAmI].IsAdmin())
|
||||||
|
{
|
||||||
|
if (ConfigurationManager.kickBoom || ConfigurationManager.banBoom)
|
||||||
|
{
|
||||||
|
int i = e.Msg.whoAmI;
|
||||||
|
if (ConfigurationManager.banBoom)
|
||||||
|
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.");
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FileTools.WriteError(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGreetPlayer(int who, HandledEventArgs e)
|
void OnGreetPlayer(int who, HandledEventArgs e)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
try
|
||||||
int plr = who; //legacy support
|
|
||||||
Tools.ShowMOTD(who);
|
|
||||||
if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200 || CheckInventory(plr))
|
|
||||||
{
|
{
|
||||||
Tools.HandleCheater(plr);
|
if (Main.netMode != 2) { return; }
|
||||||
|
int plr = who; //legacy support
|
||||||
|
Tools.ShowMOTD(who);
|
||||||
|
if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200 || CheckInventory(plr))
|
||||||
|
{
|
||||||
|
Tools.HandleCheater(plr);
|
||||||
|
}
|
||||||
|
if (ConfigurationManager.permaPvp)
|
||||||
|
{
|
||||||
|
Main.player[who].hostile = true;
|
||||||
|
NetMessage.SendData(30, -1, -1, "", who);
|
||||||
|
}
|
||||||
|
if (TShock.players[who].IsAdmin() && ConfigurationManager.infiniteInvasion && !ConfigurationManager.startedInvasion)
|
||||||
|
{
|
||||||
|
StartInvasion();
|
||||||
|
}
|
||||||
|
ShowUpdateReminder(who);
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.permaPvp)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Main.player[who].hostile = true;
|
FileTools.WriteError(ex.ToString());
|
||||||
NetMessage.SendData(30, -1, -1, "", who);
|
|
||||||
}
|
}
|
||||||
if (TShock.players[who].IsAdmin() && ConfigurationManager.infiniteInvasion && !ConfigurationManager.startedInvasion)
|
|
||||||
{
|
|
||||||
StartInvasion();
|
|
||||||
}
|
|
||||||
ShowUpdateReminder(who);
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChat(int ply, string msg, HandledEventArgs handler)
|
void OnChat(int ply, string msg, HandledEventArgs handler)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
try
|
||||||
int x = (int)Main.player[ply].position.X;
|
|
||||||
int y = (int)Main.player[ply].position.Y;
|
|
||||||
|
|
||||||
if (msg.StartsWith("/"))
|
|
||||||
{
|
{
|
||||||
Commands.CommandArgs args = new Commands.CommandArgs(msg, x, y, ply);
|
if (Main.netMode != 2) { return; }
|
||||||
var commands = commandList;
|
int x = (int)Main.player[ply].position.X;
|
||||||
if (TShock.players[ply].IsAdmin())
|
int y = (int)Main.player[ply].position.Y;
|
||||||
commands = admincommandList;
|
|
||||||
|
|
||||||
Commands.CommandDelegate command;
|
if (msg.StartsWith("/"))
|
||||||
if (commands.TryGetValue(msg.Split(' ')[0].TrimStart('/'), out command))
|
{
|
||||||
command.Invoke(args);
|
Commands.CommandArgs args = new Commands.CommandArgs(msg, x, y, ply);
|
||||||
else
|
var commands = commandList;
|
||||||
Tools.SendMessage(ply, "Invalid command or no permissions! Try /help.", new float[] { 255f, 0f, 0f });
|
if (TShock.players[ply].IsAdmin())
|
||||||
handler.Handled = true;
|
commands = admincommandList;
|
||||||
|
|
||||||
|
Commands.CommandDelegate command;
|
||||||
|
if (commands.TryGetValue(msg.Split(' ')[0].TrimStart('/'), out command))
|
||||||
|
{
|
||||||
|
Log.Info(Tools.FindPlayer(ply) + " executed " + msg);
|
||||||
|
command.Invoke(args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Info(Tools.FindPlayer(ply) + " tried to execute " + msg);
|
||||||
|
Tools.SendMessage(ply, "Invalid command or no permissions! Try /help.", new float[] { 255f, 0f, 0f });
|
||||||
|
}
|
||||||
|
handler.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FileTools.WriteError(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnJoin(int ply, AllowEventArgs handler)
|
void OnJoin(int ply, AllowEventArgs handler)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
try
|
||||||
string ip = Tools.GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
|
|
||||||
if (FileTools.CheckBanned(ip))
|
|
||||||
{
|
{
|
||||||
Tools.Kick(ply, "You are banned.");
|
if (Main.netMode != 2) { return; }
|
||||||
} else if (FileTools.CheckCheat(ip))
|
string ip = Tools.GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
|
||||||
{
|
if (FileTools.CheckBanned(ip))
|
||||||
Tools.Kick(ply, "You were flagged for cheating.");
|
{
|
||||||
|
Tools.Kick(ply, "You are banned.");
|
||||||
|
}
|
||||||
|
else if (FileTools.CheckCheat(ip))
|
||||||
|
{
|
||||||
|
Tools.Kick(ply, "You were flagged for cheating.");
|
||||||
|
}
|
||||||
|
else if (FileTools.Checkgrief(ip))
|
||||||
|
{
|
||||||
|
Tools.Kick(ply, "You were flagged for griefing.");
|
||||||
|
}
|
||||||
|
if (!FileTools.OnWhitelist(ip))
|
||||||
|
{
|
||||||
|
Tools.Kick(ply, "Not on whitelist.");
|
||||||
|
}
|
||||||
|
players[ply] = new TSPlayer(ply);
|
||||||
}
|
}
|
||||||
else if (FileTools.Checkgrief(ip))
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Tools.Kick(ply, "You were flagged for griefing.");
|
FileTools.WriteError(ex.ToString());
|
||||||
}
|
}
|
||||||
if (!FileTools.OnWhitelist(ip))
|
|
||||||
{
|
|
||||||
Tools.Kick(ply, "Not on whitelist.");
|
|
||||||
}
|
|
||||||
players[ply] = new TSPlayer(ply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLoadContent(Microsoft.Xna.Framework.Content.ContentManager obj)
|
void OnLoadContent(Microsoft.Xna.Framework.Content.ContentManager obj)
|
||||||
|
|
@ -375,7 +419,14 @@ namespace TShockAPI
|
||||||
|
|
||||||
void OnPreInit()
|
void OnPreInit()
|
||||||
{
|
{
|
||||||
FileTools.SetupConfig();
|
try
|
||||||
|
{
|
||||||
|
FileTools.SetupConfig();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPostInit()
|
void OnPostInit()
|
||||||
|
|
@ -384,29 +435,36 @@ namespace TShockAPI
|
||||||
|
|
||||||
void OnUpdate(GameTime time)
|
void OnUpdate(GameTime time)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 2) { return; }
|
try
|
||||||
for (uint i = 0; i < Main.maxPlayers; i++)
|
|
||||||
{
|
{
|
||||||
if (Main.player[i].active == false) { continue; }
|
if (Main.netMode != 2) { return; }
|
||||||
if (players[i].tileThreshold >= 20)
|
for (uint i = 0; i < Main.maxPlayers; i++)
|
||||||
{
|
{
|
||||||
if (Main.player[i] != null)
|
if (Main.player[i].active == false) { continue; }
|
||||||
|
if (players[i].tileThreshold >= 20)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
|
if (Main.player[i] != null)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.banTnt)
|
if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
|
||||||
FileTools.WriteGrief((int)i);
|
{
|
||||||
Tools.Kick((int)i, "Kill tile abuse detected.");
|
if (ConfigurationManager.banTnt)
|
||||||
Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
|
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;
|
||||||
|
}
|
||||||
|
else if (players[i].tileThreshold > 0)
|
||||||
|
{
|
||||||
|
players[i].tileThreshold = 0;
|
||||||
}
|
}
|
||||||
players[i].tileThreshold = 0;
|
|
||||||
}
|
|
||||||
else if (players[i].tileThreshold > 0)
|
|
||||||
{
|
|
||||||
players[i].tileThreshold = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FileTools.WriteError(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue