mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Merge pull request #2444 from BentoBoxWorld/2240_Potions_for_Required_Items_causes_Challenges_to_Error
This commit is contained in:
commit
11540c047f
@ -363,16 +363,23 @@ public class LangUtilsHook extends Hook {
|
||||
* @param user The user's language will be used for translation.
|
||||
* @return Return the translation result.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String getPotionBaseEffectName(PotionType potionType, User user) {
|
||||
if (hooked) {
|
||||
return LanguageHelper.getPotionBaseEffectName(potionType, getUserLocale(user));
|
||||
}
|
||||
List<PotionEffect> effects = potionType.getPotionEffects();
|
||||
if (effects.isEmpty()) {
|
||||
return "No Effects";
|
||||
try {
|
||||
List<PotionEffect> effects = potionType.getPotionEffects();
|
||||
|
||||
if (effects.isEmpty()) {
|
||||
return "No Effects";
|
||||
}
|
||||
return effects.stream().map(effect -> Util.prettifyText(effect.getType().getKey().getKey()))
|
||||
.collect(Collectors.joining(", "));
|
||||
} catch (Exception e) {
|
||||
// Older versions of Spigot pre-1.20.4 don't have getPotionEffects()
|
||||
return Util.prettifyText(potionType.getEffectType().getKey().getKey());
|
||||
}
|
||||
return effects.stream().map(effect -> Util.prettifyText(effect.getType().getKey().getKey()))
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user