Merge branch 'master' of github.com:TShock/TShock
This commit is contained in:
commit
ffec5f45a5
4 changed files with 64 additions and 53 deletions
|
|
@ -17,7 +17,6 @@ namespace TShockAPI
|
||||||
public static bool infiniteInvasion;
|
public static bool infiniteInvasion;
|
||||||
public static bool permaPvp;
|
public static bool permaPvp;
|
||||||
public static int killCount;
|
public static int killCount;
|
||||||
public static bool startedInvasion;
|
|
||||||
public static bool kickCheater = true;
|
public static bool kickCheater = true;
|
||||||
public static bool banCheater = true;
|
public static bool banCheater = true;
|
||||||
public static bool kickGriefer = true;
|
public static bool kickGriefer = true;
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ namespace TShockAPI
|
||||||
public bool syncHP;
|
public bool syncHP;
|
||||||
public bool syncMP;
|
public bool syncMP;
|
||||||
public Group group;
|
public Group group;
|
||||||
public int lavaCount = 0;
|
|
||||||
public int waterCount = 0;
|
|
||||||
private int player;
|
private int player;
|
||||||
|
|
||||||
public TSPlayer(int ply)
|
public TSPlayer(int ply)
|
||||||
|
|
|
||||||
|
|
@ -211,14 +211,17 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
int plyX = Math.Abs((int)Main.player[e.Msg.whoAmI].position.X / 16);
|
int plyX = Math.Abs((int)Main.player[e.Msg.whoAmI].position.X / 16);
|
||||||
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16);
|
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16);
|
||||||
int tileX = Math.Abs(x/16);
|
int tileX = Math.Abs(x);
|
||||||
int tileY = Math.Abs(y/16);
|
int tileY = Math.Abs(y);
|
||||||
|
|
||||||
if ((plyX - tileX > 6) || (plyY - tileY > 6))
|
if ((Math.Abs(plyX - tileX) > 6) || (Math.Abs(plyY - tileY) > 6))
|
||||||
|
{
|
||||||
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place blocks.");
|
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place blocks.");
|
||||||
Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place blocks.");
|
Tools.Broadcast(Main.player[e.Msg.whoAmI].name +
|
||||||
|
" was banned for placing impossible to place blocks.");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (type == 0 || type == 1)
|
if (type == 0 || type == 1)
|
||||||
|
|
||||||
if (ConfigurationManager.spawnProtect)
|
if (ConfigurationManager.spawnProtect)
|
||||||
|
|
@ -425,28 +428,34 @@ namespace TShockAPI
|
||||||
int tileX = Math.Abs(x);
|
int tileX = Math.Abs(x);
|
||||||
int tileY = Math.Abs(y);
|
int tileY = Math.Abs(y);
|
||||||
|
|
||||||
|
int lavacount = 0;
|
||||||
|
int watercount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 44; i++)
|
for (int i = 0; i < 44; i++)
|
||||||
{
|
{
|
||||||
if (Main.player[e.Msg.whoAmI].inventory[i].name == "Lava Bucket")
|
if (Main.player[e.Msg.whoAmI].inventory[i].name == "Lava Bucket")
|
||||||
TShock.players[e.Msg.whoAmI].lavaCount++;
|
lavacount++;
|
||||||
else if (Main.player[e.Msg.whoAmI].inventory[i].name == "Water Bucket")
|
else if (Main.player[e.Msg.whoAmI].inventory[i].name == "Water Bucket")
|
||||||
TShock.players[e.Msg.whoAmI].waterCount++;
|
watercount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lava && TShock.players[e.Msg.whoAmI].lavaCount <= 0)
|
if (lava && lavacount <= 0)
|
||||||
{
|
{
|
||||||
TShock.Ban(e.Msg.whoAmI, "Placing lava they didn't have.");
|
TShock.Ban(e.Msg.whoAmI, "Placing lava they didn't have.");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
else if (!lava && TShock.players[e.Msg.whoAmI].waterCount <= 0)
|
else if (!lava && watercount <= 0)
|
||||||
{
|
{
|
||||||
TShock.Ban(e.Msg.whoAmI, "Placing water they didn't have.");
|
TShock.Ban(e.Msg.whoAmI, "Placing water they didn't have.");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
if ((plyX - tileX > 6) || (plyY - tileY > 6))
|
if ((Math.Abs(plyX - tileX) > 6) || (Math.Abs(plyY - tileY) > 6))
|
||||||
|
{
|
||||||
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place liquid.");
|
TShock.Ban(e.Msg.whoAmI, "Placing impossible to place liquid.");
|
||||||
Tools.Broadcast(Main.player[e.Msg.whoAmI].name + " was banned for placing impossible to place liquid.");
|
Tools.Broadcast(Main.player[e.Msg.whoAmI].name +
|
||||||
|
" was banned for placing impossible to place liquid.");
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.spawnProtect)
|
if (ConfigurationManager.spawnProtect)
|
||||||
{
|
{
|
||||||
|
|
@ -492,8 +501,7 @@ namespace TShockAPI
|
||||||
Main.player[who].hostile = true;
|
Main.player[who].hostile = true;
|
||||||
NetMessage.SendData(30, -1, -1, "", who);
|
NetMessage.SendData(30, -1, -1, "", who);
|
||||||
}
|
}
|
||||||
if (players[who].group.HasPermission("causeevents") && ConfigurationManager.infiniteInvasion &&
|
if (players[who].group.HasPermission("causeevents") && ConfigurationManager.infiniteInvasion)
|
||||||
!ConfigurationManager.startedInvasion)
|
|
||||||
{
|
{
|
||||||
StartInvasion();
|
StartInvasion();
|
||||||
}
|
}
|
||||||
|
|
@ -834,9 +842,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static void Ban(int plr, string reason = "")
|
public static void Ban(int plr, string reason = "")
|
||||||
{
|
{
|
||||||
Tools.Kick(plr, reason);
|
if (!players[plr].group.HasPermission("immunetoban"))
|
||||||
|
{
|
||||||
|
Tools.Kick(plr, "Banned: " + reason);
|
||||||
Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason);
|
Bans.AddBan(Tools.GetPlayerIP(plr), Main.player[plr].name, reason);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Position
|
public class Position
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -214,11 +214,14 @@ namespace TShockAPI
|
||||||
/// <param name="ply">int player</param>
|
/// <param name="ply">int player</param>
|
||||||
/// <param name="reason">string reason</param>
|
/// <param name="reason">string reason</param>
|
||||||
public static void Kick(int ply, string reason)
|
public static void Kick(int ply, string reason)
|
||||||
|
{
|
||||||
|
if (!TShock.players[ply].group.HasPermission("immunetokick") || reason.Contains("Banned: "))
|
||||||
{
|
{
|
||||||
string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply);
|
string displayName = FindPlayer(ply).Equals("") ? GetPlayerIP(ply) : FindPlayer(ply);
|
||||||
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
|
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
|
||||||
Log.Info("Kicked " + displayName + " for : " + reason);
|
Log.Info("Kicked " + displayName + " for : " + reason);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows a MOTD to the player
|
/// Shows a MOTD to the player
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue