Skip to content

Extend nonMembersCanInteractWithDoors to include fence gates#1956

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-config-option-for-fence-gates
Draft

Extend nonMembersCanInteractWithDoors to include fence gates#1956
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-config-option-for-fence-gates

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 22, 2026

The factions.nonMembersCanInteractWithDoors config option only checked for Door and TrapDoor block data types, so fence gates in faction territory were fully protected. Players could cheaply gate off areas with fence gates to bypass the intended door accessibility policy.

Adds org.bukkit.block.data.type.Gate to the existing check:

if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor || clickedBlock.blockData is Gate) {
    return
}
  • PlayerInteractListener.kt — Include Gate in the door interaction bypass
  • PlayerInteractListenerTest.kt — Add fence gate test mirroring existing door/trapdoor tests
  • CONFIG.md — Update description to reflect fence gate coverage

Config key name unchanged for backward compatibility.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hub.spigotmc.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)
  • repo.dansplugins.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)
  • repo.extendedclip.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)
  • repo.mikeprimm.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)
  • repo.rpkit.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Config option that allows you to enable outsiders to use doors should extend to more blocks</issue_title>
<issue_description>## Is your feature request related to a problem?
My players have started to gate off important areas of their castles fence gates, as opposed to doors, because the "nonMembersCanInteractWithDoors" configuration option does not extend to fence gates. I think that players should have to commit to using full iron doors if they wish to keep an area secure. Fence gates are inexpensive and shouldn't be fully secure when full wooden doors are not.

Moreover, fence gates are often just used in place of wooden doors in medieval builds, because sometimes they fit nicer than full doors. Especially as a tavern door. So they should be included as part of "nonMembersCanInteractWithDoors".

Describe the solution you'd like

I think that either the "nonMembersCanInteractWithDoors" configuration option should extend to fence gates, or should be replaced with a more configurable option like "nonMemberInteractionBlocks" which would be a list of blocks non-members can interact with while inside a different faction's claims.</issue_description>

Comments on the Issue (you are @copilot in this section)


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Add config option to allow outsiders to use fence gates Extend nonMembersCanInteractWithDoors to include fence gates Mar 22, 2026
Copilot AI requested a review from dmccoystephenson March 22, 2026 20:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the existing “allow non-members to interact with doors” protection exception so it also applies to fence gates, preventing players from bypassing the intended accessibility policy by using gates instead of doors.

Changes:

  • Add org.bukkit.block.data.type.Gate to the door/trapdoor interaction bypass condition.
  • Add a unit test covering fence gate interaction when the config option is enabled.
  • Update CONFIG.md to document that fence gates are included.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/main/kotlin/com/dansplugins/factionsystem/listener/PlayerInteractListener.kt Extends the interaction bypass condition to include Gate.
src/test/kotlin/com/dansplugins/factionsystem/listener/PlayerInteractListenerTest.kt Adds a new test validating fence gate interaction is allowed when the config is enabled.
CONFIG.md Updates config documentation to mention trapdoors and fence gates.

Comment on lines +158 to 163
// Handle door/trapdoor/fence gate special case
if (plugin.config.getBoolean("factions.nonMembersCanInteractWithDoors")) {
if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor) {
if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor || clickedBlock.blockData is Gate) {
return
}
}
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nonMembersCanInteractWithDoors early-return happens before the claim/wilderness lookup, so enabling this option currently bypasses wilderness interaction protection as well (and now does so for fence gates too). If the intent is “in faction territory” (per CONFIG.md), consider moving this special-case to after the claim is resolved (only apply it when claim != null).

Copilot uses AI. Check for mistakes.
// Handle door/trapdoor/fence gate special case
if (plugin.config.getBoolean("factions.nonMembersCanInteractWithDoors")) {
if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor) {
if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor || clickedBlock.blockData is Gate) {
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: blockData is already read into a local (val blockData = clickedBlock.blockData) earlier in this method. Reusing that variable here would avoid re-fetching clickedBlock.blockData three times and keeps the condition a bit cleaner.

Suggested change
if (clickedBlock.blockData is Door || clickedBlock.blockData is TrapDoor || clickedBlock.blockData is Gate) {
if (blockData is Door || blockData is TrapDoor || blockData is Gate) {

Copilot uses AI. Check for mistakes.
@dmccoystephenson
Copy link
Copy Markdown
Member

@copilot address comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants