Merge pull request #1166 from CoderCow/general-devel
Concurrent Dictionary Access Fix
This commit is contained in:
commit
fc69dccb8b
2 changed files with 15 additions and 9 deletions
|
|
@ -2137,6 +2137,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
args.Player.TilePlaceThreshold++;
|
args.Player.TilePlaceThreshold++;
|
||||||
var coords = new Vector2(tileX, tileY);
|
var coords = new Vector2(tileX, tileY);
|
||||||
|
lock (args.Player.TilesCreated)
|
||||||
if (!args.Player.TilesCreated.ContainsKey(coords))
|
if (!args.Player.TilesCreated.ContainsKey(coords))
|
||||||
args.Player.TilesCreated.Add(coords, Main.tile[tileX, tileY]);
|
args.Player.TilesCreated.Add(coords, Main.tile[tileX, tileY]);
|
||||||
}
|
}
|
||||||
|
|
@ -2146,6 +2147,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
args.Player.TileKillThreshold++;
|
args.Player.TileKillThreshold++;
|
||||||
var coords = new Vector2(tileX, tileY);
|
var coords = new Vector2(tileX, tileY);
|
||||||
|
lock (args.Player.TilesDestroyed)
|
||||||
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
||||||
args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]);
|
args.Player.TilesDestroyed.Add(coords, Main.tile[tileX, tileY]);
|
||||||
}
|
}
|
||||||
|
|
@ -2239,6 +2241,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
args.Player.TilePlaceThreshold++;
|
args.Player.TilePlaceThreshold++;
|
||||||
var coords = new Vector2(x, y);
|
var coords = new Vector2(x, y);
|
||||||
|
lock (args.Player.TilesCreated)
|
||||||
if (!args.Player.TilesCreated.ContainsKey(coords))
|
if (!args.Player.TilesCreated.ContainsKey(coords))
|
||||||
args.Player.TilesCreated.Add(coords, Main.tile[x, y]);
|
args.Player.TilesCreated.Add(coords, Main.tile[x, y]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -894,6 +894,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
player.TileKillThreshold = 0;
|
player.TileKillThreshold = 0;
|
||||||
//We don't want to revert the entire map in case of a disable.
|
//We don't want to revert the entire map in case of a disable.
|
||||||
|
lock (player.TilesDestroyed)
|
||||||
player.TilesDestroyed.Clear();
|
player.TilesDestroyed.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -902,10 +903,12 @@ namespace TShockAPI
|
||||||
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
|
if (player.TilePlaceThreshold >= Config.TilePlaceThreshold)
|
||||||
{
|
{
|
||||||
player.Disable("Reached TilePlace threshold", flags);
|
player.Disable("Reached TilePlace threshold", flags);
|
||||||
|
lock (player.TilesCreated) {
|
||||||
TSPlayer.Server.RevertTiles(player.TilesCreated);
|
TSPlayer.Server.RevertTiles(player.TilesCreated);
|
||||||
player.TilesCreated.Clear();
|
player.TilesCreated.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (player.TilePlaceThreshold > 0)
|
if (player.TilePlaceThreshold > 0)
|
||||||
{
|
{
|
||||||
player.TilePlaceThreshold = 0;
|
player.TilePlaceThreshold = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue