Merge remote-tracking branch 'origin/master'

This commit is contained in:
Auxilor 2021-06-16 13:35:45 +01:00
commit 8e1b5a022e
9 changed files with 25 additions and 32 deletions

View File

@ -18,7 +18,7 @@ public class EcoCraftEnchantment extends CraftEnchantment {
@Override
public int getMaxLevel() {
return metadata.getMaxLevel() == null ? this.getHandle().getMaxLevel() : metadata.getMaxLevel();
return metadata.maxLevel() == null ? this.getHandle().getMaxLevel() : metadata.maxLevel();
}
@Override

View File

@ -18,7 +18,7 @@ public class EcoCraftEnchantment extends CraftEnchantment {
@Override
public int getMaxLevel() {
return metadata.getMaxLevel() == null ? this.getHandle().getMaxLevel() : metadata.getMaxLevel();
return metadata.maxLevel() == null ? this.getHandle().getMaxLevel() : metadata.maxLevel();
}
@Override

View File

@ -18,7 +18,7 @@ public class EcoCraftEnchantment extends CraftEnchantment {
@Override
public int getMaxLevel() {
return metadata.getMaxLevel() == null ? this.getHandle().getMaxLevel() : metadata.getMaxLevel();
return metadata.maxLevel() == null ? this.getHandle().getMaxLevel() : metadata.maxLevel();
}
@Override

View File

@ -18,7 +18,7 @@ public class EcoCraftEnchantment extends CraftEnchantment {
@Override
public int getMaxLevel() {
return metadata.getMaxLevel() == null ? this.getHandle().getMaxLevel() : metadata.getMaxLevel();
return metadata.maxLevel() == null ? this.getHandle().getMaxLevel() : metadata.maxLevel();
}
@Override

View File

@ -28,8 +28,8 @@ public class Parasitic extends EcoEnchant {
if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) {
newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
}
if (attacker.getHealth() > 0) {
attacker.setHealth(newHealth);
}
if (attacker.getHealth() > 0) {
attacker.setHealth(newHealth);
}
}
}

View File

@ -43,19 +43,19 @@ public class Soulbound extends EcoEnchant {
return;
}
if (!(event.getEntity() instanceof Arrow)) {
if (player.getKiller() != null) {
Player killer = player.getKiller();
int reaperLevel = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER);
if (reaperLevel > 0) {
if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) {
if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, reaperLevel)) {
return;
}
}
}
}
}
if (!(event.getEntity() instanceof Arrow)) {
if (player.getKiller() != null) {
Player killer = player.getKiller();
int reaperLevel = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER);
if (reaperLevel > 0) {
if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) {
if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, reaperLevel)) {
return;
}
}
}
}
}
for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack == null) {
continue;

View File

@ -1,11 +1,6 @@
package com.willfp.ecoenchants.enchantments.support.vanilla;
import lombok.Data;
@Data
public class VanillaEnchantmentMetadata {
/**
* The maximum level for the enchantment.
*/
private Integer maxLevel = null;
public record VanillaEnchantmentMetadata(
Integer maxLevel
) {
}

View File

@ -51,9 +51,7 @@ public class VanillaEnchantments {
));
for (Enchantment enchantment : enchantments) {
VanillaEnchantmentMetadata metadata = new VanillaEnchantmentMetadata();
metadata.setMaxLevel(maxLevels.get(enchantment));
VanillaEnchantmentMetadata metadata = new VanillaEnchantmentMetadata(maxLevels.get(enchantment));
map.put(enchantment, metadata);
}

View File

@ -1,2 +1,2 @@
version = 7.8.0
version = 7.8.1
plugin-name = EcoEnchants