mcmonkeyprojects / Sentinel

Combat NPCs for Spigot!
MIT License
165 stars 85 forks source link

EventException on PlayerTeleportEvent #282

Closed SlimeDog closed 5 years ago

SlimeDog commented 5 years ago
>version
[07:34:55 INFO]: This server is running CraftBukkit version git-Spigot-5629554-4c8327f (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
[07:34:55 INFO]: You are running the latest version
>version citizens
[07:35:02 INFO]: Citizens version 2.0.24-SNAPSHOT (build 1626)
[07:35:02 INFO]: Website: http://www.citizensnpcs.co
[07:35:02 INFO]: Authors: aPunch and fullwall
>version sentinel
[07:35:06 INFO]: Sentinel version 1.8.5 (build 239)
[07:35:06 INFO]: Author: mcmonkey

This error has occurred six times on back-up (as-close-as-possible) identical test server, since copy from main and reboot 40 minutes ago. No players were connected over this period.

plugins/Sentinel/config.yml sans comments and blank lines

sentinel defaults:
    close chase target: true
    ranged chase target: false
    damage: -1
    armor: -1
    health: 20
    invincible: false
    attack rate: 30
    heal rate: 100
    fightback: true
    needs ammo: false
    safe shot: true
    respawn time: 100
    enemy drops: false
    enemy target time: 0
    speed: 1.5
    autoswitch: false
    accuracy: 0
    realistic: false
    reach: 3
    avoid range: 10
    runaway: false
random:
    run away time: 1200
    spectral sound: ENTITY_VILLAGER_YES
    workaround damage: false
    workaround drops: false
    shoot speed minimum: 20
    clever ticks: 10
    workaround bukkit events: false
    workaround entity chase pathfinder: false
    death messages: true
    enforce damage: false
    protected: false
    skull allowed: true
    max health: 2000
    ignore invisible targets: true
    no guard damage: true
    guard follow distance:
        selection range: 4
        minimum: 7
update rate: 10
config version: 11
times_changed: 1
[07:27:25 ERROR]: Could not pass event PlayerTeleportEvent to Sentinel v1.8.5 (build 239)
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:507) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:492) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer.teleport(CraftPlayer.java:597) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity.teleport(CraftEntity.java:295) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.citizensnpcs.npc.CitizensNPC.spawn(CitizensNPC.java:233) ~[?:?]
        at net.citizensnpcs.npc.CitizensNPC.spawn(CitizensNPC.java:190) ~[?:?]
        at net.citizensnpcs.EventListen.spawn(EventListen.java:610) ~[?:?]
        at net.citizensnpcs.EventListen.respawnAllFromCoord(EventListen.java:580) ~[?:?]
        at net.citizensnpcs.EventListen.onChunkLoad(EventListen.java:144) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:66) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:507) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:492) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.Chunk.addEntities(Chunk.java:816) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:1556) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.MinecraftServer.postToMainThread(MinecraftServer.java:1565) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:103) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.getChunkAt(World.java:267) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.getChunkAtWorldCoords(World.java:263) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.getType(World.java:658) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.a(World.java:532) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.applyPhysics(World.java:496) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.update(World.java:460) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.notifyAndUpdatePhysics(World.java:391) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.World.setTypeAndData(World.java:363) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock.setTypeAndData(CraftBlock.java:165) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock.setBlockData(CraftBlock.java:155) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock.setType(CraftBlock.java:144) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock.setType(CraftBlock.java:138) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at ch.njol.skript.bukkitutil.block.NewBlockCompat$NewBlockSetter.setBlock(NewBlockCompat.java:243) [Skript-2.3.6.jar:?]
        at ch.njol.skript.util.BlockUtils.set(BlockUtils.java:66) [Skript-2.3.6.jar:?]
        at ch.njol.skript.aliases.ItemType.setBlock(ItemType.java:384) [Skript-2.3.6.jar:?]
        at ch.njol.skript.classes.data.DefaultChangers$6.change(DefaultChangers.java:308) [Skript-2.3.6.jar:?]
        at ch.njol.skript.classes.data.DefaultChangers$6.change(DefaultChangers.java:1) [Skript-2.3.6.jar:?]
        at ch.njol.skript.lang.util.ConvertedExpression.change(ConvertedExpression.java:142) [Skript-2.3.6.jar:?]
        at ch.njol.skript.expressions.base.WrapperExpression.change(WrapperExpression.java:124) [Skript-2.3.6.jar:?]
        at ch.njol.skript.effects.EffChange.execute(EffChange.java:284) [Skript-2.3.6.jar:?]
        at ch.njol.skript.lang.Effect.run(Effect.java:52) [Skript-2.3.6.jar:?]
        at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) [Skript-2.3.6.jar:?]
        at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89) [Skript-2.3.6.jar:?]
        at ch.njol.skript.lang.Trigger.execute(Trigger.java:57) [Skript-2.3.6.jar:?]
        at ch.njol.skript.events.EvtAtTime.execute(EvtAtTime.java:144) [Skript-2.3.6.jar:?]
        at ch.njol.skript.events.EvtAtTime$1.run(EvtAtTime.java:119) [Skript-2.3.6.jar:?]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:81) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:392) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:889) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:417) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:831) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:729) [spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1042) ~[?:?]
        at java.util.ArrayList$Itr.next(ArrayList.java:996) ~[?:?]
        at org.mcmonkey.sentinel.SentinelEventHandler.onPlayerTeleports(SentinelEventHandler.java:161) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:312) ~[spigot-1.13.2.jar-2019-03-26-0433:git-Spigot-5629554-4c8327f]
        ... 55 more
SlimeDog commented 5 years ago

After loading a later copy (back-ups on the main test server are taken every hour), the back-up test server has not encountered the error. Perhaps it was a transitory issue, but whatever caused the null should probably be caught and managed appropriately.

mcmonkey4eva commented 5 years ago

There's no null, that's just Bukkit being dumb. The actual exception is the part at the end:

Caused by: java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1042) ~[?:?]
        at java.util.ArrayList$Itr.next(ArrayList.java:996) ~[?:?]
        at org.mcmonkey.sentinel.SentinelEventHandler.onPlayerTeleports(SentinelEventHandler.java:161) ~[?:?]

I'm not sure where the error stems from, but it's related to another error posted on Discord. There seems to be something causing NPCs to disappear at certain times without calling the relevant NPC removal methods. I don't know why.

Either way, it should be fixed in build DEV-240+ (using code that just preemptively detects NPCs that got disappear'd, as I don't know how to fix the root cause of them disappearing without a trace)

SlimeDog commented 5 years ago

Thanks for addressing it, whatever it is. Since I cannot reliably reproduce it, I'm closing the ticket.

mcmonkey4eva commented 5 years ago

Update: I believe I've located and fixed the original source issue that causes this - was some mishandling of NPC death. This fix is in build DEV-241+

SlimeDog commented 5 years ago

Yay! Thanks for staying on it.