-
Notifications
You must be signed in to change notification settings - Fork 96
Contexts
Contexts are a fundamental part of how GriefDefender is able to apply protection to claims. In order to understand how it works, you must first understand what a Context is. See https://github.com/lucko/LuckPerms/wiki/Context
Now that you have a basic understanding of what a context is and how they work with permissions, below is a list of contexts that GD uses with its flag and option command.
Context | Value | Description |
---|---|---|
gd_claim |
<claim_uuid> |
Applies flag to claim with specified uuid. |
gd_claim_default |
admin basic subdivision town global user
|
Applies flag as a default to all claims of type specified. Note: Use global as value to apply to all types.Note: Use user as value to apply to all types EXCEPT wilderness. |
gd_claim_override |
admin basic claim subdivision town global user
|
Applies flag as an override to all claims of type specified. Note: Use global as value to apply to all types.Note: Use user as value to apply to all types EXCEPT wilderness. |
source |
<source_id> |
Applies flag to a specific source. Example: minecraft:creeper
|
state |
<state> |
Applies flag to a specific block state. Example: powered:true See https://minecraft.gamepedia.com/Block_states for a list of all vanilla block states. |
used_item |
<item_id> |
Applies flag to a specific used item. Example: minecraft:diamond_sword
|
server |
<server_name> |
Applies flag to a specific server. Note: This uses the server name specified in permissions plugin. If no server context is specified or server name is not set, it defaults to global . |
world |
<world_name> |
Applies flag to a specific world. |
Note: Every flag or option permission will ALWAYS contain one of the following core contexts gd_claim
, gd_claim_default
, or gd_claim_override
.
Note: When using contexts with commands /cf
, /claimoption
, or flags.conf
you can use the following aliases for context keys
gd_claim_default
- default
gd_claim_override
- override
So as an example
/cf block-break grass false context[gd_claim_default=global]
is the same as
/cf block-break grass false context[default=global]
However, in LuckPerms it will ALWAYS show up as the actual context key which in this case would be gd_claim_default
Note: A uuid stands for Universal Unique Identifier which GD assigns to each claim created in the world.
- gd_claim
The context gd_claim=<claim_uuid>
is used to apply a flag or option to a specific claim that matches the uuid specified.
Note: If you ONLY want to apply a flag or option to the claim you are standing in, GD will automatically apply this context as long as you do not provide gd_claim
, gd_claim_default
, or gd_claim_override
in the context section of command.
Let's go over an example of how this would look in LuckPerms
{
"permission": "griefdefender.flag.entity-spawn",
"value": false,
"context": {
"gd_claim": "9594ca69-47d6-422a-8236-7c697d832ac9",
"target": "#animal"
}
},
This permission is denying the flag entity-spawn
in claim with uuid 9594ca69-47d6-422a-8236-7c697d832ac9
targeting only animals.
- gd_claim_default
The most important thing about this context is it acts as a default
permission meaning it is only applied
It is used to apply a flag or option to one or more claim types or globally.
Let's break each combination down
gd_claim_default=admin
- A permission containing this context will only affect admin claims and act as a default permission.
gd_claim_default=basic
- A permission containing this context will only affect basic claims and act as a default permission.
gd_claim_default=subdivision
- A permission containing this context will only affect subdivision claims and act as a default permission.
gd_claim_default=global
- A permission containing this context will all claims, including wilderness, and act as a default permission.
gd_claim_default=user
- A permission containing this context will all claims except wilderness and act as a default permission.
Taking our previous LuckPerms example, here is how it might show up as a permission
{
"permission": "griefdefender.flag.entity-spawn",
"value": false,
"context": {
"gd_claim_default": "admin",
"target": "#animal"
}
},
This permission is denying the flag entity-spawn
as a default on all admin claims and targeting only animals.
- gd_claim_override
The most important thing about this context is it is the only context that will affect claim owners.
It is used to apply a flag or option to a single claim, one or more claim types, or globally. It essentially acts as a ban.
Let's break each combination down
gd_claim_override=<claim_uuid>
- A permission containing this context will only affect the claim that contains the uuid.
Note: When using this context with commands, you can replace <claim_uuid>
with claim
and GD will automatically fill in the uuid.
gd_claim_override=admin
- A permission containing this context will only affect admin claims.
gd_claim_override=basic
- A permission containing this context will only affect basic claims.
gd_claim_override=subdivision
- A permission containing this context will only affect subdivision claims.
gd_claim_override=global
- A permission containing this context will all claims including wilderness.
gd_claim_override=user
- A permission containing this context will all claims except wilderness.
Let's go over an example of how this would look in LuckPerms
{
"permission": "griefdefender.flag.entity-spawn",
"value": false,
"context": {
"gd_claim_override": "basic",
"target": "#animal"
}
},
This permission is banning the ability to spawn animals in ALL basic claims. It will also affect claim owners.
One of the following contexts are required in every flag or option permission set in LuckPerms
gd_claim_default
, gd_claim
, gd_claim_override
The order of context priority in permissions is as follows starting with the lowest
-
gd_claim_default
- Lowest priority. Always used with thegriefdefender_definition
andgriefdefender_default
groups to apply as a default to all players. -
gd_claim
- Higher than default. If using commands or ADVANCED GUI, these permissions will always end up ingriefdefender_claim
group. If using the flag definition GUI w/ PRESET, permissions will always end up ingriefdefender_definition
.
Note: When using commands/cfp
,/cfg
,/cop
,/cog
which will apply a flag or permission to user or group, thegd_claim
context will always be used. -
gd_claim_override
- The highest priority context GD uses. GD will always do a permission lookup for any permission with this context. If found, this will be the end result. This context supports overrides to a single claim or multiple. For single claim, the claim uuid is used as the value. For multiple, the same values asgd_claim_default
can be used.