-
Notifications
You must be signed in to change notification settings - Fork 0
Creating Custom Attributes
This feature is part of the Pro version and requires a purchase of this plugin from SpigotMC.
This picks up from the Attributes tutorial which contains a general overview of the built-in attributes.
These cover all the options which are configurable with attributes. Any of the built-in attributes can be modified, removed and new ones can easily be added.
The name of the attribute.
The description of the attribute.
The type of attribute. There are two options:
-
integer- The attribute value is stored as a whole number (i.e.1). -
double- The attribute is stored as a decimal (i.e.1.0).
The lore line which is rendered in the item. There are placeholders which can be used here:
-
%operator% - The rendered operator displayed based on the value of the attribute. If the number is positive, a+will be shown, and a-` when negative. - %value% - The displayed value of the attribute.
The color of the attribute. Can either be a named color (i.e. green, red, etc.), or a hex code (i.e. #d52b2b)
The slots which the attribute will work in. The following values can be used: head, chest, legs, feet, main_hand, off_hand), body, all.
Handles where, when and how the attribute is applied to the player. This contains many sub-options which control this behavior.
Options:
-
type: The type of attribute. Eithervanilla(which corresponds to the built-in vanilla keys);externalfor third party plugins; orbuiltinwhich has no behavior on its own, but can be used as a stored value in other cases. -
key: The key of the attribute. If usingvanillaorexternal, this will correspond to the key of the vanilla attribute, or the external one. When usingbuiltin, this is the key in which the attribute value is stored. -
operation: Controls how the attribute value is applied. Eitheraddwhich adds the raw value,percentagewhich turns the attribute into a percentage, ortotal_percentagewhich multiples based on the modifiers amounts. Modeled closely from the vanilla operations respectively. -
modifier-expression: Operations ran on the modifier value, allowing for more complex operations. Supports various math expressions (see defense attribute). -
event: When the attribute should be applied. Typically useful forbuiltinattributes where the stored attribute value should be applied somewhere.
Event List:
-
entity_damage- Called when a player deals damage. Lets you increase or decrease damage dealt. -
entity_take_damage- Called when an entity takes damage. Lets you increase or decrease the amount of damage an entity takes. -
projectile_launch- Called when a projectile launches. Lets you increase or decrease the amount of damage a projectile deals. -
regen- Called when a player heals. Lets you control how much a player heals or loses health.