From 3bee607d1e2933fd779052abf50ae34d3003c177 Mon Sep 17 00:00:00 2001 From: Hellxd Date: Thu, 26 May 2022 22:47:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B7=B1=E6=8B=B7=E8=B4=9D=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84hook=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hook/impl/protocollib/ProtocolLibCallbackHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/dionatestserver/pluginhooker/hook/impl/protocollib/ProtocolLibCallbackHandler.java b/src/main/java/io/github/dionatestserver/pluginhooker/hook/impl/protocollib/ProtocolLibCallbackHandler.java index 70d4320..85bf517 100644 --- a/src/main/java/io/github/dionatestserver/pluginhooker/hook/impl/protocollib/ProtocolLibCallbackHandler.java +++ b/src/main/java/io/github/dionatestserver/pluginhooker/hook/impl/protocollib/ProtocolLibCallbackHandler.java @@ -1,5 +1,6 @@ package io.github.dionatestserver.pluginhooker.hook.impl.protocollib; +import com.comphenix.protocol.concurrency.SortedCopyOnWriteArray; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketListener; import com.comphenix.protocol.injector.PrioritizedListener; @@ -11,6 +12,7 @@ import org.bukkit.plugin.Plugin; import java.lang.reflect.Field; +import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; public class ProtocolLibCallbackHandler { @@ -52,7 +54,7 @@ private SortedPacketListenerList deepCopyListenerList(SortedPacketListenerList s ConcurrentHashMap listeners = (ConcurrentHashMap) mapListeners.get(sortedPacketListenerList); ConcurrentHashMap resultMap = listeners.keySet().stream().collect( ConcurrentHashMap::new, - (map, packetType) -> map.put(packetType, listeners.get(packetType)), + (map, packetType) -> map.put(packetType, new SortedCopyOnWriteArray((Collection) listeners.get(packetType))), ConcurrentHashMap::putAll );