MiraWaNeko / DiscordIntegration

Communicate between Minecraft and Discord
https://discordintegration.net
GNU Affero General Public License v3.0
88 stars 42 forks source link

[LuckPerms] Permission Denied for Commands #132

Closed CDAGaming closed 6 years ago

CDAGaming commented 6 years ago

97 Basically, except on LuckPerms (Which Unfortunatly /op DiscordFakeUser doesn't solve

MiraWaNeko commented 6 years ago

It's up to the different permission mods to have ways for giving DiscordFakeUser permissions. It's a FakePlayer which inherits from EntityPlayerMP, so it basicly a player that doesn't exist in the world. I'm open for suggestions if there's a better way for doing this.

CDAGaming commented 6 years ago

https://github.com/lucko/LuckPerms/issues/834 They say it would be up to you to bridge the gap :P

Ricket commented 6 years ago

CDAGaming, for those of us who are only familiar with Forge and barely know what sponge/bukkit are, can you tell us how we would reproduce this issue? Like which things do we go download and put together, to make a server which has LuckPerms and DiscordIntegration installed, and then what do we put in the config, so that we can run the same command you run when you get permission denied? If I can get such a thing cobbled together then I (or Chikachi) might be able to hook a debugger to it and figure out what's going on.

CDAGaming commented 6 years ago

SpongeForge is technically a mod, which can be put in your servers mods folder. This adds a plugins subfolder into the mods folder for sponge plugins, which in this case, Luck perms. I can send over my DiscordIntegration config and Help for LuckPerms is on it's Wiki/GitHub, or accessible via /lp help

Ricket commented 6 years ago

Thanks, sounds doable. Yeah it would help to have the config (make sure to remove/censor your discord API key) and the command(s) you ran in luckperms to try to give the fake user permission.

CDAGaming commented 6 years ago

https://hastebin.com/biwuzamofe.swift (Commands and Config Used ^^)

Ricket commented 6 years ago

Here's the relevant log message when I tried to type !stop in discord chat:

[16:22:01] [JDA MainWS-ReadThread/WARN] [Sponge]: No entity type is registered for class chikachi.discord.DiscordCommandSender
[16:22:01] [JDA MainWS-ReadThread/INFO] [STDERR]: [chikachi.discord.repack.net.dv8tion.jda.core.utils.SimpleLog:print:267]: [16:22:01] [ERROR] [chikachi.discord.repack.net.dv8tion.jda.core.JDA]: One of the EventListeners had an uncaught exception
[16:22:01] [JDA MainWS-ReadThread/INFO] [STDERR]: [chikachi.discord.repack.net.dv8tion.jda.core.utils.SimpleLog:print:267]: [16:22:01] [ERROR] [chikachi.discord.repack.net.dv8tion.jda.core.JDA]: Encountered an Exception:
java.lang.IllegalStateException: CauseStackManager called from off main thread (current='ReadingThread{class=class chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread, name=JDA MainWS-ReadThread, priority=5, group=net.minecraftforge.fml.common.thread.SidedThreadGroup[name=SERVER,maxpri=10]}', expected='Thread{class=class java.lang.Thread, name=Server thread, priority=5, group=net.minecraftforge.fml.common.thread.SidedThreadGroup[name=SERVER,maxpri=10]}')!
        at org.spongepowered.common.event.SpongeCauseStackManager.enforceMainThread(SpongeCauseStackManager.java:71)
        at org.spongepowered.common.event.SpongeCauseStackManager.pushCause(SpongeCauseStackManager.java:107)
        at org.spongepowered.common.command.SpongeCommandManager.process(SpongeCommandManager.java:298)
        at net.minecraft.command.ServerCommandManager.func_71556_a(SourceFile:1083)
        at chikachi.discord.listener.DiscordListener.tryExecuteCommand(DiscordListener.java:214)
        at chikachi.discord.listener.DiscordListener.onMessageReceived(DiscordListener.java:105)
        at chikachi.discord.repack.net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:404)
        at chikachi.discord.repack.net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
        at chikachi.discord.repack.net.dv8tion.jda.core.handle.MessageCreateHandler.handleDefaultMessage(MessageCreateHandler.java:128)
        at chikachi.discord.repack.net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:49)
        at chikachi.discord.repack.net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
        at chikachi.discord.repack.net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:969)
        at chikachi.discord.repack.net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:661)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:260)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:238)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.handleTextFrame(ReadingThread.java:963)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:746)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
        at chikachi.discord.repack.com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
        at chikachi.discord.repack.com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

The "No entity type" message from sponge comes from: https://github.com/SpongePowered/SpongeCommon/blob/stable-7/src/main/java/org/spongepowered/common/registry/type/entity/EntityTypeRegistryModule.java#L252

The IllegalStateException is a red herring thrown by sponge trying to print out the actual exception. I'm working to reveal that one.

Ricket commented 6 years ago

Well nevermind. It's fixed in 3.0.5, I can run !stop just fine. Double checked that if I use the 3.0.4 from curseforge I get the above, and if I use 3.0.5 it succeeds.

MiraWaNeko commented 6 years ago

Oh right, that's actually the description of #119 ...

CDAGaming commented 6 years ago

Oh, Alright :D