🎨 remove force &f color in getItemName method for items that don't have a custom/coloured name

Took 57 seconds
This commit is contained in:
Kiran Hart 2023-07-02 18:32:13 -04:00
parent df128270a7
commit fff6a3f9be
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3

View File

@ -27,11 +27,10 @@ import ca.tweetzy.auctionhouse.settings.Settings;
import ca.tweetzy.core.compatibility.ServerVersion; import ca.tweetzy.core.compatibility.ServerVersion;
import ca.tweetzy.core.compatibility.XMaterial; import ca.tweetzy.core.compatibility.XMaterial;
import ca.tweetzy.core.hooks.EconomyManager; import ca.tweetzy.core.hooks.EconomyManager;
import ca.tweetzy.core.utils.TextUtils;
import ca.tweetzy.core.utils.items.ItemUtils; import ca.tweetzy.core.utils.items.ItemUtils;
import ca.tweetzy.flight.nbtapi.NBT;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import ca.tweetzy.flight.nbtapi.NBT;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils; import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -266,7 +265,7 @@ public class AuctionAPI {
*/ */
public String getItemName(ItemStack stack) { public String getItemName(ItemStack stack) {
Objects.requireNonNull(stack, "Item stack cannot be null when getting name"); Objects.requireNonNull(stack, "Item stack cannot be null when getting name");
final String name = stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName() : TextUtils.formatText("&f" + WordUtils.capitalize(stack.getType().name().toLowerCase().replace("_", " "))); final String name = stack.getItemMeta().hasDisplayName() ? stack.getItemMeta().getDisplayName() : WordUtils.capitalize(stack.getType().name().toLowerCase().replace("_", " "));
return name; return name;
} }