Updated to use more Java 16 feature

This commit is contained in:
Auxilor 2021-06-15 21:18:40 +01:00
parent c3c158207d
commit 633da45df2
6 changed files with 8 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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