Fix Potion- and SkullBuilder not working with language provided

This commit is contained in:
NichtStudioCode 2023-03-05 13:40:10 +01:00
parent a0e588a6f1
commit 20fa465684
2 changed files with 8 additions and 6 deletions

@ -8,6 +8,7 @@ import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@ -50,10 +51,10 @@ public final class PotionBuilder extends AbstractItemBuilder<PotionBuilder> {
return this;
}
@Contract(value = "-> new", pure = true)
@Contract(value = "_ -> new", pure = true)
@Override
public @NotNull ItemStack get() {
ItemStack item = super.get();
public @NotNull ItemStack get(@Nullable String lang) {
ItemStack item = super.get(lang);
PotionMeta meta = (PotionMeta) item.getItemMeta();
meta.clearCustomEffects();

@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import xyz.xenondevs.invui.util.MojangApiUtils;
@ -60,10 +61,10 @@ public final class SkullBuilder extends AbstractItemBuilder<SkullBuilder> {
propertyMap.put("textures", new Property("textures", texture.getTextureValue()));
}
@Contract(value = "-> new", pure = true)
@Contract(value = "_ -> new", pure = true)
@Override
public @NotNull ItemStack get() {
ItemStack item = super.get();
public @NotNull ItemStack get(@Nullable String lang) {
ItemStack item = super.get(lang);
ItemMeta meta = item.getItemMeta();
if (gameProfile != null)