This commit is contained in:
nossr50 2024-05-12 09:33:42 -07:00
parent cae2132d8d
commit 17052861d1
5 changed files with 67 additions and 18 deletions

View File

@ -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

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.008</version>
<version>2.2.009</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -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);
// }
}
/**

View File

@ -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.
*

View File

@ -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