v3.6.4
This commit is contained in:
parent
e5efd3c199
commit
daa3e40c65
12
Core/pom.xml
12
Core/pom.xml
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -72,27 +72,27 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_18_R2</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_19_R3</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_20_R1</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>V1_20_R2</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -8,8 +8,8 @@ public class Placeholders extends su.nexmedia.engine.utils.Placeholders {
|
||||
public static final String URL_ENGINE_ITEMS = "https://github.com/nulli0n/NexEngine-spigot/wiki/Configuration-Tips#item-sections";
|
||||
|
||||
public static final String GENERIC_TYPE = "%type%";
|
||||
public static final String GENERIC_ITEM = "%item%";
|
||||
public static final String GENERIC_LEVEL = "%level%";
|
||||
public static final String GENERIC_ITEM = "%item%";
|
||||
public static final String GENERIC_LEVEL = "%level%";
|
||||
public static final String GENERIC_AMOUNT = "%amount%";
|
||||
public static final String GENERIC_DESCRIPTION = "%description%";
|
||||
public static final String GENERIC_ENCHANT = "%enchant%";
|
||||
|
@ -31,6 +31,7 @@ public class EnchantDefaults {
|
||||
private boolean isTreasure;
|
||||
private int levelMin;
|
||||
private int levelMax;
|
||||
private int maxMergeLevel;
|
||||
private EnchantScaler levelByEnchantCost;
|
||||
private EnchantScaler anvilMergeCost;
|
||||
private Set<String> conflicts;
|
||||
@ -51,6 +52,7 @@ public class EnchantDefaults {
|
||||
this.setTreasure(false);
|
||||
this.setLevelMin(1);
|
||||
this.setLevelMax(3);
|
||||
this.setMaxMergeLevel(-1);
|
||||
this.setConflicts(new HashSet<>());
|
||||
this.setVisualEffects(true);
|
||||
this.obtainChance = new HashMap<>();
|
||||
@ -89,6 +91,11 @@ public class EnchantDefaults {
|
||||
"Note: While you can 'bypass' this value by enchant commands, all level-dependant enchantment",
|
||||
"settings will have a limit up to this setting.").read(cfg));
|
||||
|
||||
this.setMaxMergeLevel(JOption.create("Anvil.Max_Merge_Level", this.getMaxMergeLevel(),
|
||||
"Sets max. enchantment level that can be obtained by combining 2 items with this enchantment.",
|
||||
"Set this to '-1' to remove merge limit and just use 'Max Level' instead."
|
||||
).read(cfg));
|
||||
|
||||
this.setLevelByEnchantCost(EnchantScaler.read(enchant, ObtainType.ENCHANTING.getPathName() + ".Level_By_Exp_Cost",
|
||||
(int)(30D / this.levelMax) + " * " + Placeholders.ENCHANTMENT_LEVEL,
|
||||
"Sets how much XP levels must be used in enchanting table to obtain this enchantment.",
|
||||
@ -124,14 +131,19 @@ public class EnchantDefaults {
|
||||
this.setChargesEnabled(JOption.create("Settings.Charges.Enabled", this.isChargesEnabled(),
|
||||
"When 'true' enables the Charges system for this enchantment.",
|
||||
"When enchanted the first time on enchanting table, it will have maximum charges amount.").read(cfg));
|
||||
|
||||
this.setChargesCustomFuel(JOption.create("Settings.Charges.Custom_Fuel", this.isChargesCustomFuel(),
|
||||
"When 'true' uses different (non-default) fuel item (from the 'Fuel_Item' setting) to recharge.").read(cfg));
|
||||
|
||||
this.setChargesMax(EnchantScaler.read(enchant, "Settings.Charges.Maximum", "100",
|
||||
"Maximum amount of charges for the enchantment."));
|
||||
|
||||
this.setChargesConsumeAmount(EnchantScaler.read(enchant, "Settings.Charges.Consume_Amount", "1",
|
||||
"How many charges will be consumed when enchantment is triggered?"));
|
||||
|
||||
this.setChargesRechargeAmount(EnchantScaler.read(enchant, "Settings.Charges.Recharge_Amount", "25",
|
||||
"How many charges will be restored when using 'Fuel Item' in anvil?"));
|
||||
|
||||
this.setChargesFuel(JOption.create("Settings.Charges.Fuel_Item", new ItemStack(Material.LAPIS_LAZULI),
|
||||
"An item, that will be used to restore enchantment charges on anvils.",
|
||||
"Item Options:" + Placeholders.URL_ENGINE_ITEMS)
|
||||
@ -206,6 +218,14 @@ public class EnchantDefaults {
|
||||
return levelMax;
|
||||
}
|
||||
|
||||
public int getMaxMergeLevel() {
|
||||
return this.maxMergeLevel;
|
||||
}
|
||||
|
||||
public void setMaxMergeLevel(int maxMergeLevel) {
|
||||
this.maxMergeLevel = Math.min(this.getLevelMax(), maxMergeLevel);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public EnchantScaler getLevelByEnchantCost() {
|
||||
return levelByEnchantCost;
|
||||
|
@ -222,6 +222,10 @@ public abstract class ExcellentEnchant extends Enchantment implements IEnchantme
|
||||
return this.getDefaults().getLevelMin();
|
||||
}
|
||||
|
||||
public int getMaxMergeLevel() {
|
||||
return this.getDefaults().getMaxMergeLevel() < 0 ? this.getMaxLevel() : this.getDefaults().getMaxMergeLevel();
|
||||
}
|
||||
|
||||
public int getLevelByEnchantCost(int expLevel) {
|
||||
int get = this.getDefaults().getLevelByEnchantCost().getValues().entrySet().stream()
|
||||
.filter(en -> expLevel >= en.getValue().intValue()).max(Comparator.comparingInt(Map.Entry::getKey))
|
||||
|
@ -35,7 +35,7 @@ public class RegrowthEnchant extends ExcellentEnchant implements Chanced, Passiv
|
||||
|
||||
public RegrowthEnchant(@NotNull ExcellentEnchants plugin) {
|
||||
super(plugin, ID);
|
||||
this.getDefaults().setDescription("Restores " + PLACEHOLDER_HEAL_AMOUNT + " hearts every " + Placeholders.ENCHANTMENT_INTERVAL + "s.");
|
||||
this.getDefaults().setDescription("Restores " + PLACEHOLDER_HEAL_AMOUNT + " hearts every few seconds.");
|
||||
this.getDefaults().setLevelMax(5);
|
||||
this.getDefaults().setTier(0.7);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class SaturationEnchant extends ExcellentEnchant implements PassiveEnchan
|
||||
|
||||
public SaturationEnchant(@NotNull ExcellentEnchants plugin) {
|
||||
super(plugin, ID);
|
||||
this.getDefaults().setDescription("Restores " + PLACEHOLDER_SATURATION_AMOUNT + " food points every " + Placeholders.ENCHANTMENT_INTERVAL + "s.");
|
||||
this.getDefaults().setDescription("Restores " + PLACEHOLDER_SATURATION_AMOUNT + " food points every few seconds.");
|
||||
this.getDefaults().setLevelMax(3);
|
||||
this.getDefaults().setTier(0.5);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class SoulboundEnchant extends ExcellentEnchant implements GenericEnchant
|
||||
@NotNull
|
||||
@Override
|
||||
public EnchantmentTarget getItemTarget() {
|
||||
return EnchantmentTarget.BREAKABLE;
|
||||
return EnchantmentTarget.WEARABLE;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -109,7 +109,7 @@ public class EnchantAnvilListener extends AbstractListener<ExcellentEnchants> {
|
||||
// Merge only if it's Item + Item, Item + Enchanted book or Enchanted Book + Enchanted Book
|
||||
if (second.getType() == Material.ENCHANTED_BOOK || second.getType() == first.getType()) {
|
||||
EnchantUtils.getExcellents(second).forEach((enchant, level) -> {
|
||||
enchantments.merge(enchant, level, (oldLvl, newLvl) -> (oldLvl.equals(newLvl)) ? (Math.min(enchant.getMaxLevel(), oldLvl + 1)) : (Math.max(oldLvl, newLvl)));
|
||||
enchantments.merge(enchant, level, (oldLvl, newLvl) -> (oldLvl.equals(newLvl)) ? (Math.min(enchant.getMaxMergeLevel(), oldLvl + 1)) : (Math.max(oldLvl, newLvl)));
|
||||
charges.merge(enchant, enchant.getCharges(second), Integer::sum);
|
||||
});
|
||||
}
|
||||
|
@ -150,26 +150,26 @@ public class EnchantGenericListener extends AbstractListener<ExcellentEnchants>
|
||||
// ---------------------------------------------------------------
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEnchantPopulateVillagerAcquire(VillagerAcquireTradeEvent event) {
|
||||
MerchantRecipe recipe = event.getRecipe();
|
||||
ItemStack result = recipe.getResult();
|
||||
MerchantRecipe origin = event.getRecipe();
|
||||
ItemStack result = origin.getResult();
|
||||
if (!EnchantUtils.isEnchantable(result)) return;
|
||||
|
||||
EnchantPopulator populator = this.plugin.createPopulator(result, ObtainType.VILLAGER)
|
||||
.withWorld(event.getEntity().getWorld());
|
||||
if (!populator.populate()) return;
|
||||
|
||||
int uses = recipe.getUses();
|
||||
int maxUses = recipe.getMaxUses();
|
||||
boolean expReward = recipe.hasExperienceReward();
|
||||
int villagerExperience = recipe.getVillagerExperience();
|
||||
float priceMultiplier = recipe.getPriceMultiplier();
|
||||
int demand = recipe.getDemand();
|
||||
int specialPrice = recipe.getSpecialPrice();
|
||||
int uses = origin.getUses();
|
||||
int maxUses = origin.getMaxUses();
|
||||
boolean expReward = origin.hasExperienceReward();
|
||||
int villagerExperience = origin.getVillagerExperience();
|
||||
float priceMultiplier = origin.getPriceMultiplier();
|
||||
int demand = origin.getDemand();
|
||||
int specialPrice = origin.getSpecialPrice();
|
||||
|
||||
MerchantRecipe recipe2 = new MerchantRecipe(result, uses, maxUses, expReward, villagerExperience,
|
||||
MerchantRecipe recipe = new MerchantRecipe(result, uses, maxUses, expReward, villagerExperience,
|
||||
priceMultiplier, demand, specialPrice);
|
||||
recipe2.setIngredients(recipe.getIngredients());
|
||||
event.setRecipe(recipe2);
|
||||
recipe.setIngredients(origin.getIngredients());
|
||||
event.setRecipe(recipe);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -83,7 +83,7 @@ public class EnchantmentsListMenu extends ConfigMenu<ExcellentEnchants> implemen
|
||||
public List<ExcellentEnchant> getObjects(@NotNull Player player) {
|
||||
return new ArrayList<>(EnchantRegistry.getRegistered().stream()
|
||||
.filter(Predicate.not(enchant -> enchant.getDefaults().isHiddenFromList()))
|
||||
.sorted(Comparator.comparing(e -> Colorizer.strip(e.getDisplayName()))).toList());
|
||||
.sorted(Comparator.comparing(e -> Colorizer.restrip(e.getDisplayName()))).toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ public enum FitItemType {
|
||||
|
||||
public boolean isIncluded(@NotNull ItemStack item) {
|
||||
return switch (this) {
|
||||
case UNIVERSAL -> ARMOR.isIncluded(item) || WEAPON.isIncluded(item) || TOOL.isIncluded(item);
|
||||
case UNIVERSAL -> ARMOR.isIncluded(item) || WEAPON.isIncluded(item) || TOOL.isIncluded(item) || BOW.isIncluded(item) || FISHING_ROD.isIncluded(item) || ELYTRA.isIncluded(item);
|
||||
case HELMET -> ItemUtil.isHelmet(item);
|
||||
case CHESTPLATE -> ItemUtil.isChestplate(item) || (Config.ENCHANTMENTS_ITEM_CHESTPLATE_ENCHANTS_TO_ELYTRA.get() && ELYTRA.isIncluded(item));
|
||||
case LEGGINGS -> ItemUtil.isLeggings(item);
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>ExcellentEnchants</artifactId>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>su.nightexpress.excellentenchants</groupId>
|
||||
<artifactId>NMS</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user