nikosgram / gringotts-towny

Gringotts-Towny allows the creation of Gringotts vaults and account for Towny's nations and towns.
https://www.spigotmc.org/resources/gringotts-towny.105074/
BSD 2-Clause "Simplified" License
3 stars 2 forks source link

vaultsOnlyInTowns & maxTown/NationVaults configuration options #2

Closed GroobleDierne closed 2 years ago

GroobleDierne commented 2 years ago

Port of https://github.com/nikosgram/gringotts/pull/98

It keeps track of the number of vaults via the MetaData API of Towny which allows storing per town/nation variables.

GroobleDierne commented 2 years ago

It's normally ready to be merged, let me know if something is wrong. While I'm here, I have some other things to discuss with you 😉: We can't access the maven packages of Gringotts because Github makes it private even if your repository is public, the workaround if found is to provide people with an access token that has read-only access to your maven packages (you can see what I did here) or you can host your packages for free on Jitpack.

Also, I noticed that Gringotts is causing the server to freeze when someone is trying to claim a chunk, according to the thread dumps it appends because Gringotts is trying to retrieve OfflinePlayers by their name which checks against Mojang if the account is valid. See below for the thread dump. I wasn't able to test with the latest version of Gringotts because I needed this PR for my server, now that it's done I will try to see if this problem is still occurring and try to fix it in that case.

Thanks for your time 😄

[12:58:02] [Server thread/INFO]: Eomelius issued server command: /t claim
[12:58:12] [Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH  - git-Purpur-1708 (MC: 1.19) ---
[12:58:12] [Watchdog Thread/ERROR]: The server has not responded for 10 seconds! Creating thread dump
[12:58:12] [Watchdog Thread/ERROR]: ------------------------------
[12:58:12] [Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Purpur!):
[12:58:12] [Watchdog Thread/ERROR]: ------------------------------
[12:58:12] [Watchdog Thread/ERROR]: Current Thread: Server thread
[12:58:12] [Watchdog Thread/ERROR]:     PID: 26 | Suspended: false | Native: false | State: TIMED_WAITING
[12:58:12] [Watchdog Thread/ERROR]:     Stack:
[12:58:12] [Watchdog Thread/ERROR]:         java.base@17.0.4/java.lang.Thread.sleep(Native Method)
[12:58:12] [Watchdog Thread/ERROR]:         com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository.findProfilesByNames(YggdrasilGameProfileRepository.java:93)
[12:58:12] [Watchdog Thread/ERROR]:         com.destroystokyo.paper.profile.PaperGameProfileRepository.findProfilesByNames(PaperGameProfileRepository.java:44)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.players.GameProfileCache.lookupGameProfile(GameProfileCache.java:110)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.players.GameProfileCache.get(GameProfileCache.java:181)
[12:58:12] [Watchdog Thread/ERROR]:         org.bukkit.craftbukkit.v1_19_R1.CraftServer.getOfflinePlayer(CraftServer.java:1864)
[12:58:12] [Watchdog Thread/ERROR]:         org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:1239)
[12:58:12] [Watchdog Thread/ERROR]:         gringotts-2.12.3.jar//org.gestern.gringotts.api.impl.VaultConnector.getBalance(VaultConnector.java:102)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.object.economy.adapter.VaultEconomyAdapter.getBalance(VaultEconomyAdapter.java:33)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.TownyEconomyHandler.getBalance(TownyEconomyHandler.java:144)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.TownyEconomyHandler.hasEnough(TownyEconomyHandler.java:156)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.object.economy.Account.canPayFromHoldings(Account.java:199)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.object.economy.BankAccount.subtractMoney(BankAccount.java:92)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.object.economy.Account.withdraw(Account.java:91)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.command.TownCommand.parseTownClaimCommand(TownCommand.java:3703)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.command.TownCommand.parseTownCommand(TownCommand.java:751)
[12:58:12] [Watchdog Thread/ERROR]:         towny-0.98.3.11.jar//com.palmergames.bukkit.towny.command.TownCommand.onCommand(TownCommand.java:561)
[12:58:12] [Watchdog Thread/ERROR]:         org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[12:58:12] [Watchdog Thread/ERROR]:         org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
[12:58:12] [Watchdog Thread/ERROR]:         org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:940)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2459)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$19(ServerGamePacketListenerImpl.java:2230)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.network.PlayerConnection$$Lambda$12273/0x0000000802e95438.run(Unknown Source)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.TickTask.run(TickTask.java:18)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1385)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.d(MinecraftServer.java:183)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1362)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1355)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1333)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1218)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:307)
[12:58:12] [Watchdog Thread/ERROR]:         net.minecraft.server.MinecraftServer$$Lambda$4436/0x000000080153fab8.run(Unknown Source)
[12:58:12] [Watchdog Thread/ERROR]:         java.base@17.0.4/java.lang.Thread.run(Thread.java:833)