Delete/Kill arrows in specific chunk/area

Discussion in 'Spigot Plugin Help' started by M0dii, Feb 6, 2020.

  1. Hello, does anyone know how would I able to remove arrows in a specific chunk or area?

    I have this *weird* bug in paper 1.8.8 where arrows are randomly spawning in 0, 0 chunk (0, 3, 0) at X0 Y60`ish Z0 and lag out the server.

    I'm not sure how to detect them spawning and how to kill them (entities) in a specific area/chunk.
    Any help? Thanks in advance.
  2. That's really weird. Isn't there any command blocks that causes the problem?

    You can try to kill arrows via command block with /minecraft:kill @e[type=Arrow,x=-1,y=55,z=-1,dx=2,dy=10,dz=2]
    Be aware - try this command in singleplayer first, otherwise, if mistakes were made, it will kill all the entities on server.
  3. Hey, thanks for a quick reply. I had an idea doing this with command blocks, but I'm not sure if this would be a good solution. I may try it though if there's no other way.

    I have this code for now to kill them once they hit a block, but this is global and every arrow is deleted once they hit something.
    That's why I'm looking for a way to do it in specific area.
    Code (Text):

      public void onProjectileHitEvent(ProjectileHitEvent event) {
        Projectile projectile = event.getEntity();
        if (projectile instanceof org.bukkit.entity.Arrow)
    I know there's a event ProjectileLaunchEvent but I don't know if this would apply for randomly (in random intervals) spawning arrows. I've been looking for other similar cases to this but I haven't found anything related. Perhaps a plugin is causing it, I'm not sure.
    Also, I'm not sure if EntitySpawnEvent would apply for those errors.

    Is 410 000 arrow tick (220 000 checkIfActive) count normal? (In 10 minute interval)

    Been trying to look for a solution to reduce server lag, but I'm not sure how to properly read and understand timings.

  4. You should probably look into this, what is actually spawning arrows. Even if you can remove them you're still putting load on GC/server by letting something spawn them.
    • Agree Agree x 1
  5. Since arrows do count as entities, too many entities can overload the server...
    There's actually a simple solution for this. In spigot.yml you can find this: arrow-despawn-rate
    instead of 1200 set it to like 250-300. Or lower, it's up to you really.