TownyAdvanced / MapTowny

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

Error applying the replacement '%mayor%' for click information on town #17

Closed SmallSansSerif closed 2 years ago

SmallSansSerif commented 2 years ago

Describe the Bug

Noticed this error in console when restarting server. The town of SALT recently fell into ruin (within 30 mins or so) earlier so if that helps.

[12:26:35] [Server thread/ERROR]: [MapTowny] Error applying the replacement '%mayor%' for click information on town 'SALT'! 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 me.silverwolfg11.maptowny.managers.TownInfoManager.lambda$registerReplacements$0(TownInfoManager.java:104) ~[MapTowny-2.0.0-BETA-1.jar:?] at me.silverwolfg11.maptowny.objects.TextReplacement.getReplacedText(TextReplacement.java:88) ~[MapTowny-2.0.0-BETA-1.jar:?] at me.silverwolfg11.maptowny.managers.TownInfoManager.getClickTooltip(TownInfoManager.java:235) ~[MapTowny-2.0.0-BETA-1.jar:?] at me.silverwolfg11.maptowny.managers.TownyLayerManager.buildTownEntry(TownyLayerManager.java:142) ~[MapTowny-2.0.0-BETA-1.jar:?] at me.silverwolfg11.maptowny.tasks.RenderTownsTask.run(RenderTownsTask.java:55) ~[MapTowny-2.0.0-BETA-1.jar:?] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.18.1.jar:git-Purpur-1566] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[purpur-1.18.1.jar:git-Purpur-1566] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1236) ~[purpur-1.18.1.jar:git-Purpur-1566] at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:322) ~[purpur-1.18.1.jar:git-Purpur-1566] at java.lang.Thread.run(Thread.java:833) ~[?:?]

[12:26:38] [Craft Scheduler Thread - 21 - MapTowny/WARN]: [MapTowny] Plugin MapTowny v2.0.0-BETA-1 generated an exception while executing task 987 java.lang.NullPointerException: null at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011) ~[?:?] at java.util.concurrent.ConcurrentHashMap$KeySetView.add(ConcurrentHashMap.java:4652) ~[?:?] at me.silverwolfg11.maptowny.managers.TownyLayerManager.renderTown(TownyLayerManager.java:278) ~[MapTowny-2.0.0-BETA-1.jar:?] at me.silverwolfg11.maptowny.tasks.RenderTownsTask.lambda$run$0(RenderTownsTask.java:60) ~[MapTowny-2.0.0-BETA-1.jar:?] at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] at me.silverwolfg11.maptowny.tasks.RenderTownsTask.lambda$run$1(RenderTownsTask.java:60) ~[MapTowny-2.0.0-BETA-1.jar:?] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.18.1.jar:git-Purpur-1566] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.18.1.jar:git-Purpur-1566] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.18.1.jar:git-Purpur-1566] 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) ~[?:?]

Expected Behavior

Plugin Version

MapTowny v2.0.0-BETA-1

Towny Version

Towny version 0.98.0.4

Pl3xMap Version

squaremap version 1.1.1

Server Software Version

Current: git-Purpur-1566 (MC: 1.18.1)*

Additional Comments

silverwolfg11 commented 2 years ago

Sorry for the delayed response.

This is a bit of a weird issue. Ruined towns do not get rendered on the web-map by MapTowny. When MapTowny goes through the list of towns to render them, it explicitly skips the town if it marked as ruined. So I have no idea how the town in the error got pass the check.

Has a similar error occurred again or was it a one-time thing?

SmallSansSerif commented 2 years ago

I think this was a one time event. I'll let you know if I see it again.

silverwolfg11 commented 2 years ago

If you see it again, go ahead and create a new issue for it! I'm going to go ahead and close this one. Hopefully, it was just a one-time oddity.