Fixed stupid language use

Added some stuff in the event that this conflicts with what people are playing on.
This commit is contained in:
Shank 2011-05-30 03:33:47 -06:00
parent f42435fd68
commit 7428b0e1f7

View file

@ -73,15 +73,16 @@ namespace TShockAPI
void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e) void OnPreGetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
{ {
if (Main.netMode != 2) { return; }
if (id == 0x1e && permaPvp) if (id == 0x1e && permaPvp)
{ {
e.Handled = true; e.Handled = true;
} }
} }
void GetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e) void GetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e)
{ {
if (Main.netMode != 2) { return; }
int n = 5; int n = 5;
byte[] buf = msg.readBuffer; byte[] buf = msg.readBuffer;
if (id == 17) if (id == 17)
@ -98,6 +99,7 @@ namespace TShockAPI
void OnGreetPlayer(int who, HandledEventArgs e) void OnGreetPlayer(int who, HandledEventArgs e)
{ {
if (Main.netMode != 2) { return; }
int plr = who; //legacy support int plr = who; //legacy support
ShowMOTD(who); ShowMOTD(who);
if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200) if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200)
@ -114,6 +116,7 @@ namespace TShockAPI
void OnChat(int ply, string msg, HandledEventArgs handler) void OnChat(int ply, string msg, HandledEventArgs handler)
{ {
if (Main.netMode != 2) { return; }
if (IsAdmin(ply)) if (IsAdmin(ply))
{ {
if (msg.Length > 5 && msg.Substring(0, 5) == "/kick") if (msg.Length > 5 && msg.Substring(0, 5) == "/kick")
@ -137,12 +140,18 @@ namespace TShockAPI
} }
handler.Handled = true; handler.Handled = true;
} }
if (msg == "/off")
{
Netplay.disconnect = true;
}
} }
} }
void OnJoin(int ply, AllowEventArgs handler) void OnJoin(int ply, AllowEventArgs handler)
{ {
if (Main.netMode != 2) { return; }
string ip = GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint))); string ip = GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
if (CheckBanned(ip) || CheckCheat(ip) || CheckGreif(ip)) if (CheckBanned(ip) || CheckCheat(ip) || CheckGreif(ip))
{ {
@ -166,11 +175,11 @@ namespace TShockAPI
void OnPostInit() void OnPostInit()
{ {
} }
void OnUpdate(GameTime time) void OnUpdate(GameTime time)
{ {
if (Main.netMode != 2) { return; }
for (uint i = 0; i < Main.maxPlayers; i++) for (uint i = 0; i < Main.maxPlayers; i++)
{ {
if (tileThreshold[i] >= 5) if (tileThreshold[i] >= 5)
@ -178,7 +187,7 @@ namespace TShockAPI
if (Main.player[i] != null) if (Main.player[i] != null)
{ {
WriteGrief((int)i); WriteGrief((int)i);
Kick((int)i, "Fuck you bomb spam or some other fucking shit"); Kick((int)i, "Kill tile abuse detected.");
} }
tileThreshold[i] = 0; tileThreshold[i] = 0;
} }