v3.5.5
This commit is contained in:
parent
a8750a17e4
commit
e48e76e503
12
Core/pom.xml
12
Core/pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -81,27 +81,27 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>NMS</artifactId>
|
<artifactId>NMS</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>V1_17_R1</artifactId>
|
<artifactId>V1_17_R1</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>V1_18_R2</artifactId>
|
<artifactId>V1_18_R2</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>V1_19_R3</artifactId>
|
<artifactId>V1_19_R3</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>V1_20_R1</artifactId>
|
<artifactId>V1_20_R1</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,10 @@ public class Config {
|
||||||
"Use '" + Placeholders.GENERIC_AMOUNT + "' placeholder for amount of charges.")
|
"Use '" + Placeholders.GENERIC_AMOUNT + "' placeholder for amount of charges.")
|
||||||
.setWriter((cfg, path, map) -> map.forEach((perc, str) -> cfg.set(path + "." + perc, str)));
|
.setWriter((cfg, path, map) -> map.forEach((perc, str) -> cfg.set(path + "." + perc, str)));
|
||||||
|
|
||||||
|
public static final JOption<Boolean> ENCHANTMENTS_CHARGES_COMPARE_TYPE_ONLY = JOption.create("Enchantments.Charges.Compare_Material_Only", false,
|
||||||
|
"When enabled, only item material will be checked to determine if item can be used as an enchantment fuel.",
|
||||||
|
"When disabled (default), it will compare the whole item meta including name, lore, model data etc.");
|
||||||
|
|
||||||
public static final JOption<ItemStack> ENCHANTMENTS_CHARGES_FUEL_ITEM = JOption.create("Enchantments.Charges.Fuel_Item",
|
public static final JOption<ItemStack> ENCHANTMENTS_CHARGES_FUEL_ITEM = JOption.create("Enchantments.Charges.Fuel_Item",
|
||||||
new ItemStack(Material.LAPIS_LAZULI),
|
new ItemStack(Material.LAPIS_LAZULI),
|
||||||
"Default item used to recharge item's enchantments on anvils.",
|
"Default item used to recharge item's enchantments on anvils.",
|
||||||
|
|
|
@ -333,6 +333,9 @@ public abstract class ExcellentEnchant extends Enchantment implements IEnchantme
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChargesFuel(@NotNull ItemStack item) {
|
public boolean isChargesFuel(@NotNull ItemStack item) {
|
||||||
|
if (Config.ENCHANTMENTS_CHARGES_COMPARE_TYPE_ONLY.get()) {
|
||||||
|
return item.getType() == this.getChargesFuel().getType();
|
||||||
|
}
|
||||||
return item.isSimilar(this.getChargesFuel());
|
return item.isSimilar(this.getChargesFuel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import su.nexmedia.engine.utils.EntityUtil;
|
||||||
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
import su.nightexpress.excellentenchants.ExcellentEnchants;
|
||||||
import su.nightexpress.excellentenchants.api.enchantment.meta.Arrowed;
|
import su.nightexpress.excellentenchants.api.enchantment.meta.Arrowed;
|
||||||
import su.nightexpress.excellentenchants.api.enchantment.type.*;
|
import su.nightexpress.excellentenchants.api.enchantment.type.*;
|
||||||
|
import su.nightexpress.excellentenchants.config.Config;
|
||||||
import su.nightexpress.excellentenchants.enchantment.EnchantManager;
|
import su.nightexpress.excellentenchants.enchantment.EnchantManager;
|
||||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer;
|
import su.nightexpress.excellentenchants.enchantment.util.EnchantDropContainer;
|
||||||
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
|
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
|
||||||
|
@ -97,7 +98,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
combatEnchant.consumeChargesNoUpdate(weapon, level);
|
combatEnchant.consumeChargesNoUpdate(weapon, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(weapon);
|
EnchantUtils.updateChargesDisplay(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCombatArmorEnchants(@NotNull EntityDamageByEntityEvent e,
|
private void handleCombatArmorEnchants(@NotNull EntityDamageByEntityEvent e,
|
||||||
|
@ -116,7 +117,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
combatEnchant.consumeChargesNoUpdate(armor, level);
|
combatEnchant.consumeChargesNoUpdate(armor, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(armor);
|
EnchantUtils.updateChargesDisplay(armor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
enchant.consumeChargesNoUpdate(item, level);
|
enchant.consumeChargesNoUpdate(item, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(item);
|
EnchantUtils.updateChargesDisplay(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
bowEnchant.consumeChargesNoUpdate(bow, level);
|
bowEnchant.consumeChargesNoUpdate(bow, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(bow);
|
EnchantUtils.updateChargesDisplay(bow);
|
||||||
|
|
||||||
if (e.getProjectile() instanceof Projectile projectile) {
|
if (e.getProjectile() instanceof Projectile projectile) {
|
||||||
this.setSourceWeapon(projectile, bow);
|
this.setSourceWeapon(projectile, bow);
|
||||||
|
@ -208,7 +209,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
interEnchant.consumeChargesNoUpdate(item, level);
|
interEnchant.consumeChargesNoUpdate(item, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(item);
|
EnchantUtils.updateChargesDisplay(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
|
@ -225,7 +226,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
enchant.consumeChargesNoUpdate(item, level);
|
enchant.consumeChargesNoUpdate(item, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(item);
|
EnchantUtils.updateChargesDisplay(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
@ -242,7 +243,9 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
deathEnchant.consumeChargesNoUpdate(item, level);
|
deathEnchant.consumeChargesNoUpdate(item, level);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
EnchantUtils.updateDisplay(item);
|
if (Config.ENCHANTMENTS_CHARGES_ENABLED.get()) {
|
||||||
|
EnchantUtils.updateChargesDisplay(item);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Player killer = entity.getKiller();
|
Player killer = entity.getKiller();
|
||||||
|
@ -257,7 +260,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
deathEnchant.consumeChargesNoUpdate(weapon, level);
|
deathEnchant.consumeChargesNoUpdate(weapon, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(weapon);
|
EnchantUtils.updateChargesDisplay(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle BlockBreak enchantments.
|
// Handle BlockBreak enchantments.
|
||||||
|
@ -275,7 +278,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
blockEnchant.consumeChargesNoUpdate(tool, level);
|
blockEnchant.consumeChargesNoUpdate(tool, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(tool);
|
EnchantUtils.updateChargesDisplay(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
@ -293,7 +296,7 @@ public class EnchantHandlerListener extends AbstractListener<ExcellentEnchants>
|
||||||
enchant.consumeChargesNoUpdate(tool, level);
|
enchant.consumeChargesNoUpdate(tool, level);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(tool);
|
EnchantUtils.updateChargesDisplay(tool);
|
||||||
|
|
||||||
BlockState state = e.getBlockState();
|
BlockState state = e.getBlockState();
|
||||||
World world = state.getWorld();
|
World world = state.getWorld();
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class EnchantmentsListMenu extends ConfigMenu<ExcellentEnchants> implemen
|
||||||
if (lore == null) lore = new ArrayList<>();
|
if (lore == null) lore = new ArrayList<>();
|
||||||
|
|
||||||
List<String> conflicts = enchant.getConflicts().isEmpty() ? Collections.emptyList() : new ArrayList<>(this.enchantLoreConflicts);
|
List<String> conflicts = enchant.getConflicts().isEmpty() ? Collections.emptyList() : new ArrayList<>(this.enchantLoreConflicts);
|
||||||
List<String> conflictNames = enchant.getConflicts().stream().map(EnchantUtils::getLocalized).toList();
|
List<String> conflictNames = enchant.getConflicts().stream().map(EnchantUtils::getLocalized).filter(Objects::nonNull).toList();
|
||||||
conflicts = StringUtil.replace(conflicts, Placeholders.ENCHANTMENT_NAME, true, conflictNames);
|
conflicts = StringUtil.replace(conflicts, Placeholders.ENCHANTMENT_NAME, true, conflictNames);
|
||||||
|
|
||||||
List<String> charges = enchant.isChargesEnabled() ? new ArrayList<>(this.enchantLoreCharges) : Collections.emptyList();
|
List<String> charges = enchant.isChargesEnabled() ? new ArrayList<>(this.enchantLoreCharges) : Collections.emptyList();
|
||||||
|
|
|
@ -45,10 +45,10 @@ public class EnchantUtils {
|
||||||
return NamespacedKey.minecraft(id.toLowerCase());
|
return NamespacedKey.minecraft(id.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@Nullable
|
||||||
public static String getLocalized(@NotNull String keyRaw) {
|
public static String getLocalized(@NotNull String keyRaw) {
|
||||||
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(keyRaw));
|
Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(keyRaw));
|
||||||
return enchantment == null ? "null" : getLocalized(enchantment);
|
return enchantment == null ? null : getLocalized(enchantment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -175,6 +175,12 @@ public class EnchantUtils {
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateChargesDisplay(@NotNull ItemStack item) {
|
||||||
|
if (Config.ENCHANTMENTS_CHARGES_ENABLED.get()) {
|
||||||
|
updateDisplay(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean updateDisplay(@NotNull ItemStack item) {
|
public static boolean updateDisplay(@NotNull ItemStack item) {
|
||||||
if (Config.ENCHANTMENTS_DISPLAY_MODE.get() != 1) return false;
|
if (Config.ENCHANTMENTS_DISPLAY_MODE.get() != 1) return false;
|
||||||
|
|
||||||
|
@ -399,7 +405,7 @@ public class EnchantUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
EnchantUtils.updateDisplay(item);
|
EnchantUtils.updateChargesDisplay(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>NMS</artifactId>
|
<artifactId>NMS</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>NMS</artifactId>
|
<artifactId>NMS</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>NMS</artifactId>
|
<artifactId>NMS</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>NMS</artifactId>
|
<artifactId>NMS</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -7,7 +7,7 @@
|
||||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||||
<artifactId>ExcellentEnchants</artifactId>
|
<artifactId>ExcellentEnchants</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>Core</module>
|
<module>Core</module>
|
||||||
<module>NMS</module>
|
<module>NMS</module>
|
||||||
|
|
Loading…
Reference in New Issue