LuckPerms

LuckPerms

41.4k Downloads

Placeholders do not function for offline users (Waterfall + MySQL)

Weasel-Beans opened this issue ยท 3 comments

commented

Description

When I try to parse a placeholder for the LuckPerms PlaceholderAPI expansion (eg. %luckperms_has_groups_on_track%), it only gives a response when the user is online, otherwise returns a blank message, which doesn't work for what I'm trying to do.

Here's the update I found for PAPI which describes the addition of offline player support:

https://www.spigotmc.org/resources/placeholderapi.6245/update?update=229457

Reproduction Steps

Run '/papi parse {user} {placeholder}' for a player when they are online to confirm it works, then try again while they are offline.

Expected Behaviour

I expect the placeholder to return a value regardless of a player's online status.

Server Details

Pufferfish version git-Pufferfish-71 (MC: 1.18.2)

waterfall-1.18-488

LuckPerms Version

v5.4.30

Logs and Configs

No response

Extra Details

This is using the most recently updated LuckPerms expansion for PAPI.

commented

Closed to make sure it wasn't an error on my end, sorry about that.

I think the issue might be specifically due to PlaceholderAPI not being able to communicate to the MySQL data over Bungeecord without proper plugin support.

PlaceholderAPI/PlaceholderAPI#36

commented

When trying to get information using vault prefixes, I get this, which could be useful:

[23:10:10 INFO]: Crendor issued server command: /papi parse Weasel_Beans %vault_prefix%
[23:10:10 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'papi' in plugin PlaceholderAPI v2.11.1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.dispatchCommand(CraftServer.java:906) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2308) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2119) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2100) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
        at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1401) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1378) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1371) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1349) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1231) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:317) ~[pufferfish-1.18.2.jar:git-Pufferfish-71]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: me.lucko.luckperms.bukkit.vault.ServerThreadLookupException: A Vault API request has been made on the main server thread that LuckPerms cannot safely respond to.
This is NOT a bug - please do not report it to LuckPerms.
Instead, please carefully read the information given below.
LuckPerms cannot respond to the request because to do so:
- it needs to lookup user data for '1eef2236-9efc-403e-afa4-c6adedd13e89' (an offline player) from the database
Performing this lookup on the main server thread would cause your server to lag.
There are two solutions to this problem:
  a) Ask the author of the plugin making the request to perform Vault calls for
     offline players "asynchronously" (using the scheduler). Additionally, prefer
     using the methods that accept 'Player' or 'OfflinePlayer' instead of usernames.
     You should be able to identify the plugin making the request in the trace below.
  b) As a server admin, you can disable this exception by setting 'vault-unsafe-lookups'
     to true in the LuckPerms configuration file. However, please use this only as
     a last resort.
        at me.lucko.luckperms.bukkit.vault.LuckPermsVaultPermission.lookupUser(LuckPermsVaultPermission.java:156) ~[?:?]
        at me.lucko.luckperms.bukkit.vault.LuckPermsVaultChat.getUserChatPrefix(LuckPermsVaultChat.java:98) ~[?:?]
        at me.lucko.luckperms.bukkit.vault.AbstractVaultChat.getPlayerPrefix(AbstractVaultChat.java:155) ~[?:?]
        at com.extendedclip.papi.expansion.vault.VaultPermsHook.getPlayerPrefix(VaultPermsHook.java:159) ~[?:?]
        at com.extendedclip.papi.expansion.vault.VaultPermsHook.onPlaceholderRequest(VaultPermsHook.java:111) ~[?:?]
        at com.extendedclip.papi.expansion.vault.VaultExpansion.onRequest(VaultExpansion.java:111) ~[?:?]
        at me.clip.placeholderapi.replacer.CharsReplacer.apply(CharsReplacer.java:161) ~[PlaceholderAPI-2.11.1.jar:?]
        at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:70) ~[PlaceholderAPI-2.11.1.jar:?]
        at me.clip.placeholderapi.commands.impl.local.CommandParse.evaluateParseSingular(CommandParse.java:115) ~[PlaceholderAPI-2.11.1.jar:?]
        at me.clip.placeholderapi.commands.impl.local.CommandParse.evaluate(CommandParse.java:57) ~[PlaceholderAPI-2.11.1.jar:?]
        at me.clip.placeholderapi.commands.PlaceholderCommandRouter.onCommand(PlaceholderCommandRouter.java:105) ~[PlaceholderAPI-2.11.1.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        ... 21 more
commented

PlaceholderAPI does not support async placeholders (required to load data for offline players) - as such, this is the intended behaviour for now.