Using Tile Send Square message instead of multiple Tile Send Section message to revert player changes.

This commit is contained in:
ricky 2011-06-15 00:39:39 +10:00
parent f810f5f979
commit ea80dd48c3

View file

@ -343,8 +343,6 @@ namespace TShockAPI
return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place blocks."); return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place blocks.");
} }
} }
if (type == 0 || type == 1 || type == 2 || type == 3)
{
if (ConfigurationManager.disableBuild) if (ConfigurationManager.disableBuild)
{ {
if (!players[e.Msg.whoAmI].group.HasPermission("editspawn")) if (!players[e.Msg.whoAmI].group.HasPermission("editspawn"))
@ -367,7 +365,6 @@ namespace TShockAPI
} }
} }
} }
}
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active) if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active)
{ {
@ -380,30 +377,7 @@ namespace TShockAPI
private static void RevertPlayerChanges(int player, byte action, int x, int y) private static void RevertPlayerChanges(int player, byte action, int x, int y)
{ {
int revertAction = 0; NetMessage.SendData(20, player, -1, "", 10, (float)(x - 5), (float)(y - 5), 0f);
float revertType = 0f;
switch (action)
{
case 0:
revertAction = 1;
revertType = Main.tile[x, y].type;
break;
case 1:
revertAction = 0;
revertType = 0f;
break;
case 2:
revertAction = 3;
revertType = Main.tile[x, y].wall;
break;
case 3:
revertAction = 2;
revertType = 0f;
break;
}
NetMessage.SendData(17, player, -1, "", revertAction, x, y, revertType);
for (int j = y - 2; j <= (y + 2); j++)
NetMessage.SendData(10, player, -1, "", 5, (float)(x - 2), (float)j, 0f);
} }
bool HandleTogglePvp(MemoryStream data, GetDataEventArgs e) bool HandleTogglePvp(MemoryStream data, GetDataEventArgs e)