TownyAdvanced / MapTowny

A Towny add-on Bukkit plugin that enables towns to show up on a web-map.
MIT License
15 stars 17 forks source link

Placeholder error for ruined towns #54

Open Firav opened 6 months ago

Firav commented 6 months ago

Describe the Bug

The following error displays on every refresh interval for ruined towns.

- [Wed 10:13:09 ERROR MapTowny] Error applying the replacement '%mayor%' for click information on town 'Sangtown'!
java.lang.NullPointerException: Cannot invoke "com.palmergames.bukkit.towny.object.Resident.getName()" because the return value of "com.palmergames.bukkit.towny.object.Town.getMayor()" is null
    at maptowny-2.2.0.jar//me.silverwolfg11.maptowny.managers.TownInfoManager.lambda$registerReplacements$0(TownInfoManager.java:104)
    at maptowny-2.2.0.jar//me.silverwolfg11.maptowny.objects.TextReplacement.getReplacedText(TextReplacement.java:88)
    at maptowny-2.2.0.jar//me.silverwolfg11.maptowny.managers.TownInfoManager.getClickTooltip(TownInfoManager.java:237)
    at maptowny-2.2.0.jar//me.silverwolfg11.maptowny.managers.TownyLayerManager.buildTownEntry(TownyLayerManager.java:172)
    at maptowny-2.2.0.jar//me.silverwolfg11.maptowny.tasks.RenderTownsTask.run(RenderTownsTask.java:55)
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101)
    at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1470)
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446)
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1379)
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1156)
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315)
    at java.base/java.lang.Thread.run(Thread.java:840)

Plugin Version

2.2.0

Towny Version

0.100.0.14

Server Software Version

git-Paper-318 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT) (Git: 9271ee7)

silverwolfg11 commented 5 months ago

Hi, thanks for reporting the issue, and sorry for the late response.

Ruined towns shouldn't be getting rendered to the map. This would imply that the ruined town check is failing on the Towny side. Do the ruined towns have any residents? If so, that might be what's causing the check to fail. If this is still occurring, I would also encourage reporting this on the Towny github as well.