diff --git a/TShockAPI/Bouncer.cs b/TShockAPI/Bouncer.cs index 663148cf..384c7044 100644 --- a/TShockAPI/Bouncer.cs +++ b/TShockAPI/Bouncer.cs @@ -424,11 +424,8 @@ namespace TShockAPI } else if (action == EditAction.PlaceTile || action == EditAction.ReplaceTile || action == EditAction.PlaceWall || action == EditAction.ReplaceWall) { - var isInvalidPlaceStyle = ExtraneousPlaceStyles.ContainsKey(editData) - ? style > ExtraneousPlaceStyles[editData] - : MaxPlaceStyles.ContainsKey(editData) && style > MaxPlaceStyles[editData]; if ((action == EditAction.PlaceTile && TShock.Config.Settings.PreventInvalidPlaceStyle) && - isInvalidPlaceStyle) + style > GetMaxPlaceStyle(editData)) { TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (ms1) {0} {1} {2}", args.Player.Name, action, editData); args.Player.SendTileSquare(tileX, tileY, 4); @@ -2228,6 +2225,25 @@ namespace TShockAPI }); } + /// + /// Returns the max associated with the given . Or -1 if there's no association + /// + /// Tile ID to query for + /// The max , otherwise -1 if there's no association + internal static int GetMaxPlaceStyle(int tileID) + { + int result; + if (ExtraneousPlaceStyles.TryGetValue(tileID, out result) + || MaxPlaceStyles.TryGetValue(tileID, out result)) + { + return result; + } + else + { + return -1; + } + } + // These time values are references from Projectile.cs, at npc.AddBuff() calls. private static Dictionary NPCAddBuffTimeMax = new Dictionary() {