NPE when failing to get players (dis)allowed permissions.
svenar-nl opened this issue ยท 0 comments
I'm not a dummy, so I've checked these
- I am not using any other permission management plugin
- I use the latest available version of PowerRanks
- I am a human
Describe the bug
This error happens when a player object differs from the one stored in PowerRanks.
To Reproduce
Unknown
Expected behavior
No error.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
Exception in thread "ForkJoinPool.commonPool-worker-0" java.lang.NullPointerException
[08:08:48 WARN]: at nl.svenar.PowerRanks.PowerRanksVaultPermission.playerHas(PowerRanksVaultPermission.java:95)
[08:08:48 WARN]: at com.sk89q.wepif.VaultResolver.hasPermission(VaultResolver.java:100)
[08:08:48 WARN]: at com.sk89q.wepif.PermissionsResolverManager.hasPermission(PermissionsResolverManager.java:170)
[08:08:48 WARN]: at com.sk89q.worldedit.bukkit.BukkitPlayer.hasPermission(BukkitPlayer.java:173)
[08:08:48 WARN]: at java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
[08:08:48 WARN]: at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
[08:08:48 WARN]: at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
[08:08:48 WARN]: at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
[08:08:48 WARN]: at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
[08:08:48 WARN]: at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
[08:08:48 WARN]: at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
[08:08:48 WARN]: at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
[08:08:48 WARN]: at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[08:08:48 WARN]: at java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:516)
[08:08:48 WARN]: at com.sk89q.worldedit.command.util.PermissionCondition.lambda$satisfied$0(PermissionCondition.java:47)
[08:08:48 WARN]: at java.util.Optional.map(Optional.java:215)
[08:08:48 WARN]: at com.sk89q.worldedit.command.util.PermissionCondition.satisfied(PermissionCondition.java:47)
[08:08:48 WARN]: at com.sk89q.worldedit.bukkit.BukkitCommandInspector.testPermission(BukkitCommandInspector.java:81)
[08:08:48 WARN]: at com.sk89q.bukkit.util.DynamicPluginCommand.testPermissionSilent(DynamicPluginCommand.java:100)
[08:08:48 WARN]: at org.bukkit.craftbukkit.v1_16_R1.command.BukkitCommandWrapper.test(BukkitCommandWrapper.java:48)
[08:08:48 WARN]: at org.bukkit.craftbukkit.v1_16_R1.command.BukkitCommandWrapper.test(BukkitCommandWrapper.java:20)
[08:08:48 WARN]: at com.mojang.brigadier.tree.CommandNode.canUse(CommandNode.java:79)
[08:08:48 WARN]: at net.minecraft.server.v1_16_R1.CommandDispatcher.a(CommandDispatcher.java:300)
[08:08:48 WARN]: at net.minecraft.server.v1_16_R1.CommandDispatcher.sendAsync(CommandDispatcher.java:264)
[08:08:48 WARN]: at net.minecraft.server.v1_16_R1.CommandDispatcher.lambda$a$4(CommandDispatcher.java:247)
[08:08:48 WARN]: at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
[08:08:48 WARN]: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
[08:08:48 WARN]: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
[08:08:48 WARN]: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
[08:08:48 WARN]: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:163)
Desktop (please complete the following information):
- Minecraft server version: 1.16
- PowerRanks version 1.8
Additional context
https://github.com/svenar-nl/PowerRanks/blob/9ddb5fab426909814f4cfb585b66cf509132bcc3/Legacy/PowerRanks/src/nl/svenar/PowerRanks/PowerRanksVaultPermission.java#L95
Change to store the players UUID instead of the player object itself