mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Fix [item] placeholder
This commit is contained in:
2 files changed
+9
-9
No files matched your search
@@ -56,18 +56,20 @@ public final class CarbonUtils {
|
||||
HoverEvent event = new HoverEvent(HoverEvent.Action.SHOW_ITEM, content);
|
||||
|
||||
ComponentBuilder component = new ComponentBuilder();
|
||||
component.event(event); // Let this be inherited by all coming components.
|
||||
component.color(ChatColor.WHITE).append("[");
|
||||
|
||||
if (itemStack.getItemMeta().hasDisplayName()) {
|
||||
component.append(TextComponent.fromLegacyText(itemStack.getItemMeta().getDisplayName()));
|
||||
} else {
|
||||
component.append(new TranslatableComponent(itemStack.getItemMeta().getLocalizedName()));
|
||||
String name = itemStack.getItemMeta().hasDisplayName()
|
||||
? itemStack.getItemMeta().getDisplayName()
|
||||
: "item.minecraft." + itemStack.getType().name().toLowerCase(); // As of 1.13, Material is 1:1 with MC's names
|
||||
component.append(new TranslatableComponent(name));
|
||||
}
|
||||
|
||||
component.color(ChatColor.WHITE).append("]");
|
||||
|
||||
component.event(event);
|
||||
|
||||
return BungeeCordComponentSerializer.get().deserialize(component.create());
|
||||
} catch (NoSuchMethodError ignored) {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user