Skip to content

Commit

Permalink
[2.7.1] Add change-item in itemformat
Browse files Browse the repository at this point in the history
  • Loading branch information
PQguanfang committed Aug 25, 2024
1 parent 6c92821 commit 98ebbfa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cn.superiormc</groupId>
<artifactId>UltimateShop</artifactId>
<version>2.7.0</version>
<version>2.7.1</version>
<packaging>jar</packaging>

<name>UltimateShop</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cn.superiormc.ultimateshop.methods.Items;

import cn.superiormc.mythicchanger.manager.ChangesManager;
import cn.superiormc.mythicchanger.objects.ObjectAction;
import cn.superiormc.ultimateshop.UltimateShop;
import cn.superiormc.ultimateshop.hooks.ItemsHook;
import cn.superiormc.ultimateshop.managers.ConfigManager;
Expand Down Expand Up @@ -801,14 +803,17 @@ public static ItemStack editItemStack(ItemStack item,

// Plugin Enchantments
ConfigurationSection pluginEnchantsKey = section.getConfigurationSection("plugin-enchants");
if (!UltimateShop.freeVersion && pluginEnchantsKey != null) {
if (CommonUtil.checkPluginLoad("AdvancedEnchantments")) {
for (String enchantName : pluginEnchantsKey.getKeys(false)) {
item = AEAPI.applyEnchant(enchantName, pluginEnchantsKey.getInt(enchantName), item);
}
if (!UltimateShop.freeVersion && pluginEnchantsKey != null && CommonUtil.checkPluginLoad("AdvancedEnchantments")) {
for (String enchantName : pluginEnchantsKey.getKeys(false)) {
item = AEAPI.applyEnchant(enchantName, pluginEnchantsKey.getInt(enchantName), item);
}
}

// MythicChanger Changes
ConfigurationSection changeSection = section.getConfigurationSection("change-item");
if (changeSection != null && CommonUtil.checkPluginLoad("MythicChanger")) {
ChangesManager.changesManager.setRealChange(new ObjectAction(), changeSection, item.clone(), item, player);
}
return item;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public String getDisplayName(int multi, BigDecimal amount, boolean alwaysStatic)
} else {
tempVal2 = singleSection.getString("placeholder", tempVal1);
}
if (!alwaysStatic && !tempVal2.contains("{status}") && !isStatic && !UltimateShop.freeVersion &&
if (!alwaysStatic && !tempVal2.contains("{status}") && !isStatic && baseAmount != null && !UltimateShop.freeVersion &&
ConfigManager.configManager.getBoolean("placeholder.auto-settings.add-status-in-dynamic-price-placeholder.enabled")) {
tempVal2 = tempVal2 + " " + StaticPlaceholder.getCompareValue(baseAmount.multiply(new BigDecimal(multi)), amount);
}
Expand All @@ -208,7 +208,7 @@ public String getDisplayName(int multi, BigDecimal amount, boolean alwaysStatic)
"amount",
String.valueOf(amount),
"status",
alwaysStatic ? "" : StaticPlaceholder.getCompareValue(baseAmount.multiply(new BigDecimal(multi)), amount));
alwaysStatic || baseAmount == null ? "" : StaticPlaceholder.getCompareValue(baseAmount.multiply(new BigDecimal(multi)), amount));
}

public int getStartApply() {
Expand Down

0 comments on commit 98ebbfa

Please sign in to comment.