Packet Kick Issue

Discussion in 'Spigot Plugin Development' started by Flashera, Apr 29, 2017.

Thread Status:
Not open for further replies.
  1. So when I run my shout command, I receive this error:

    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Server thread/INFO]: Daraghan lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(4) exceeds writerIndex(1): UnpooledUnsafeDirectByteBuf(ridx: 1, widx: 1, cap: 256)
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [20:26:45] [Server thread/INFO]: [-]Daraghan

    Shout Code:
    if (this == Unrelenting_Force) {
    Block[] bs = p.getLineOfSight(((HashSet<Byte>) null), (num * 4) + 2).toArray(new Block[0]);
    List<Entity> near = p.getNearbyEntities(15, 15, 15);
    p.getWorld().playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXPLODE , 1, 1);
    for (Block b : bs) {
    PacketUtils.playParticleEffect(ParticleEffect.CLOUD, b.getLocation().add(0.5, 0.5, 0.5), 0, 0.3f,
    num * 15);

    for (Entity e : near) {
    if (e.getLocation().distance(b.getLocation()) < 4) {
    e.setVelocity(LocUtils.getVelocity(p.getLocation(), e.getLocation()).multiply(num / 2 + 1)
    .multiply(power).add(new Vector(0, 0.1, 0)));
    }
    }
    }
    }

    I suspect there is something wrong with my bs variable or my near call.
     
  2. Never use unrelenting force on a byte array.

    What is PacketUtils and why is it a broken piece of shit? Consider ProtocolLib instead? It is the standard for packet manipulation.
     
  3. What should I do instead? If I remove the Hash, the code is no longer accepted.

    Also, do you want the PacketUtils class code? (I should probably clarify that this is the DragonShouts plugin, I'm just playing with it to get it up to date until my dev can get a better inhouse system made.)
     
  4. sothatsit

    Patron

    This will likely be an issue with your particle library, as it is the only thing that appears that it would do anything manually with packets. Although, to be sure, can you please post the full exceptions. I believe your logging system has either recieved too many exceptions, or you have a setting flicked somewhere, and it has decided to chop off the important bits (the stack trace) of the errors.
     
  5. Yeah, I thought it was odd that it didn't pass a stacktrace. (Again, this plugin is old, I'm surprised any of it works.)

    This is the entire error:
    [10:48:24] [Server thread/INFO]: Flooshera issued server command: /ds fus
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Netty Server IO #0/ERROR]: java.lang.NullPointerException
    [10:48:24] [Server thread/INFO]: Flooshera lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(4) exceeds writerIndex(1): UnpooledUnsafeDirectByteBuf(ridx: 1, widx: 1, cap: 256)
    [10:48:24] [Server thread/INFO]: [-]Flooshera
     
  6. sothatsit

    Patron

    Personally, I would just stop using the particles from the PacketUtils library and switch to using the new API for it in Spigot. You can just use World.spawnParticle and achieve the same things now.
     
    • Agree Agree x 1
  7. You think it's the particle effect that's doing it?
     
  8. sothatsit

    Patron

    It is.
     
  9. It worked! Thank you so much!
     
    • Like Like x 1
Thread Status:
Not open for further replies.