From a24d93b241fd1446235e0b79474649c1bdd31460 Mon Sep 17 00:00:00 2001 From: Twitchy Date: Tue, 28 Jun 2011 20:27:37 +1200 Subject: [PATCH 1/4] Changed SendTileSquare to 50. Should stop client crashing on TP --- TShockAPI/TSPlayer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 1d614b23..0910422c 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -143,8 +143,9 @@ namespace TShockAPI Main.spawnTileX = tileX; Main.spawnTileY = tileY; SendData(PacketTypes.WorldInfo); - SendTileSquare(tileX, tileY, 30); - if (TPlayer.SpawnX >= 0 && TPlayer.SpawnY >= 0) + SendTileSquare(tileX, tileY, 50); + + if (TPlayer.SpawnX > 0 && TPlayer.SpawnY > 0) { Main.tile[TPlayer.SpawnX, TPlayer.SpawnY].active = false; NetMessage.SendTileSquare(Index, TPlayer.SpawnX, TPlayer.SpawnY, 1); @@ -157,6 +158,7 @@ namespace TShockAPI { Spawn(); } + Main.spawnTileX = spawnTileX; Main.spawnTileY = spawnTileY; SendData(PacketTypes.WorldInfo); From 554eb464f19e6cc61ad6c902cf3abc2284e2d99e Mon Sep 17 00:00:00 2001 From: Twitchy Date: Tue, 28 Jun 2011 20:42:56 +1200 Subject: [PATCH 2/4] Added tphere permission --- TShockAPI/Commands.cs | 2 +- TShockAPI/config/groups.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 56d46df2..d55e9962 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -120,7 +120,7 @@ namespace TShockAPI ChatCommands.Add(new Command("home", "tp", Home)); ChatCommands.Add(new Command("spawn", "tp", Spawn)); ChatCommands.Add(new Command("tp", "tp", TP)); - ChatCommands.Add(new Command("tphere", "tp", TPHere)); + ChatCommands.Add(new Command("tphere", "tphere", TPHere)); ChatCommands.Add(new Command("warp", "warp", UseWarp)); ChatCommands.Add(new Command("setwarp", "managewarp", SetWarp)); ChatCommands.Add(new Command("delwarp", "managewarp", DeleteWarp)); diff --git a/TShockAPI/config/groups.txt b/TShockAPI/config/groups.txt index 251ce199..f0b1b53f 100644 --- a/TShockAPI/config/groups.txt +++ b/TShockAPI/config/groups.txt @@ -21,6 +21,7 @@ #spawnboss - allow player to spawn bosses #spawnmob - allow player to spawn any npcs #tp - allow player to teleport +#tphere - allow a player to teleport players to their position #managewarp - allow player to add/delete warp locations #editspawn - allow player to enable/disable build protection #cfg - allow player to view/change tshock configuration @@ -39,5 +40,5 @@ default null canwater canlava warp vip default reservedslot newadmin default kick editspawn reservedslot -admin newadmin ban unban whitelist causeevents spawnboss spawnmob managewarp time tp pvpfun kill logs immunetokick +admin newadmin ban unban whitelist causeevents spawnboss spawnmob managewarp time tp pvpfun kill logs immunetokick tphere trustedadmin admin maintenance cfg butcher cheat immunetoban ignorecheatdetection ignoregriefdetection usebanneditem \ No newline at end of file From aa3a491dabbcbe9f57d36d34af3c0ab50398c2c8 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 17:09:58 +0800 Subject: [PATCH 3/4] Added null checks for tile destroyed check. --- TShockAPI/TShock.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c666df6d..66e57eb6 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -199,23 +199,26 @@ namespace TShockAPI { if (player != null && player.Active) { - if (player.TileThreshold >= ConfigurationManager.TileThreshold) + if (player.TilesDestroyed != null) { - if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) + if (player.TileThreshold >= ConfigurationManager.TileThreshold) { - TSPlayer.Server.RevertKillTile(player.TilesDestroyed); + if (Tools.HandleTntUser(player, "Kill tile abuse detected.")) + { + TSPlayer.Server.RevertKillTile(player.TilesDestroyed); + } + else if (player.TileThreshold > 0) + { + player.TileThreshold = 0; + player.TilesDestroyed.Clear(); + } + } else if (player.TileThreshold > 0) { player.TileThreshold = 0; player.TilesDestroyed.Clear(); } - - } - else if (player.TileThreshold > 0) - { - player.TileThreshold = 0; - player.TilesDestroyed.Clear(); } if (!player.Group.HasPermission("usebanneditem")) From feb4754b1431c6e1ac2992b55914b87b06441169 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 17:17:24 +0800 Subject: [PATCH 4/4] Null and range check for HandlePlayerDamage. --- TShockAPI/GetDataHandlers.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index ba7feda1..48f70535 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -360,7 +360,10 @@ namespace TShockAPI private static bool HandlePlayerDamage(GetDataHandlerArgs args) { byte playerid = args.Data.ReadInt8(); - return !TShock.Players[playerid].TPlayer.hostile; + if (playerid >= 0 && playerid <= Main.maxPlayers && TShock.Players[playerid] != null) + return !TShock.Players[playerid].TPlayer.hostile; + + return ConfigurationManager.PermaPvp; } private static bool HandleLiquidSet(GetDataHandlerArgs args)