From ba15e4b116727ead2b71af36273587dd439605c2 Mon Sep 17 00:00:00 2001 From: Chicken-Bomes Date: Sun, 29 Jun 2014 14:27:19 +1000 Subject: [PATCH] Added informative exception when attempting to register a channel using a modID > 20 characters --- src/codechicken/lib/packet/PacketCustom.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/codechicken/lib/packet/PacketCustom.java b/src/codechicken/lib/packet/PacketCustom.java index 7e238f2..bd4586b 100644 --- a/src/codechicken/lib/packet/PacketCustom.java +++ b/src/codechicken/lib/packet/PacketCustom.java @@ -145,8 +145,12 @@ public final class PacketCustom implements MCDataInput, MCDataOutput public static String channelName(Object channelKey) { if (channelKey instanceof String) return (String) channelKey; - if (channelKey instanceof ModContainer) - return ((ModContainer) channelKey).getModId(); + if (channelKey instanceof ModContainer) { + String s = ((ModContainer) channelKey).getModId(); + if(s.length() > 20) + throw new IllegalArgumentException("Mod ID ("+s+") too long for use as channel (20 chars). Use a string identifier"); + return s; + } ModContainer mc = FMLCommonHandler.instance().findContainerFor(channelKey); if (mc != null)