diff --git a/Changelog.txt b/Changelog.txt
index feb4f4788..bed5117f4 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,3 +1,17 @@
+Version 2.2.009
+ Fixed a bug that prevented mcMMO from loading on MC versions older than 1.20.6
+ Dramatically increased the base XP for Alchemy again (see notes)
+
+ NOTES:
+ Alchemy leveling still felt too slow, so I've increased it again. You can either delete experience.yml to get the new values or adjust them manually.
+ If you haven't updated mcMMO since 2.2.006 or older you don't need to do anything to get these new values.
+ The new default values are...
+ Potion_Brewing:
+ Stage_1: 666
+ Stage_2: 1111
+ Stage_3: 1750
+ Stage_4: 2250
+
Version 2.2.008
Fixed alchemy potions not upgrading correctly (This will only affect new potions made, see notes)
Fixed a bug where alchemy potions had italicized names
diff --git a/pom.xml b/pom.xml
index ec3de8d6d..bda11611b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.gmail.nossr50.mcMMO
mcMMO
- 2.2.008
+ 2.2.009
mcMMO
https://github.com/mcMMO-Dev/mcMMO
diff --git a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java
index dd6fdb4aa..bdfd1d40a 100644
--- a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java
+++ b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java
@@ -2,7 +2,6 @@ package com.gmail.nossr50.config.skills.alchemy;
import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.datatypes.skills.alchemy.AlchemyPotion;
-import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.PotionUtil;
@@ -21,6 +20,7 @@ import org.jetbrains.annotations.VisibleForTesting;
import java.io.File;
import java.util.*;
+import static com.gmail.nossr50.util.ItemUtils.setItemName;
import static com.gmail.nossr50.util.PotionUtil.*;
import static com.gmail.nossr50.util.text.StringUtils.convertKeyToName;
@@ -257,19 +257,15 @@ public class PotionConfig extends LegacyConfigLoader {
}
private void setPotionDisplayName(ConfigurationSection section, PotionMeta potionMeta) {
- String configuredName = section.getString("Name", null);
- if (configuredName != null) {
- potionMeta.setItemName(configuredName);
+ // If a potion doesn't have any custom effects, there is no reason to override the vanilla name
+ if (potionMeta.getCustomEffects().isEmpty()) {
+ return;
+ }
+
+ final String configuredName = section.getString("Name", null);
+ if (configuredName != null) {
+ setItemName(potionMeta, configuredName);
}
-//
-// // Potion is water, but has effects
-// if (isPotionTypeWater(potionMeta)
-// && (PotionUtil.hasBasePotionEffects(potionMeta) || !potionMeta.getCustomEffects().isEmpty())) {
-// // If we don't set a name for these potions, they will simply be called "Water Potion"
-// final String name = section.getName().toUpperCase().replace("_", " ");
-// potionMeta.setDisplayName(name);
-// System.out.println("DEBUG: Renaming potion to " + name);
-// }
}
/**
diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java
index 2b7cccc48..d8b34f9ae 100644
--- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java
+++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java
@@ -20,6 +20,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
@@ -32,6 +34,43 @@ public final class ItemUtils {
*/
private ItemUtils() {}
+ private static final Method setItemName;
+
+ static {
+ setItemName = getSetItemName();
+ }
+
+ private static Method getSetItemName() {
+ try {
+ return ItemMeta.class.getMethod("setItemName", String.class);
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the item name using the new API if available
+ * or falls back to the old API.
+ * @param itemMeta The item meta to set the name on
+ * @param name The name to set
+ */
+ public static void setItemName(ItemMeta itemMeta, String name) {
+ if (setItemName != null) {
+ setItemNameModern(itemMeta, name);
+ } else {
+ itemMeta.setDisplayName(ChatColor.RESET + name);
+ }
+ }
+
+ private static void setItemNameModern(ItemMeta itemMeta, String name) {
+ try {
+ setItemName.invoke(itemMeta, name);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ mcMMO.p.getLogger().severe("Failed to set item name: " + e.getMessage());
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Checks if the item is a bow.
*
diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml
index 84df0e214..e010c8d65 100644
--- a/src/main/resources/experience.yml
+++ b/src/main/resources/experience.yml
@@ -246,10 +246,10 @@ Experience_Values:
# Stage_3 represents a base potion with one ingredient and one amplifier
# Stage_4 represents a base potion with one ingredient and two amplifiers
# Stage_5 represents a base potion with one ingredient where the amplifiers are swapped
- Stage_1: 120
- Stage_2: 240
- Stage_3: 480
- Stage_4: 960
+ Stage_1: 666
+ Stage_2: 1111
+ Stage_3: 1750
+ Stage_4: 2250
Stage_5: 0
Archery:
Distance_Multiplier: 0.025