diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 9e0bd99122..fdebdf85c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -45,6 +45,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftMerchantCustom; +import org.bukkit.craftbukkit.util.CraftChatMessage; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.entity.HumanEntity; @@ -317,7 +318,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { String title = container.getBukkitView().getTitle(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); getHandle().activeContainer = container; getHandle().activeContainer.addSlotListener(player); } @@ -387,7 +388,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // Now open the window Containers windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory()); String title = inventory.getTitle(); - player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); + player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); player.activeContainer = container; player.activeContainer.addSlotListener(player); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index c4d5bc21e5..44a28bed0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -758,7 +758,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public final void setDisplayName(String name) { - this.displayName = CraftChatMessage.wrapOrNull(name); + this.displayName = CraftChatMessage.fromStringOrNull(name); } @Override @@ -773,7 +773,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public void setLocalizedName(String name) { - this.locName = CraftChatMessage.wrapOrNull(name); + this.locName = CraftChatMessage.fromStringOrNull(name); } @Override @@ -1338,7 +1338,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { page = page.substring(0, maxItemLength); } - addTo.add(CraftChatMessage.wrapOrEmpty(page)); + addTo.add(CraftChatMessage.fromString(page)[0]); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java index e402a0e3af..7fdfeffc02 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -153,14 +153,6 @@ public final class CraftChatMessage { } } - public static IChatBaseComponent wrapOrNull(String message) { - return (message == null || message.isEmpty()) ? null : new ChatComponentText(message); - } - - public static IChatBaseComponent wrapOrEmpty(String message) { - return (message == null) ? new ChatComponentText("") : new ChatComponentText(message); - } - public static IChatBaseComponent fromStringOrNull(String message) { return fromStringOrNull(message, false); }