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
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

@ -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);
}