LuckPerms

LuckPerms

41.4k Downloads

Help

S3nS3IW00 opened this issue ยท 25 comments

commented

Hello dear developers!

I have a question. How can I add a player to group with api? I don't understand it in Developer API :/ Please help with code.

commented

user.setPermission(luckPermsApi.makeGroupNode(...))

There are examples here.
https://github.com/lucko/LuckPerms/wiki/Developer-API#adding-a-permissionparentprefixsuffixmetadata-to-a-usergroup

commented

luckPermsApi is LuckPerms.getApi();?

commented

Yes.

commented

but buildGroupNode() method doesn't exist.

commented

Re-read what I said.

commented

user.setPermission((Node) LuckPerms.getApi().buildGroupNode("ender"));

commented

Again, that's not the method I said. It's makeGroupNode, not buildGroupNode.

Secondly, you shouldn't be casting the Node.Builder to Node. Call the #build method.

commented

Ok, I am not English :D So please explain it in code.

commented

I've already given you an example, and there are more examples on the wiki page. (which I've also linked already)

commented

But I don't understand the Developer api :/ I can't do this :/ If I run the "lp user user parent set group" command, I have an error in console...Why?

commented

I don't know? Can you show me the error?

commented

Yes.

commented

[17:31:38 ERROR]: Command Dispatched Async: lp user S3nS3IW00 parent set vip
[17:31:38 ERROR]: Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C
java.lang.Throwable: null
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:656) [patched_1.12.2.jar:git-Paper-1262]
at hu.endercraft.managers.termekManager.giveVIP(termekManager.java:19) [ECCore.jar:?]
at hu.endercraft.events.EventHandlers.onChat(EventHandlers.java:643) [ECCore.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor53.execute(Unknown Source) [?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:70) [patched_1.12.2.jar:git-Paper-1262]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:74) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:515) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:497) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PlayerConnection.chat(PlayerConnection.java:1386) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1301) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [patched_1.12.2.jar:git-Paper-1262]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_151]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_151]

commented

I dispached in my plugin ConsoleSender()

commented

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+player.getName()+" parent set vip");

commented

The specified player getting the rank, but its flood my console.

commented

That's not a LuckPerms related error.
You're dispatching the command from an async thread, which is unsafe.

As the error says, you need to inform the author of hu.endercraft.managers.termekManager.giveVIP, and ask them to fix the issue.

commented

This is a LuckPerms error. Another command is run without error.

commented

No it's not. Read what the message says.

commented

The other commands is run without error.

commented
[17:31:38 ERROR]: Command Dispatched Async: lp user S3nS3IW00 parent set vip
[17:31:38 ERROR]: Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C
java.lang.Throwable: null
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:656) [patched_1.12.2.jar:git-Paper-1262]
at hu.endercraft.managers.termekManager.giveVIP(termekManager.java:19) [ECCore.jar:?]
at hu.endercraft.events.EventHandlers.onChat(EventHandlers.java:643) [ECCore.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor53.execute(Unknown Source) [?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:70) [patched_1.12.2.jar:git-Paper-1262]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:74) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:515) [patched_1.12.2.jar:git-Paper-1262]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:497) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PlayerConnection.chat(PlayerConnection.java:1386) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1301) [patched_1.12.2.jar:git-Paper-1262]
at net.minecraft.server.v1_12_R1.PacketPlayInChat$1.run(PacketPlayInChat.java:39) [patched_1.12.2.jar:git-Paper-1262]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_151]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_151]

^^ Please read what it says. ^^

The error was thrown because the command was invoked async. It has nothing to do with the command actually being ran.

The error also directs you to a forum post which explains the issue in more detail.

https://www.spigotmc.org/threads/plugins-triggering-commands-async.31815/

This is NOT a luckperms issue.

commented

Its very interesting, why show the error only in LuckPerms command :D

commented

Ok sure, believe whatever you want.

I'm not going to waste any more of my time.

commented

I believe, this is not LuckPerms error, but I don't know why only in LuckPerms.

commented

Hello lucko!

I solved the problem. I'm sorry, because, I think the problem is in your plugin. I just need, to dispatch the command in bukkitrunnable. So really sorry! Have a good develop!