Skip to content

Permission Attachment

Ethan Bacurio edited this page Jul 30, 2022 · 2 revisions

Available on versions 0.1.28+ of CommandPrompter

Permission attachments allow players to have temporary access to command permissions. This was implemented to mitigate or potentially solve the problem that arises when a command is dispatched as OP or console for a player.

How to use Permission Attachment

The general idea is to give players a set of permission that you define in a very short amount of time. This permission set and the duration can be found and configured in config.yml under the Permission Attachment section.

Step 1: Configuring permissions

# Permission Attachment Config
# 
# Permission attachments allow players
# to have temporary permissions.
# 
# ticks - Set how long (in ticks) should the
#         permission attachment persist.
# 
# permissions - permissions to temporarily
#               attach to the players.
Permission-Attachment:
  ticks: 1
  permissions:
  - sample.permission
  - sample.permission2

With the given configuration above, CommandPrompter should now give players temporary access to the permission [sample.permission, sample.permission] for 1 tick. Depending on the performance of the server, you may need to set ticks to a higher value, just note that 20 ticks = 1 second

Step 2: Using permission attachments in a prompt

To use the permission attachment to players, a prompt needs to have an argument -pa (with space). This argument only needs to be on one of the prompts if you're going to have multiple. The argument -pa could also be used with other prompt types argument.

Examples:

A simple chat prompt with permission attachment
/samplecommand <-pa Sample Prompt>

An anvil prompt followed by a chat prompt with permission attachment
/samplecommand <-pa -a Sample Prompt> <Sample Prompt2>