|
@@ -71,10 +71,10 @@ public class PotionUtil {
|
|
* @return The potion type
|
|
* @return The potion type
|
|
*/
|
|
*/
|
|
public static PotionType matchPotionType(String partialName, boolean isUpgraded, boolean isExtended) {
|
|
public static PotionType matchPotionType(String partialName, boolean isUpgraded, boolean isExtended) {
|
|
|
|
+ String updatedName = convertLegacyNames(partialName).toUpperCase();
|
|
if (COMPATIBILITY_MODE == PotionCompatibilityType.PRE_1_20_5) {
|
|
if (COMPATIBILITY_MODE == PotionCompatibilityType.PRE_1_20_5) {
|
|
- return matchLegacyPotionType(partialName);
|
|
|
|
|
|
+ return matchLegacyPotionType(updatedName);
|
|
} else {
|
|
} else {
|
|
- String updatedName = convertLegacyNames(partialName);
|
|
|
|
return Arrays.stream(PotionType.values())
|
|
return Arrays.stream(PotionType.values())
|
|
.filter(potionType -> getKeyGetKey(potionType).toUpperCase().contains(partialName)
|
|
.filter(potionType -> getKeyGetKey(potionType).toUpperCase().contains(partialName)
|
|
|| getKeyGetKey(potionType).toUpperCase().contains(convertLegacyNames(updatedName)))
|
|
|| getKeyGetKey(potionType).toUpperCase().contains(convertLegacyNames(updatedName)))
|
|
@@ -84,6 +84,21 @@ public class PotionUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Legacy matching for {@link PotionType}
|
|
|
|
+ *
|
|
|
|
+ * @param name The partial name of the potion
|
|
|
|
+ * @return The potion type
|
|
|
|
+ */
|
|
|
|
+ private static PotionType matchLegacyPotionType(String name) {
|
|
|
|
+ return Arrays.stream(PotionType.values())
|
|
|
|
+ .filter(potionType -> getKeyGetKey(potionType).equalsIgnoreCase(name)
|
|
|
|
+ || getKeyGetKey(potionType).equalsIgnoreCase(convertLegacyNames(name))
|
|
|
|
+ || potionType.name().equalsIgnoreCase(name)
|
|
|
|
+ || potionType.name().equalsIgnoreCase(convertLegacyNames(name)))
|
|
|
|
+ .findAny().orElse(null);
|
|
|
|
+ }
|
|
|
|
+
|
|
public static String getKeyGetKey(PotionType potionType) {
|
|
public static String getKeyGetKey(PotionType potionType) {
|
|
try {
|
|
try {
|
|
if (getKeyMethod() != null) {
|
|
if (getKeyMethod() != null) {
|
|
@@ -201,23 +216,6 @@ public class PotionUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Legacy matching for {@link PotionType}
|
|
|
|
- *
|
|
|
|
- * @param partialName The partial name of the potion
|
|
|
|
- * @return The potion type
|
|
|
|
- */
|
|
|
|
- private static PotionType matchLegacyPotionType(String partialName) {
|
|
|
|
- String updatedName = convertLegacyNames(partialName);
|
|
|
|
-
|
|
|
|
- return Arrays.stream(PotionType.values())
|
|
|
|
- .filter(potionType -> getKeyGetKey(potionType).equalsIgnoreCase(partialName)
|
|
|
|
- || getKeyGetKey(potionType).equalsIgnoreCase(convertLegacyNames(updatedName))
|
|
|
|
- || potionType.name().equalsIgnoreCase(partialName)
|
|
|
|
- || potionType.name().equalsIgnoreCase(convertLegacyNames(updatedName)))
|
|
|
|
- .findAny().orElse(null);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public static String convertPotionConfigName(String legacyName) {
|
|
public static String convertPotionConfigName(String legacyName) {
|
|
String replacementName = legacyName;
|
|
String replacementName = legacyName;
|
|
|
|
|