From 178bbef9f9ad5cff7e0cda3d39eba7a785a94b6c Mon Sep 17 00:00:00 2001 From: LOOHP Date: Wed, 2 Sep 2020 21:06:13 +0800 Subject: [PATCH] Use default item display if character limit is reached instead of blocking --- src/com/loohp/interactivechat/Listeners/ChatPackets.java | 5 ++--- src/com/loohp/interactivechat/Listeners/Events.java | 1 + src/com/loohp/interactivechat/Modules/ItemDisplay.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/loohp/interactivechat/Listeners/ChatPackets.java b/src/com/loohp/interactivechat/Listeners/ChatPackets.java index 71b22cda..bb649d6a 100644 --- a/src/com/loohp/interactivechat/Listeners/ChatPackets.java +++ b/src/com/loohp/interactivechat/Listeners/ChatPackets.java @@ -87,9 +87,8 @@ public void onPacketSending(PacketEvent event) { } catch (Exception skip) { return; } - } - - BaseComponent basecomponent = ChatComponentUtils.join(ComponentSerializer.parse(ChatColorUtils.filterIllegalColorCodes(ComponentSerializer.toString(basecomponentarray)))); + } + BaseComponent basecomponent = ChatComponentUtils.join(ComponentSerializer.parse(ChatColorUtils.filterIllegalColorCodes(ComponentSerializer.toString(basecomponentarray)))); debug++; try { if (basecomponent.toLegacyText().equals("")) { diff --git a/src/com/loohp/interactivechat/Listeners/Events.java b/src/com/loohp/interactivechat/Listeners/Events.java index 998f0884..7e187606 100644 --- a/src/com/loohp/interactivechat/Listeners/Events.java +++ b/src/com/loohp/interactivechat/Listeners/Events.java @@ -193,6 +193,7 @@ private void translateAltColorCode(AsyncPlayerChatEvent event) { String message = ChatColorUtils.translateAlternateColorCodes(InteractiveChat.chatAltColorCode.get(), event.getMessage()); event.setMessage(message); + //Bukkit.getConsoleSender().sendMessage(message.replace(ChatColor.COLOR_CHAR, '&')); } private void translateAltColorCode(PlayerCommandPreprocessEvent event) { diff --git a/src/com/loohp/interactivechat/Modules/ItemDisplay.java b/src/com/loohp/interactivechat/Modules/ItemDisplay.java index ff4b45d3..b6cb4400 100644 --- a/src/com/loohp/interactivechat/Modules/ItemDisplay.java +++ b/src/com/loohp/interactivechat/Modules/ItemDisplay.java @@ -146,7 +146,7 @@ public static BaseComponent process(BaseComponent basecomponent, Optional 30000) || (!InteractiveChat.version.isLegacy() && itemJson.length() > 200000)) { + if ((itemJson.length() > 30000 && InteractiveChat.block30000) || ((InteractiveChat.version.isLegacy() || InteractiveChat.protocolManager.getProtocolVersion(reciever) < 393) && itemJson.length() > 30000) || (!InteractiveChat.version.isLegacy() && itemJson.length() > 200000)) { ItemStack trimedItem = new ItemStack(item.getType()); trimedItem.addUnsafeEnchantments(item.getEnchantments()); if (item.hasItemMeta() && item.getItemMeta().hasLore()) {