13
0
geforkt von Mirrors/Paper

SPIGOT-5805: NPE when getting an Attribute from a Player

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2020-06-25 13:19:09 +10:00
Ursprung 996e9de16b
Commit e61abecd39

Datei anzeigen

@ -1,6 +1,5 @@
package org.bukkit.attribute; package org.bukkit.attribute;
import java.util.Locale;
import org.bukkit.Keyed; import org.bukkit.Keyed;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -13,56 +12,60 @@ public enum Attribute implements Keyed {
/** /**
* Maximum health of an Entity. * Maximum health of an Entity.
*/ */
GENERIC_MAX_HEALTH, GENERIC_MAX_HEALTH("generic.max_health"),
/** /**
* Range at which an Entity will follow others. * Range at which an Entity will follow others.
*/ */
GENERIC_FOLLOW_RANGE, GENERIC_FOLLOW_RANGE("generic.follow_range"),
/** /**
* Resistance of an Entity to knockback. * Resistance of an Entity to knockback.
*/ */
GENERIC_KNOCKBACK_RESISTANCE, GENERIC_KNOCKBACK_RESISTANCE("generic.knockback_resistance"),
/** /**
* Movement speed of an Entity. * Movement speed of an Entity.
*/ */
GENERIC_MOVEMENT_SPEED, GENERIC_MOVEMENT_SPEED("generic.movement_speed"),
/** /**
* Flying speed of an Entity. * Flying speed of an Entity.
*/ */
GENERIC_FLYING_SPEED, GENERIC_FLYING_SPEED("generic.flying_speed"),
/** /**
* Attack damage of an Entity. * Attack damage of an Entity.
*/ */
GENERIC_ATTACK_DAMAGE, GENERIC_ATTACK_DAMAGE("generic.attack_damage"),
/**
* Attack knockback of an Entity.
*/
GENERIC_ATTACK_KNOCKBACK("generic.attack_knockback"),
/** /**
* Attack speed of an Entity. * Attack speed of an Entity.
*/ */
GENERIC_ATTACK_SPEED, GENERIC_ATTACK_SPEED("generic.attack_speed"),
/** /**
* Armor bonus of an Entity. * Armor bonus of an Entity.
*/ */
GENERIC_ARMOR, GENERIC_ARMOR("generic.armor"),
/** /**
* Armor durability bonus of an Entity. * Armor durability bonus of an Entity.
*/ */
GENERIC_ARMOR_TOUGHNESS, GENERIC_ARMOR_TOUGHNESS("generic.armor_toughness"),
/** /**
* Luck bonus of an Entity. * Luck bonus of an Entity.
*/ */
GENERIC_LUCK, GENERIC_LUCK("generic.luck"),
/** /**
* Strength with which a horse will jump. * Strength with which a horse will jump.
*/ */
HORSE_JUMP_STRENGTH, HORSE_JUMP_STRENGTH("horse.jump_strength"),
/** /**
* Chance of a zombie to spawn reinforcements. * Chance of a zombie to spawn reinforcements.
*/ */
ZOMBIE_SPAWN_REINFORCEMENTS; ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawn_reinforcements");
private final NamespacedKey key; private final NamespacedKey key;
private Attribute() { private Attribute(String key) {
this.key = NamespacedKey.minecraft(this.name().toLowerCase(Locale.ROOT)); this.key = NamespacedKey.minecraft(key);
} }
@NotNull @NotNull