| 1 | package me.fridtjof.minecarttrains.utils; |
| 2 | |
| 3 | import net.kyori.adventure.text.Component; |
| 4 | import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; |
| 5 | import org.bukkit.Nameable; |
| 6 | |
| 7 | public final class CartNames |
| 8 | { |
| 9 | |
| 10 | private CartNames() |
| 11 | { |
| 12 | } |
| 13 | |
| 14 | public static boolean hasName(Nameable nameable, String expected) |
| 15 | { |
| 16 | Component name = nameable.customName(); |
| 17 | if (name == null) |
| 18 | { |
| 19 | return false; |
| 20 | } |
| 21 | return PlainTextComponentSerializer.plainText().serialize(name).equalsIgnoreCase(expected); |
| 22 | } |
| 23 | } |