BananaPuncher714 / Cartographer2

The best minimap plugin for Bukkit
50 stars 32 forks source link

Map with ID 2 causes exceptions in console #21

Open galexrt opened 2 years ago

galexrt commented 2 years ago

I'm using the ItemJoin plugin to give users a map with ID 2, but when looking at the map we get the following exception spammed in console:

[16:58:01 ERROR]: Could not render map using renderer io.github.bananapuncher714.cartographer.core.renderer.CartographerRenderer
java.lang.IllegalStateException: Item does not have map associated - check hasMapView() first!
    at com.google.common.base.Preconditions.checkState(Preconditions.java:502) ~[guava-31.0.1-jre.jar:?]
    at org.bukkit.craftbukkit.v1_18_R1.inventory.CraftMetaMap.getMapId(CraftMetaMap.java:147) ~[paper-1.18.1.jar:git-Paper-152]
    at io.github.bananapuncher714.cartographer.core.internal.Util_1_13.getMapViewFrom(Util_1_13.java:34) ~[Cartographer2-2.15.3.jar:?]
    at io.github.bananapuncher714.cartographer.core.renderer.CartographerRenderer.render(CartographerRenderer.java:565) ~[Cartographer2-2.15.3.jar:?]
    at org.bukkit.craftbukkit.v1_18_R1.map.CraftMapView.render(CraftMapView.java:159) ~[paper-1.18.1.jar:git-Paper-152]
    at net.minecraft.world.level.saveddata.maps.MapItemSavedData$HoldingPlayer.nextUpdatePacket(MapItemSavedData.java:629) ~[?:?]
    at net.minecraft.world.level.saveddata.maps.MapItemSavedData.getUpdatePacket(MapItemSavedData.java:433) ~[?:?]
    at net.minecraft.world.item.MapItem.getUpdatePacket(MapItem.java:375) ~[?:?]
    at net.minecraft.server.level.ServerPlayer.doTick(ServerPlayer.java:676) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.tick(ServerGamePacketListenerImpl.java:317) ~[?:?]
    at net.minecraft.network.Connection.tick(Connection.java:526) ~[?:?]
    at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:201) ~[?:?]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1636) ~[paper-1.18.1.jar:git-Paper-152]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:480) ~[paper-1.18.1.jar:git-Paper-152]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1470) ~[paper-1.18.1.jar:git-Paper-152]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.18.1.jar:git-Paper-152]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-152]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

This seems to correctly give users a map item ingame but the map is not working. I'm not sure if it is ItemJoin causing an issue here or Cartographer unable to use the map item ItemJoin created.

If you need more information (e.g., minimap config file), please let me know.

galexrt commented 2 years ago

Giving myself a filled_map (also map) item with the id 2 using the command: /give Galexrt filled_map{map:2} causes the exceptions in the console as well.

The only way to get a working map is to use /cartographer get 1

BananaPuncher714 commented 2 years ago

Thanks, I'll take a look and see what I can do.