Error when my plugin sends a command to the console

im getting this error everytime plugin starts to work…

[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: java.lang.Exception: Stack trace
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at java.lang.Thread.dumpStack(Unknown Source)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.entity.EntityTracker.handler$onAddEntityToTracker$0(EntityTracker.java:67)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.entity.EntityTracker.func_72786_a(EntityTracker.java:139)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.ServerWorldEventHandler.func_72703_a(ServerWorldEventHandler.java:33)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.World.func_72923_a(World.java:1140)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.WorldServer.func_72923_a(WorldServer.java:1116)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.WorldServer.onSpongeEntityAdded(WorldServer.java:1207)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.WorldServer.forceSpawnEntity(WorldServer.java:1253)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.WorldServer.forceSpawnEntity(WorldServer.java:1236)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.event.tracking.phase.TrackingPhase.spawnEntityOrCapture(TrackingPhase.java:296)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.event.tracking.CauseTracker.spawnEntity(CauseTracker.java:459)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.world.WorldServer.func_72838_d(WorldServer.java:983)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.entity.EntityUtil.dropItemAndGetStack(EntityUtil.java:813)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.entity.EntityUtil.playerDropItem(EntityUtil.java:773)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.entity.player.EntityPlayer.func_146097_a(EntityPlayer.java:364)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.entity.player.EntityPlayer.func_71019_a(EntityPlayer.java:305)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.command.CommandGive.func_184881_a(SourceFile:75)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at net.minecraft.command.CommandHandler.func_175786_a(CommandHandler.java:104)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.command.MinecraftCommandWrapper.tryExecute(MinecraftCommandWrapper.java:150)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.command.MinecraftCommandWrapper.process(MinecraftCommandWrapper.java:136)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.api.command.dispatcher.SimpleDispatcher.process(SimpleDispatcher.java:333)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at org.spongepowered.common.command.SpongeCommandManager.process(SpongeCommandManager.java:274)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at ZpknTr.GallupPollMain.CommandConverter(GallupPollMain.java:380)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at ZpknTr.GallupPollMain.firstLoginMessages(GallupPollMain.java:224)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at ZpknTr.GallupPollMain.access$300(GallupPollMain.java:35)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at ZpknTr.GallupPollMain$1.run(GallupPollMain.java:176)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at java.util.TimerThread.mainLoop(Unknown Source)
[00:52:16] [Timer-0/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]:    at java.util.TimerThread.run(Unknown Source)
[00:52:16][Timer-0/ERROR] [Sponge]: Detected attempt to add entity 'EntityItem['item.item.apple'/125, l='world', x=-176,27, y=70,45, z=120,68]' to tracker asynchronously.
 This is very bad as it can cause ConcurrentModificationException's during a server tick.
 Skipping...
```

Looks like an Apple EntityItem is attempting to spawn in an asynchronous thread

1 Like

im giving the player an apple with give playername minecraft:apple 1 0 command from console but this happens just in first time that i send the command from plugin…
Edit: im calling an function before stopping timer with timer.cancel
and that function is giving the apple…

Pretty sure timer runs on its own thread. Be easier if you showed us the code, same for your other thread

1 Like

ill try to not call function from timer and the interesting part is these two errors are not making the plugin crash…
Plugin is working fine and also it would be fine if i can suppress this errors to not show in console…

This isnt an error you want to ignore as it warns you in the log, it could cause ConcurrentModificationException’s

I’m no expert but I don’t believe you should be using a timer for whatever your trying to do. Instead create a Task. Sponge.getScheduler().createTaskBuilder()…

1 Like

i tried before but i got some error like i couldnt stop the task or the task just executed once even i defined an interval…
Bu i will try again…

again… task is not running my code. i need to make it runs until a boolean variable changes to true and im sure its not default true or something…
i added an interval too and as far as i know if there is an interval defined task will run infinite times…

        Scheduler scheduler = Sponge.getScheduler();
        Task.Builder taskBuilder = scheduler.createTaskBuilder();
        taskBuilder.execute(
                        task ->{
        //Here my codes are and when that boolean becomes true task.cancel(); runs...
        }
                ).interval(100, TimeUnit.MILLISECONDS);


Edit: i added name and submit then it worked somehow...

You always need to call submit() whenever you create a TaskBuilder in order for Sponge to run it.

2 Likes