mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 16:39:25 +00:00
Merge pull request #13
Fixed double egg consuming, added null check for all attributes
This commit is contained in:
@@ -150,18 +150,23 @@ public class LivingEcoBoss extends PluginDependent<EcoPlugin> {
|
|||||||
movementSpeed.addModifier(new AttributeModifier(entity.getUniqueId(), "ecobosses-movement-multiplier", boss.getMovementSpeedMultiplier() - 1, AttributeModifier.Operation.MULTIPLY_SCALAR_1));
|
movementSpeed.addModifier(new AttributeModifier(entity.getUniqueId(), "ecobosses-movement-multiplier", boss.getMovementSpeedMultiplier() - 1, AttributeModifier.Operation.MULTIPLY_SCALAR_1));
|
||||||
|
|
||||||
AttributeInstance maxHealth = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
AttributeInstance maxHealth = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||||
assert maxHealth != null;
|
if (maxHealth != null) {
|
||||||
maxHealth.setBaseValue(boss.getMaxHealth());
|
maxHealth.getModifiers().clear();
|
||||||
|
maxHealth.setBaseValue(boss.getMaxHealth());
|
||||||
entity.setHealth(maxHealth.getValue());
|
entity.setHealth(maxHealth.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
AttributeInstance followRange = entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE);
|
AttributeInstance followRange = entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE);
|
||||||
assert followRange != null;
|
if (followRange != null) {
|
||||||
followRange.setBaseValue(boss.getFollowRange());
|
followRange.getModifiers().clear();
|
||||||
|
followRange.setBaseValue(boss.getFollowRange());
|
||||||
|
}
|
||||||
|
|
||||||
AttributeInstance attackDamage = entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
|
AttributeInstance attackDamage = entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
|
||||||
assert attackDamage != null;
|
if (attackDamage != null) {
|
||||||
attackDamage.setBaseValue(boss.getAttackDamage());
|
attackDamage.getModifiers().clear();
|
||||||
|
attackDamage.setBaseValue(boss.getAttackDamage());
|
||||||
|
}
|
||||||
|
|
||||||
for (OptionedSound sound : boss.getSpawnSounds()) {
|
for (OptionedSound sound : boss.getSpawnSounds()) {
|
||||||
entity.getWorld().playSound(entity.getLocation(), sound.sound(), sound.volume(), sound.pitch());
|
entity.getWorld().playSound(entity.getLocation(), sound.sound(), sound.volume(), sound.pitch());
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ public class SpawnListeners extends PluginDependent<EcoPlugin> implements Listen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setAmount(item.getAmount() - 1);
|
|
||||||
|
|
||||||
if (event.getHand() == EquipmentSlot.HAND) {
|
if (event.getHand() == EquipmentSlot.HAND) {
|
||||||
ItemStack hand = event.getPlayer().getInventory().getItemInMainHand();
|
ItemStack hand = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
hand.setAmount(hand.getAmount() - 1);
|
hand.setAmount(hand.getAmount() - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user