Commits
1 1 | package org.bukkit.attribute; |
2 2 | |
3 + | import org.bukkit.Keyed; |
4 + | import org.bukkit.NamespacedKey; |
5 + | import org.jetbrains.annotations.NotNull; |
6 + | |
3 7 | /** |
4 8 | * Types of attributes which may be present on an {@link Attributable}. |
5 9 | */ |
6 - | public enum Attribute { |
10 + | public enum Attribute implements Keyed { |
7 11 | |
8 12 | /** |
9 13 | * Maximum health of an Entity. |
10 14 | */ |
11 - | GENERIC_MAX_HEALTH, |
15 + | GENERIC_MAX_HEALTH("generic.max_health"), |
12 16 | /** |
13 17 | * Range at which an Entity will follow others. |
14 18 | */ |
15 - | GENERIC_FOLLOW_RANGE, |
19 + | GENERIC_FOLLOW_RANGE("generic.follow_range"), |
16 20 | /** |
17 21 | * Resistance of an Entity to knockback. |
18 22 | */ |
19 - | GENERIC_KNOCKBACK_RESISTANCE, |
23 + | GENERIC_KNOCKBACK_RESISTANCE("generic.knockback_resistance"), |
20 24 | /** |
21 25 | * Movement speed of an Entity. |
22 26 | */ |
23 - | GENERIC_MOVEMENT_SPEED, |
27 + | GENERIC_MOVEMENT_SPEED("generic.movement_speed"), |
24 28 | /** |
25 29 | * Flying speed of an Entity. |
26 30 | */ |
27 - | GENERIC_FLYING_SPEED, |
31 + | GENERIC_FLYING_SPEED("generic.flying_speed"), |
28 32 | /** |
29 33 | * Attack damage of an Entity. |
30 34 | */ |
31 - | GENERIC_ATTACK_DAMAGE, |
35 + | GENERIC_ATTACK_DAMAGE("generic.attack_damage"), |
36 + | /** |
37 + | * Attack knockback of an Entity. |
38 + | */ |
39 + | GENERIC_ATTACK_KNOCKBACK("generic.attack_knockback"), |
32 40 | /** |
33 41 | * Attack speed of an Entity. |
34 42 | */ |
35 - | GENERIC_ATTACK_SPEED, |
43 + | GENERIC_ATTACK_SPEED("generic.attack_speed"), |
36 44 | /** |
37 45 | * Armor bonus of an Entity. |
38 46 | */ |
39 - | GENERIC_ARMOR, |
47 + | GENERIC_ARMOR("generic.armor"), |
40 48 | /** |
41 49 | * Armor durability bonus of an Entity. |
42 50 | */ |
43 - | GENERIC_ARMOR_TOUGHNESS, |
51 + | GENERIC_ARMOR_TOUGHNESS("generic.armor_toughness"), |
44 52 | /** |
45 53 | * Luck bonus of an Entity. |
46 54 | */ |
47 - | GENERIC_LUCK, |
55 + | GENERIC_LUCK("generic.luck"), |
48 56 | /** |
49 57 | * Strength with which a horse will jump. |
50 58 | */ |
51 - | HORSE_JUMP_STRENGTH, |
59 + | HORSE_JUMP_STRENGTH("horse.jump_strength"), |
52 60 | /** |
53 61 | * Chance of a zombie to spawn reinforcements. |
54 62 | */ |
55 - | ZOMBIE_SPAWN_REINFORCEMENTS; |
63 + | ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawn_reinforcements"); |
64 + | |
65 + | private final NamespacedKey key; |
66 + | |
67 + | private Attribute(String key) { |
68 + | this.key = NamespacedKey.minecraft(key); |
69 + | } |
70 + | |
71 + | |
72 + | |
73 + | public NamespacedKey getKey() { |
74 + | return key; |
75 + | } |
56 76 | } |