Solved Armorstand remove in timer

Discussion in 'Plugin Development' started by GOOST, Aug 22, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    GOOST

    So i am making a plugin that includes damage indicator , and i am using armorstand's custom name to achieve that , i want the armorstand to dissapear after around 1 second , and i tried using timer and the result is , the armorstand is deleted only in console side , and if i /kill armorstand's UUID it will work , but if i do /kill @e[type=armor_stand] it won't work , and the armorstand will freeze after the timer , and if i rejoin the server , the armor stand is gone .

    Code:
    Timer indicator_countdown = new Timer(true);
    
                indicator_countdown.schedule(new TimerTask() {
                    @Override
                    public void run()
                    {
                        indicator.remove();
                    }
                }, 1000);// 1000 delay = 1 second
    this is my code
    Code:
    [08:51:56] [Timer-20/WARN]: Exception in thread "Timer-20" java.lang.IllegalStateException: Asynchronous entity unregister!
    [08:51:56] [Timer-20/WARN]:     at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.server.level.WorldServer$a.f(WorldServer.java:2010)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.server.level.WorldServer$a.b(WorldServer.java:1)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.world.level.entity.PersistentEntitySectionManager.f(PersistentEntitySectionManager.java:150)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.world.level.entity.PersistentEntitySectionManager$a.a(PersistentEntitySectionManager.java:503)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.world.entity.Entity.b(Entity.java:3741)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.world.entity.Entity.a(Entity.java:453)
    [08:51:56] [Timer-20/WARN]:     at net.minecraft.world.entity.Entity.ah(Entity.java:435)
    [08:51:56] [Timer-20/WARN]:     at org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity.remove(CraftEntity.java:617)
    [08:51:56] [Timer-20/WARN]:     at me.goost.goostserver.player.player$1.run(player.java:97)
    [08:51:56] [Timer-20/WARN]:     at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
    [08:51:56] [Timer-20/WARN]:     at java.base/java.util.TimerThread.run(Timer.java:516)
    this is the error
    ( idk why but the Timer-XX goes up everytime it runs )
     
  2. Offline

    timtower Administrator Administrator Moderator

    @GOOST Use a BukkitRunnable instead of a Timer.
     
    bennie3211 likes this.
  3. Offline

    GOOST

    @timtower
    Code:
    [19:28:00] [Server thread/ERROR]: Could not pass event EntityDamageEvent to goostserver v1.0-SNAPSHOT
    org.bukkit.event.EventException: null
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:258) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:1045) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:1027) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:864) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:1079) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.EntityLiving.damageEntity0(EntityLiving.java:2009) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.player.EntityHuman.damageEntity0(EntityHuman.java:1046) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.EntityLiving.a(EntityLiving.java:1350) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.player.EntityHuman.a(EntityHuman.java:953) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.level.EntityPlayer.a(EntityPlayer.java:942) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.EntityLiving.a(EntityLiving.java:1839) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.player.EntityHuman.a(EntityHuman.java:1737) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.level.block.Block.a(Block.java:414) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.Entity.a(Entity.java:1249) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.world.entity.EntityLiving.a(EntityLiving.java:369) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.level.EntityPlayer.a(EntityPlayer.java:1350) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1378) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.network.protocol.game.PacketPlayInFlying.a(SourceFile:114) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.network.protocol.game.PacketPlayInFlying$PacketPlayInPositionLook.a(SourceFile:16) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1150) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:131) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.bh(MinecraftServer.java:1129) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1122) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:140) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1106) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1017) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:293) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at java.lang.Thread.run(Thread.java:833) [?:?]
    Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
            at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[commons-lang-2.6.jar:2.6]
            at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:464) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:196) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:187) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskLater(CraftScheduler.java:151) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTask(CraftScheduler.java:120) ~[spigot-1.19.1-R0.1-SNAPSHOT.jar:3563-Spigot-2183145-1e3bf58]
            at org.bukkit.scheduler.BukkitRunnable.runTask(BukkitRunnable.java:45) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            at me.goost.goostserver.player.player.damage(player.java:110) ~[?:?]
            at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
            at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
            ... 36 more
    this is the error i am getting right now , and my " me.goost.goostserver.player.player.damage(player.java:110) " is
    Code:
                }.runTaskLater(plugin, 1L);
    
     
  4. Offline

    timtower Administrator Administrator Moderator

    @GOOST
    java.lang.IllegalArgumentException: Plugin cannot be null
     
  5. Offline

    GOOST

    @timtower NVM , it's just me did not notice i made a noob mistake , because i am learning this plugin development
    TYSM for replying!!!
     
Thread Status:
Not open for further replies.

Share This Page