Skip to content
Crypto Morin edited this page Jul 6, 2023 · 43 revisions

Not Frequently Asked Questions

But we're here to answer them anyways.

Table of Contents


Making custom misc upgrades

We're going to be making a custom misc upgrade that adds permission for players. Thankfully LuckPerms Contextual Permissions make this easier.

  1. In misc-upgrades.yml we're going to add a new entry.
custom-misc-upgrade: # The name here will be important later for permissions and GUIs
  enabled: true
  can-be-disabled: true
  max-level: 3
  1. Make a new permission group using /lp creategroup kingdoms This is where all kingdom related permissions will reside.

  2. We need to install ExtraContexts official LuckPerms addon to work for PlaceholderAPI oriented contexts.

  3. Enable placeholder API support in the ExtraContexts config.yml and add the a new placeholder for the misc upgrade:

placeholderapi: false
placeholderapi-placeholders:
  allowflight: "%player_allow_flight%"
  customMiscUpgrade: "%kingdoms_kingdom_upgrade:level type=misc, of=CUSTOM_MISC_UPGRADE%"

Here we used a complicated functional placeholder. The of option is determined by the config entry name. We used custom-misc-upgrade. A rule of thumb is that whatever name you used, make all the characters uppercase and replace - with _.

  1. Add contextual permissions:
  • /lp group kingdoms permission set kingdoms.misc.custom.1 true customMiscUpgrade=1
  • /lp group kingdoms permission set kingdoms.misc.custom.2 true customMiscUpgrade=2
  • /lp group kingdoms permission set kingdoms.misc.custom.3 true customMiscUpgrade=3

Here we chose kingdoms.misc.custom.x, but really, it could be any permission! customMiscUpgrade is the context which relies on a single integer.

  1. Make the default group inherit our newly created group: /lp group default parent add kingdoms
    This will allow all permissions to automatically use this group no matter what. Now, you might be asking, doesn't this give them the permissions right away whether they have the upgrade or not, or even in a kingdom at all? No, it doesn't because we used contextual permissions which is basically a way of saying "you only have this permission if a certain condition is met" and those conditions being our contexts.

Note that contextual permissions are not that perfect. If you for whatever reason needed to check these permission for a player that's offline, it won't work correctly due to performance issues from LuckPerms side.

Basics

Advanced

Others

Clone this wiki locally