hafarooki / ExplosionReversal

A lightweight plugin for Minecraft servers which makes blocks destroyed by explosions regenerate.
MIT License
8 stars 7 forks source link

Items don't regenerate on Spigot #36

Open Xardion495 opened 4 years ago

Xardion495 commented 4 years ago

Hello.

The plugin works great but constantly spaming an exception messages in the log journal:

[00:11:03 WARN]: [ExplosionRegen] Task #8 for ExplosionRegen v4.0.0 generated an exception java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.Item at org.bukkit.craftbukkit.v1_16_R1.CraftWorld.createEntity(CraftWorld.java:1791) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at org.bukkit.craftbukkit.v1_16_R1.CraftWorld.spawn(CraftWorld.java:1816) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at org.bukkit.craftbukkit.v1_16_R1.CraftWorld.spawn(CraftWorld.java:1403) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at org.bukkit.craftbukkit.v1_16_R1.CraftWorld.spawnEntity(CraftWorld.java:647) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.starlegacy.explosionregen.Regeneration.regenerateEntity(Regeneration.java:90) ~[?:?] at net.starlegacy.explosionregen.Regeneration.regenerateEntities(Regeneration.java:79) ~[?:?] at net.starlegacy.explosionregen.Regeneration.pulse(Regeneration.java:21) ~[?:?] at net.starlegacy.explosionregen.ExplosionRegenPlugin.lambda$scheduleRegen$0(ExplosionRegenPlugin.java:44) ~[?:?] at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at org.bukkit.craftbukkit.v1_16_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.minecraft.server.v1_16_R1.MinecraftServer.b(MinecraftServer.java:1061) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.minecraft.server.v1_16_R1.DedicatedServer.b(DedicatedServer.java:354) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.minecraft.server.v1_16_R1.MinecraftServer.a(MinecraftServer.java:1009) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:848) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.1.jar:git-Spigot-0509002-7c03d25] at java.lang.Thread.run(Unknown Source) [?:1.8.0_261]

It is a big hindrance to read logs and seems to be putting some load on the server.

hafarooki commented 4 years ago

Thanks for pointing this out.

  1. Are items regenerating fine for you?
  2. Do you get the same error on paper? (I highly recommend switching to it for better performance, especially on 1.16. Make sure to use aikars jvm flags as well)
  3. If you get paper, can you get me a timings report? (Paper has timings v2, more useful than timings v1)

https://PaperMC.io to get paper

Xardion495 commented 4 years ago

Yes, items are regenerating fine. I use spigot because the most plugins which i using are developed with an eye on spigot and not paper. I suspect that if changing the kernel to paper, most likely there will be no errors, but I am concerned about plugins compatibility in the perspective.

hafarooki commented 4 years ago

Paper is a fork of spigot that is kept up to date, with a fairly large community behind it. Generally, it is compatible with spigot plugins, including ones that use NMS. The performance gains are often super significant so it's definitely worth trying. Only in unusual edge cases will you find incompatible plugins. In that case, they'd probably help you resolve it in the paper discord. Overall, especially since you're having performance issues, I definitely highly recommend it. Especially because it'd make it possible for me to figure out what's causing lag xD

The reason I think there's a chance that it might be only on spigot is that I tested it on paper. However, I might've just missed the error on console if items are actually regenerating fine. I still strongly recommend giving paper a shot, it'll be a win win for you and help me figure out if anything in this plugin is causing performance issues.

Xardion495 commented 4 years ago

After changing the kernel to Paper the spamming is gone. I'll collecting some feedbacks from the testers and if all will be okay close the ticket. But I can already see improvements. Thanks in advance for all your responses.

hafarooki commented 4 years ago

Good to hear.! If you've got Discord, you might want to join papers discord (https://discordapp.com/papermc I think).

No need to close the ticket; I'll try to debug it on spigot when I get a chance, God willing. If you do get more performance issues, please do /timings report and paste the resulting link here

hafarooki commented 3 years ago

It appears that this is because Spigot doesn't support spawnEntity for DROPPED_ITEM-type entities. The solution to this is probably to have special handling for items that doesn't depend on the NMS data to begin with, since items can already be serialized. For the meantime, I fixed the error causing spamming, it should now only print a single error message.