mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-24 19:45:14 +01:00
Fixes some small bugs with translation potion base effect.
There was an issue that it tried to translate extra effects and ignored main one. Relates to #290
This commit is contained in:
parent
fc1d4fcf06
commit
b9e57fdebb
@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.*;
|
import org.bukkit.inventory.meta.*;
|
||||||
import org.bukkit.potion.PotionData;
|
import org.bukkit.potion.PotionData;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.potion.PotionType;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
import world.bentobox.bentobox.BentoBox;
|
||||||
@ -629,27 +630,27 @@ public class Utils
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prettify effect string.
|
* Prettify type string.
|
||||||
*
|
*
|
||||||
* @param effect the enchantment
|
* @param type the potion type
|
||||||
* @param user the user
|
* @param user the user
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String prettifyObject(PotionEffectType effect, User user)
|
public static String prettifyObject(PotionType type, User user)
|
||||||
{
|
{
|
||||||
if (effect == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
String type = user.getTranslationOrNothing(Constants.ITEM_STACKS + "potion-effect." + effect.getName().toLowerCase());
|
String text = user.getTranslationOrNothing(Constants.ITEM_STACKS + "potion-type." + type.name().toLowerCase());
|
||||||
|
|
||||||
if (type.isEmpty())
|
if (text.isEmpty())
|
||||||
{
|
{
|
||||||
type = LangUtilsHook.getPotionEffectName(effect, user);
|
text = LangUtilsHook.getPotionBaseEffectName(type, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -681,7 +682,7 @@ public class Utils
|
|||||||
if (type.isEmpty())
|
if (type.isEmpty())
|
||||||
{
|
{
|
||||||
// Check potion types translation.
|
// Check potion types translation.
|
||||||
type = prettifyObject(potionData.getType().getEffectType(), user);
|
type = prettifyObject(potionData.getType(), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
String upgraded = user.getTranslationOrNothing(metaReference + "upgraded");
|
String upgraded = user.getTranslationOrNothing(metaReference + "upgraded");
|
||||||
|
@ -1230,7 +1230,7 @@ challenges:
|
|||||||
# menting: "Mending"
|
# menting: "Mending"
|
||||||
# unbreaking: "Unbreaking"
|
# unbreaking: "Unbreaking"
|
||||||
# # Custom Potion Translation.
|
# # Custom Potion Translation.
|
||||||
# potion-effect:
|
# potion-type:
|
||||||
# water_breathing: "Water Breathing"
|
# water_breathing: "Water Breathing"
|
||||||
# # You can also create specific item translations
|
# # You can also create specific item translations
|
||||||
# # Like translate all potions.
|
# # Like translate all potions.
|
||||||
|
Loading…
Reference in New Issue
Block a user