Skip to content

Re: ✨ add t+-.tpll.newchunks permission node for non-generated chunks - #91

Open
MaxLananas wants to merge 8 commits into
BTE-Germany:mainfrom
MaxLananas:main
Open

Re: ✨ add t+-.tpll.newchunks permission node for non-generated chunks#91
MaxLananas wants to merge 8 commits into
BTE-Germany:mainfrom
MaxLananas:main

Conversation

@MaxLananas

@MaxLananas MaxLananas commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Implements the permission node t+-.tpll.newchunks requested in #74.
Players without this permission can still use /tpll to already-generated areas, but cannot trigger new chunk generation. Useful for servers where Visitors should be able to navigate built areas without accidentally loading new terrain.

Changes

  • Added TPLL_NEW_CHUNKS to Permission.java
  • Added chunk generation check in TpllCommand#execute() using World#isChunkGenerated()
  • For Multiverse setups, the check spans all linked worlds since the final destination world is not yet known at that point

Permission

Node Default Description
t+-.tpll.newchunks false Allows /tpll to ungenerated chunks

Notes

  • Admins (t+-.admin) bypass the check implicitly via their permission setup
  • The Multiverse multi-world check is necessary because before height resolution, we don't know which linked world will be the final destination, so we accept the teleport if the chunk exists in any of them

@Zoriot Zoriot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Other than that LGTM & it works fine.

Comment thread src/main/java/de/btegermany/terraplusminus/commands/TpllCommand.java Outdated
@Zoriot Zoriot linked an issue Jul 13, 2026 that may be closed by this pull request
@MaxLananas

Copy link
Copy Markdown
Contributor Author

Following the discussion in #74 and feedback from @Zoriot and @Agrrox, I reworked the approach. Original design had t+-.tpll.newchunks as opt-in with default: false, meaning unrestricted tpll needed an extra node on top of t+-.tpll, breaks existing setups. t+-.tpll is now a parent of t+-.tpll.ungenerated-chunks, both default to true. Wanna restrict visitors? Just set t+-.tpll.ungenerated-chunks: false in your perm manager, nothing else changes.

Changelog

  • Renamed TPLL_NEW_CHUNKS to TPLL_UNGENERATED_CHUNKS in Permission.java
  • Permission node t+-.tpll.newchunks to t+-.tpll.ungenerated-chunks
  • t+-.tpll declared as parent of t+-.tpll.ungenerated-chunks in build.gradle.kts via plugin-yml
  • Check moved right before each teleport call (isPermittedToTeleport), following @Zoriot's early-return style
  • Multiverse multi-world check preserved, final destination world isn't known before height resolution, so we accept if the chunk exists in any linked world

Permissions

Node Default Description
t+-.tpll true Allows /tpll, parent of ungenerated-chunks
t+-.tpll.ungenerated-chunks true (inherited) Set to false to block teleport to ungenerated chunks

@MaxLananas
MaxLananas requested a review from Zoriot July 19, 2026 17:36
* linked worlds are checked, because the final destination depends on the computed height and may
* differ from {@code world}.
*/
private static boolean isChunkGeneratedInAnyRelevantWorld(int chunkX, int chunkZ, @NonNull World world) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clarify why this method is needed at all? Instead, you could also Just add the check inside getHeightFromMapsAndTeleportIfThere or not?

Comment thread gradle/libs.versions.toml
Comment on lines 15 to +40
@@ -32,6 +36,8 @@ paper-api = { module = "io.papermc.paper:paper-api", version.ref = "paper-api" }
pluginupdater-paper = { module = "org.lushplugins.pluginupdater:updater.paper-api", version.ref = "pluginupdater" }
pluginupdater-common = { module = "org.lushplugins.pluginupdater:updater.common-api", version.ref = "pluginupdater" }
terraminusminus = { module = "net.buildtheearth.terraminusminus:terraminusminus-bukkit", version.ref = "terraminusminus" }
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You currently have a lot of unrelated changes in your pr. Please remove these change and rebase / merge (i prefer a rebase and force push in such cases)

You should also not remove comments or change the formatting of code which is not related to your changes.

If you need help with that lmk

Comment thread build.gradle.kts
Comment on lines +76 to +87
register("t+-.admin") {
description = "Grants all Terraplusminus permissions"
default = BukkitPluginDescription.Permission.Default.OP
children = mapOf(
"t+-.tpll" to true,
"t+-.forcetpll" to true,
"t+-.where" to true,
"t+-.offset" to true,
"t+-.distortion" to true,
"t+-.notify.update" to true
)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You have now changed the behaviour of t+-.admin without documenting that inside of the Readme.
I'm generally fine with introducing permpacks, please then also supply a builder and visitor permpack and i think a permission node like t+-.permpack.visitor would make more sense.
Then the permission behaviour is also not changed.

Comment thread build.gradle.kts
}
register("t+-.tpll") {
description = "Allows usage of /tpll"
default = BukkitPluginDescription.Permission.Default.TRUE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please don't change the behaviour with defaulting to true. This is unexpected tp server owners and a breaking change we shouldn't do yet.

If you think that make long term sense please make a issue and we will incude that in v2.

Comment thread gradle/libs.versions.toml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Your commits are poorly named. Please make proper commits out of it. If you need help lmk.

It seems like you are not using IntelliJ. That's generally fine though I may not be familiar with your setuo then.

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.

Add tpll permission node for non generated chunks

2 participants