ProtocolLib

3M Downloads

SoundPacketAdapter Error 1.19.4 ~ 1.19.3 all version

IPECTER opened this issue ยท 1 comments

commented

Version Info
1.19.3, 1.19.4 all build

public class SoundPacketAdapter extends PacketAdapter {

    public SoundPacketAdapter(@NotNull Plugin plugin) {
        super((new AdapterParameteters())
                .plugin(plugin)
                .listenerPriority(ListenerPriority.HIGHEST)
                .types(PacketType.Play.Server.NAMED_SOUND_EFFECT)
                .optionAsync());
    }

    public void onPacketSending(PacketEvent event) {
            Player p = event.getPlayer();
            PacketContainer packet = event.getPacket();
            Sound sound = packet.getSoundEffects().read(0);
            Integer x = packet.getIntegers().read(0) / 8;
            Integer y = packet.getIntegers().read(1) / 8;
            Integer z = packet.getIntegers().read(2) / 8;
            World w = event.getPlayer().getWorld();
            Location l = new Location(w, x, y, z);
            Float volume = packet.getFloat().read(0);
            Float pitch = packet.getFloat().read(1);
            event.setCancelled(true);
    }
[22:51:51 ERROR]: [SoundPacketAdapterTest] Unhandled exception number 4096 occurred in onPacketSending(PacketEvent) for SoundPacketAdapterTest
java.lang.IllegalStateException: Unable to invoke method public static org.bukkit.Sound org.bukkit.craftbukkit.v1_19_R2.CraftSound.                   getBukkit(net.minecraft.sounds.SoundEffect)
        at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:25) ~[ProtocolLib.jar:?                   ]
        at com.comphenix.protocol.wrappers.BukkitConverters$20.getSpecific(BukkitConverters.java:1131) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.wrappers.BukkitConverters$20.getSpecific(BukkitConverters.java:1117) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.wrappers.Converters$1.getSpecific(Converters.java:50) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.wrappers.Converters$7.getSpecific(Converters.java:254) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.reflect.StructureModifier.readInternal(StructureModifier.java:274) ~[ProtocolLib.jar:?]
        at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:224) ~[ProtocolLib.jar:?]
        at com.github.ipecter.rtu.mambience.packet.SoundPacketAdapter.onPacketSending(SoundPacketAdapter.java:31) ~[RTUMAmbience-1.                   6.jar:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195) ~[Prot                   ocolLib.jar:?]
        at com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149) ~[Protoc                   olLib.jar:?]
        at com.comphenix.protocol.injector.PacketFilterManager.postPacketToListeners(PacketFilterManager.java:547) ~[ProtocolLib.ja                   r:?]
        at com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:521) ~[ProtocolLib.jar:                   ?]
        at com.comphenix.protocol.injector.netty.manager.NetworkManagerInjector.onPacketSending(NetworkManagerInjector.java:99) ~[P                   rotocolLib.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector.processOutbound(NettyChannelInjector.java:571) ~[Prot                   ocolLib.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyChannelInjector$2.doProxyRunnable(NettyChannelInjector.java:472) ~[Pr                   otocolLib.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.proxyRunnable(NettyEventLoopProxy.java:43) ~[ProtocolL                   ib.jar:?]
        at com.comphenix.protocol.injector.netty.channel.NettyEventLoopProxy.execute(NettyEventLoopProxy.java:252) ~[ProtocolLib.ja                   r:?]
        at net.minecraft.network.Connection.sendPacket(Connection.java:432) ~[?:?]
        at net.minecraft.network.Connection.send(Connection.java:379) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:2271) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:2247) ~[?:?]
        at net.minecraft.server.players.PlayerList.broadcast(PlayerList.java:1215) ~[fusion-1.19.3.jar:git-Fusion-"774cc4b"]
        at org.bukkit.craftbukkit.v1_19_R2.CraftWorld.playSound(CraftWorld.java:1843) ~[fusion-1.19.3.jar:git-Fusion-"774cc4b"]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.MinecraftKey.b()" because "minecraft" is null
        at org.bukkit.craftbukkit.v1_19_R2.util.CraftNamespacedKey.fromMinecraft(CraftNamespacedKey.java:24) ~[fusion-1.19.3.jar:gi                   t-Fusion-"774cc4b"]
        at org.bukkit.craftbukkit.v1_19_R2.CraftSound.getBukkit(CraftSound.java:28) ~[fusion-1.19.3.jar:git-Fusion-"774cc4b"]
        at com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:23) ~[ProtocolLib.jar:?                   ]
        ... 35 more

Check #2099 , #2099 (comment)

commented

Thx very much @dmulloy2 !!!!!!!!!!!