refactor: Improve perm-restricted warps, close #763

* Changes permission restricted warps to use `huskhomes.warp.<name>` for better compat, without the `.command.` subnode
* Fixes wildcard permission support: `huskhomes.warp.*`
* Improves documentation
This commit is contained in:
William278 committed 2025-02-02 18:01:33 +00:00
1 parent cf7ea31536
commit 473c5e77cc
11 files changed
+54 -31

No files matched your search

+1 -1
View File
@@ -433,7 +433,7 @@ This is a table of HuskHomes commands, how to use them, and their required permi
</table>
### Notes
&dagger; &mdash; If [Permission Restricted Warps](restricted-warps) are in use, the `huskhomes.command.warp.(warp_name)` permission node will also be required to be able to view and use warps.
&dagger; &mdash; If [Permission Restricted Warps](restricted-warps) are in use, the `huskhomes.warp.<name>` permission node will also be required to be able to list, use, edit and delete (but not set) warps. The `huskhomes.warp.*` wildcard permission grants the ability to access all warps.
&ddagger; &mdash; Requires `return_by_death` to be enabled in [`config.yml`](config-files).
+1 -1
View File
@@ -61,7 +61,7 @@ general:
max_public_homes: 10
# Whether permission limits (i.e. huskhomes.max_homes.<number>) should stack if the user inherits multiple nodes.
stack_permission_limits: false
# Whether users require a permission (huskhomes.command.warp.<warp_name>) to use warps
# Whether users require a permission (huskhomes.warp.<warp_name>) to use warps
permission_restrict_warps: false
# How long a player has to stand still and not take damage for when teleporting (in seconds)
teleport_warmup_time: 5
+27 -2
View File
@@ -1,3 +1,28 @@
HuskHomes supports restricting warps behind permission nodes. This means that players require a corresponding `huskhomes.command.warp.<name>` node to view and use warps, else they will see an error message.
HuskHomes supports restricting warps behind permission nodes through the **Permission-Restrict Warps** feature.
To enable permission-restricted warps, set `permission_restrict_warps` to `true` under `general`. Don't forget to grant users the necessary permission nodes (`huskhomes.command.warp.<name>`).
## Permissions
With `permission_restrict_warps` enabled in [`config.yml`](config-files), players are required to have a corresponding `huskhomes.warp.<name>` node. Note that this is a _different permission_ from the one required to use the `/warp` command, which is `huskhomes.command.warp`.
With the `huskhomes.warp.<name>` permission node, where `<name>` is the name of the warp, users can:
* Teleport to the warp with `/warp <name>`
* View the warp in the `/warplist`, or TAB-complete the warp
* Delete, or edit warps with that name, if they have access to the respective [[commands]]
If users have permission to set warps, they will still be able to set warps with names they do not have permission for, but be advised they will not be able to edit or delete the warp once set without permission. If you're using permission restricted warps, we therefore recommend also granting the wildcard warp permission (see below).
Note that the name of the warp is case-sensitive (i.e. the `huskhomes.warp.Home` permission node is different to the `huskhomes.warp.home` permission node).
Users with the `huskhomes.warp.*` permission will be able to use all warps.
## Configuring
To enable permission-restricted warps, set `permission_restrict_warps` to `true` under `general`. Don't forget to grant users the necessary permission nodes (`huskhomes.warp.<name>`).
<details>
<summary>Permission Restrict Warps &ndash; config.yml</summary>
```yaml
# Whether users require a permission (huskhomes.warp.<warp_name>) to use warps
permission_restrict_warps: false
```
</details>