LOOHP/ImageFrame

Could not find entity trackers for CraftItemFrame

Opened this issue · 3 comments

[21:57:01 WARN]: [ImageFrame] Plugin ImageFrame v1.7.6.0 generated an exception while executing task 47
java.lang.IllegalArgumentException: Could not find entity trackers for CraftItemFrame{item=ItemStack{STONE x 1}, rotation=NONE}
at com.comphenix.protocol.injector.EntityUtilities.getTrackedPlayers(EntityUtilities.java:183) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.EntityUtilities.getEntityTrackers(EntityUtilities.java:164) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.injector.PacketFilterManager.getEntityTrackers(PacketFilterManager.java:414) ~[ProtocolLib.jar:?]
at com.loohp.imageframe.objectholders.AnimatedFakeMapManager.run(AnimatedFakeMapManager.java:93) ~[ImageFrame-1.7.6.0.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-217]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.20.2.jar:git-Paper-217]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.20.2.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

After updating ProtocolLib to the latest dev build for MC 1.20.2 getting this error:

[22:37:20 WARN]: [ImageFrame] Plugin ImageFrame v1.7.6.0 generated an exception while executing task 43
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.level.WorldServer.a(String)" because the return value of "net.minecraft.server.dedicated.DedicatedServer.a(net.minecraft.resources.ResourceKey)" is null
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.getMap(CraftServer.java:1827) ~[paper-1.20.2.jar:git-Paper-217]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.getMap(CraftServer.java:269) ~[paper-1.20.2.jar:git-Paper-217]
at org.bukkit.Bukkit.getMap(Bukkit.java:890) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaMap.getMapView(CraftMetaMap.java:153) ~[paper-1.20.2.jar:git-Paper-217]
at com.loohp.imageframe.utils.MapUtils.getItemMapView(MapUtils.java:301) ~[ImageFrame-1.7.6.0.jar:?]
at com.loohp.imageframe.objectholders.AnimatedFakeMapManager.run(AnimatedFakeMapManager.java:95) ~[ImageFrame-1.7.6.0.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.2.jar:git-Paper-217]
at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.20.2.jar:git-Paper-217]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.20.2.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

nvm, Cannot invoke "net.minecraft.server.level.WorldServer.a(String)" because the return value is because of my plugin which pauses the server by removing all worlds so that they don't tick (I fixed it). But the previous error from ProtocolLib still exists.

I am no expert but I think here the exception should be replaced from IllegalArgumentException to just Exception?

private List<Player> getEntityTrackers(Entity entity) {
    try {
        return ProtocolLibrary.getProtocolManager().getEntityTrackers(entity);
    } catch (IllegalArgumentException e) {
        return Collections.emptyList();
    }
}