v4.0.3 beta

This commit is contained in:
BuildTools 2024-04-03 21:29:47 +05:00
parent 79812ec42b
commit 77414a8172
15 changed files with 43 additions and 20 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -32,6 +32,8 @@ public interface EnchantmentData {
boolean isAvailableToUse(@NotNull World world);
boolean checkEnchantLimit(@NotNull ItemStack item);
boolean checkEnchantCategory(@NotNull ItemStack item);
boolean checkItemCategory(@NotNull ItemStack item);

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -73,32 +73,32 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>API</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_19_R3</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_20_R1</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_20_R2</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>V1_20_R3</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -51,6 +51,11 @@ public class Config {
"[Default is true]"
);
public static final ConfigValue<Integer> CORE_ITEM_ENCHANT_LIMIT = ConfigValue.create("Core.Item_Enchantments_Limit",
3,
"Sets max. amount of custom enchantments per item.",
"[Default is 3]");
public static final ConfigValue<Boolean> CORE_SWORD_ENCHANTS_TO_AXES = ConfigValue.create("Core.Sword_Enchants_To_Axes",
true,
"Sets whether or not Sword enchantments can be applied on Axes.",

View File

@ -343,6 +343,14 @@ public abstract class AbstractEnchantmentData extends AbstractFileData<EnchantsP
return this.isAvailableToUse(entity.getWorld());
}
@Override
public boolean checkEnchantLimit(@NotNull ItemStack item) {
int limit = Config.CORE_ITEM_ENCHANT_LIMIT.get();
int has = EnchantUtils.countCustomEnchantments(item);
return has < limit;
}
@Override
public final boolean checkEnchantCategory(@NotNull ItemStack item) {
EnchantmentTarget category = this.getCategory();

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -33,7 +33,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>API</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -27,7 +27,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -73,6 +73,8 @@ public class CustomEnchantment extends Enchantment {
}
public boolean canEnchant(@NotNull org.bukkit.inventory.ItemStack bukkitItem) {
if (!this.enchantmentData.checkEnchantLimit(bukkitItem)) return false;
if (!this.enchantmentData.hasItemCategory()) {
if (this.enchantmentData.checkEnchantCategory(bukkitItem)) return true;
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -27,7 +27,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -73,6 +73,8 @@ public class CustomEnchantment extends Enchantment {
}
public boolean canEnchant(@NotNull org.bukkit.inventory.ItemStack bukkitItem) {
if (!this.enchantmentData.checkEnchantLimit(bukkitItem)) return false;
if (!this.enchantmentData.hasItemCategory()) {
if (this.enchantmentData.checkEnchantCategory(bukkitItem)) return true;
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -27,7 +27,7 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -73,6 +73,8 @@ public class CustomEnchantment extends Enchantment {
}
public boolean canEnchant(@NotNull org.bukkit.inventory.ItemStack bukkitItem) {
if (!this.enchantmentData.checkEnchantLimit(bukkitItem)) return false;
if (!this.enchantmentData.hasItemCategory()) {
if (this.enchantmentData.checkEnchantCategory(bukkitItem)) return true;
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ExcellentEnchants</artifactId>
<groupId>su.nightexpress.excellentenchants</groupId>
<version>4.0.2</version>
<version>4.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -27,12 +27,12 @@
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>API</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
<dependency>
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>NMS</artifactId>
<version>4.0.2</version>
<version>4.0.3</version>
</dependency>
</dependencies>

View File

@ -73,6 +73,8 @@ public class CustomEnchantment extends Enchantment {
}
public boolean canEnchant(@NotNull org.bukkit.inventory.ItemStack bukkitItem) {
if (!this.enchantmentData.checkEnchantLimit(bukkitItem)) return false;
if (!this.enchantmentData.hasItemCategory()) {
if (this.enchantmentData.checkEnchantCategory(bukkitItem)) return true;
}

View File

@ -7,7 +7,7 @@
<groupId>su.nightexpress.excellentenchants</groupId>
<artifactId>ExcellentEnchants</artifactId>
<packaging>pom</packaging>
<version>4.0.2</version>
<version>4.0.3</version>
<modules>
<module>Core</module>
<module>NMS</module>