Creating Particles | What the heck is this!

Discussion in 'Spigot Plugin Development' started by UnthinkableR, May 18, 2015.

  1. Hello I Wanted To Make A Blood Effect! And i have these three classes:

    ParticleEffects:

    Code (Text):

    http://pastebin.com/6iMSYfcN
     
    Error:
    PHP:
    [08:57:47 ERROR]: Could not pass event EntityDamageByEntityEvent to KitPvp v1.2
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:305) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:502) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:487) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.callEvent(Craf
    tEventFactory.java:85) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.callEntityDama
    geEvent(CraftEventFactory.java:538) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.handleEntityDa
    mageEvent(CraftEventFactory.java:451) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.handleLivingEn
    tityDamageEvent(CraftEventFactory.java:570) [spigot.jar:git-Spigot-26dfd01-5cb9b
    70]
            at net.minecraft.server.v1_8_R2.EntityLiving.d(EntityLiving.java:1101) [
    spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityHuman.d(EntityHuman.java:859) [spi
    got.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityLiving.damageEntity(EntityLiving.j
    ava:742) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityHuman.damageEntity(EntityHuman.jav
    a:800) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityPlayer.damageEntity(EntityPlayer.j
    ava:496) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityHuman.attack(EntityHuman.java:1001
    ) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.EntityPlayer.attack(EntityPlayer.java:10
    60) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java
    :1330) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PacketPlayInUseEntity.a(SourceFile:52) [
    spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PacketPlayInUseEntity.a(SourceFile:11) [
    spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:1
    3) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
    ?:1.8.0_31]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_31]
            at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [spigot.jar
    :git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:7
    10) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:3
    68) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:6
    51) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java
    :554) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_31]
    Caused by: be.UnthinkableR.KitPvP.Particles.ParticleEffects$PacketInstantiationE
    xception: Packet instantiation failed
            at be.UnthinkableR.KitPvP.Particles.ParticleEffects.instantiatePacket(Pa
    rticleEffects.java:293) ~[?:?]
            at be.UnthinkableR.KitPvP.Particles.ParticleEffects.display(ParticleEffe
    cts.java:412) ~[?:?]
            at be.UnthinkableR.KitPvP.Events.Blood.onEntityDamageEvent(Blood.java:24
    ) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _31]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _31]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_31]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:301) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            ... 26 more
    Caused by: java.lang.NullPointerException
            at be.UnthinkableR.KitPvP.Particles.ParticleEffects.instantiatePacket(Pa
    rticleEffects.java:291) ~[?:?]
            at be.UnthinkableR.KitPvP.Particles.ParticleEffects.display(ParticleEffe
    cts.java:412) ~[?:?]
            at be.UnthinkableR.KitPvP.Events.Blood.onEntityDamageEvent(Blood.java:24
    ) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _31]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _31]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_31]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:301) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            ... 26 more
    [08:57:59 ERROR]: Could not pass event ServerListPingEvent to KitPvp v1.2
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:305) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:502) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:487) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PacketStatusListener.a(PacketStatusListe
    ner.java:106) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PacketStatusInStart.a(SourceFile:23) [sp
    igot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.PacketStatusInStart.a(SourceFile:8) [spi
    got.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.NetworkManager.a(NetworkManager.java:124
    ) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.NetworkManager.channelRead0(NetworkManag
    er.java:325) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.NetworkManager.channelRead0(NetworkManag
    er.java:1) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChanne
    lInboundHandler.java:105) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
    ractChannelHandlerContext.java:333) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
    ctChannelHandlerContext.java:319) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessage
    Decoder.java:163) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
    ractChannelHandlerContext.java:333) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
    ctChannelHandlerContext.java:319) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessage
    Decoder.java:163) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
    ractChannelHandlerContext.java:333) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
    ctChannelHandlerContext.java:319) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at net.minecraft.server.v1_8_R2.LegacyPingHandler.channelRead(SourceFile
    :94) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
    ractChannelHandlerContext.java:333) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
    ctChannelHandlerContext.java:319) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHa
    ndler.java:150) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst
    ractChannelHandlerContext.java:333) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra
    ctChannelHandlerContext.java:319) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChanne
    lPipeline.java:787) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(Abstra
    ctNioByteChannel.java:130) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.jav
    a:511) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEve
    ntLoop.java:468) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.ja
    va:382) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [spigot.
    jar:git-Spigot-26dfd01-5cb9b70]
            at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThread
    EventExecutor.java:116) [spigot.jar:git-Spigot-26dfd01-5cb9b70]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_31]
    Caused by: java.lang.NullPointerException
            at be.UnthinkableR.KitPvP.Main.Main.a(Main.java:556) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _31]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _31]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_31]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:301) ~[spigot.jar:git-Spigot-26dfd01-5cb9b70]
            ... 32 more
    ReflectionHandler:
    Code (Text):
    http://pastebin.com/Zj2Py4cu
    Why Doesn't it send the particles
     
  2. NathanWolf

    Supporter

    Code (Text):
    Caused by: java.lang.NullPointerException
            at be.UnthinkableR.KitPvP.Particles.ParticleEffects.instantiatePacket(Pa
    rticleEffects.java:291) ~[?:?]
    ^ The useful part of that stack trace. Seems like that could only NPE if "packetPlayOutWorldParticles" was null, or you were passing a null location. Since I don't see how you're calling this, only the lib code that you are using, I can't really tell which.

    You need to make sure you're using the correct lib version for your server version.

    Or, since you're presumably targeting Spigot- just use the Spigot particle API? You can just call playEffect to spawn particle packets.
     
  3. If I can append to that; I would suggest using player.spigot().playeffect() as its built into spigot so you won't need to use an external library. It is good but remember that method names change so using reflection from older versions may not always work. Since the method I showed is built into spigot, it shouldn't break per update.
     
  4. ik but i've tried player.playEffect(world.getLocation(p.getlocation), Effect.TILEBREAK, 1) it doesn't work
     
  5. NathanWolf

    Supporter

    TILEBREAK is special- I'd suggest testing with a normal particle to make sure you have everything working.

    TILEBREAK and BLOCKBREAK require some extra data for the material being used, and I'm honestly not sure if the Spigot effect API supports that.
     
    • Agree Agree x 1
  6. I use effects like so:
    Code (Text):
    player.playEffect(player.getLocation(), Effect.STEP_SOUND, Material.STONE);
     
  7. Thx