From 633da45df2b89d9525afaba375c09b32998d900e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Tue, 15 Jun 2021 21:18:40 +0100 Subject: [PATCH] Updated to use more Java 16 feature --- .../proxy/v1_16_R1/enchants/EcoCraftEnchantment.java | 2 +- .../proxy/v1_16_R2/enchants/EcoCraftEnchantment.java | 2 +- .../proxy/v1_16_R3/enchants/EcoCraftEnchantment.java | 2 +- .../proxy/v1_17_R1/enchants/EcoCraftEnchantment.java | 2 +- .../support/vanilla/VanillaEnchantmentMetadata.java | 11 +++-------- .../support/vanilla/VanillaEnchantments.java | 4 +--- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/enchants/EcoCraftEnchantment.java index 7b7486d3..4e06cc54 100644 --- a/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/enchants/EcoCraftEnchantment.java +++ b/eco-core/core-nms/v1_16_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R1/enchants/EcoCraftEnchantment.java @@ -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 diff --git a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/enchants/EcoCraftEnchantment.java index 1ec08a45..6f387625 100644 --- a/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/enchants/EcoCraftEnchantment.java +++ b/eco-core/core-nms/v1_16_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R2/enchants/EcoCraftEnchantment.java @@ -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 diff --git a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/enchants/EcoCraftEnchantment.java index ec2f188f..227987d3 100644 --- a/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/enchants/EcoCraftEnchantment.java +++ b/eco-core/core-nms/v1_16_R3/src/main/java/com/willfp/ecoenchants/proxy/v1_16_R3/enchants/EcoCraftEnchantment.java @@ -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 diff --git a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java index 7e8aab2a..574606fe 100644 --- a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java +++ b/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java @@ -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 diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java index 462fd6de..8e57594a 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java @@ -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 +) { } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java index 5f750ba5..f75cc973 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java @@ -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); }