diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
index 8f28ba3f..75696fa4 100644
--- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
+++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java
@@ -594,7 +594,7 @@ public class PacketContainer implements Serializable {
* Retrieves a read/write structure for chat components in Minecraft 1.7.2.
*
* This modifier will automatically marshall between WrappedChatComponent and the
- * internal Minecraft GameProfile.
+ * internal Minecraft IChatBaseComponent.
* @return A modifier for ChatComponent fields.
*/
public StructureModifier getChatComponents() {
@@ -602,6 +602,20 @@ public class PacketContainer implements Serializable {
return structureModifier.withType(
MinecraftReflection.getIChatBaseComponentClass(), BukkitConverters.getWrappedChatComponentConverter());
}
+
+ /**
+ * Retrieves a read/write structure for arrays of chat components.
+ *
+ * This modifier will automatically marshall between WrappedChatComponent and the
+ * internal Minecraft IChatBaseComponent.
+ * @return A modifier for ItemStack array fields.
+ */
+ public StructureModifier getChatComponentArrays() {
+ // Convert to and from the Bukkit wrapper
+ return structureModifier.withType(
+ MinecraftReflection.getIChatBaseComponentClass(),
+ BukkitConverters.getIgnoreNull(new WrappedChatComponentArrayConverter()));
+ }
/**
* Retrieve a read/write structure for the ServerPing fields in the following packet:
@@ -899,4 +913,41 @@ public class PacketContainer implements Serializable {
return ItemStack[].class;
}
}
+
+ /**
+ * Represents an equivalent converter for ChatComponent arrays.
+ * @author Kristian
+ */
+ private static class WrappedChatComponentArrayConverter implements EquivalentConverter {
+ final EquivalentConverter componentConverter = BukkitConverters.getWrappedChatComponentConverter();
+
+ @Override
+ public Object getGeneric(Class>genericType, WrappedChatComponent[] specific) {
+ Class> nmsComponent = MinecraftReflection.getIChatBaseComponentClass();
+ Object[] result = (Object[]) Array.newInstance(nmsComponent, specific.length);
+
+ // Unwrap every item
+ for (int i = 0; i < result.length; i++) {
+ result[i] = componentConverter.getGeneric(nmsComponent, specific[i]);
+ }
+ return result;
+ }
+
+ @Override
+ public WrappedChatComponent[] getSpecific(Object generic) {
+ Object[] input = (Object[]) generic;
+ WrappedChatComponent[] result = new WrappedChatComponent[input.length];
+
+ // Add the wrapper
+ for (int i = 0; i < result.length; i++) {
+ result[i] = componentConverter.getSpecific(input[i]);
+ }
+ return result;
+ }
+
+ @Override
+ public Class getSpecificType() {
+ return WrappedChatComponent[].class;
+ }
+ }
}