mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 14:38:51 +00:00
Fix CarbonUtils style
This commit is contained in:
1 parent
746a51638d
commit
a8722da5f6
1 file changed
+6
-5
@@ -27,6 +27,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class CarbonUtils {
|
public final class CarbonUtils {
|
||||||
|
|
||||||
private CarbonUtils() {
|
private CarbonUtils() {
|
||||||
@@ -45,11 +47,10 @@ public final class CarbonUtils {
|
|||||||
builder.hoverEvent(itemStack); // Let this be inherited by all coming components.
|
builder.hoverEvent(itemStack); // Let this be inherited by all coming components.
|
||||||
builder.append(Component.text("[", NamedTextColor.WHITE));
|
builder.append(Component.text("[", NamedTextColor.WHITE));
|
||||||
|
|
||||||
if (itemStack.getItemMeta().hasDisplayName()) {
|
final Component displayName = itemStack.getItemMeta().displayName();
|
||||||
builder.append(itemStack.getItemMeta().displayName());
|
|
||||||
} else {
|
builder.append(Objects.requireNonNullElseGet(displayName, () ->
|
||||||
builder.append(Component.translatable(itemStack.getType().getTranslationKey()));
|
Component.translatable(itemStack.getType().getTranslationKey())));
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(Component.text("]", NamedTextColor.WHITE));
|
builder.append(Component.text("]", NamedTextColor.WHITE));
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user