Skip to content

Add region protection for chest crafting#3227

Open
ACaiCat wants to merge 2 commits intoPryaxis:general-develfrom
ACaiCat:region
Open

Add region protection for chest crafting#3227
ACaiCat wants to merge 2 commits intoPryaxis:general-develfrom
ACaiCat:region

Conversation

@ACaiCat
Copy link
Member

@ACaiCat ACaiCat commented Feb 28, 2026

Add region protection for chest crafting

@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR adds region protection for chest crafting by hooking into CraftingRequests.CanCraftFromChest. The implementation follows the same pattern as the existing OnQuickStack handler, checking if the player is active, not disabled, and has build permission at the chest location when RegionProtectChests is enabled. The change prevents players from crafting with items from chests in protected regions they don't have access to.

Confidence Score: 4/5

  • Safe to merge with minimal risk - follows established patterns for region protection
  • The implementation correctly adds region protection for chest crafting following the same pattern as existing handlers like OnQuickStack. The code is consistent with the codebase's established security checks (active player, disabled check, build permission). Score is 4 instead of 5 because the implementation could be more defensive by adding range validation and active chest checking similar to OnChestItemChange, though this pattern matches OnQuickStack.
  • No files require special attention

Important Files Changed

Filename Overview
TShockAPI/Bouncer.cs Added region protection for chest crafting following the same pattern as OnQuickStack; missing range and active chest validation that OnChestItemChange has

Last reviewed commit: 7696e1c

Co-authored-by: 羽学 <1242509682@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant