MiraWaNeko / DiscordIntegration

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

The MC command discord link requires OP permission #146

Closed cpw closed 6 years ago

cpw commented 6 years ago

Base informations

Minecraft version: 1.12.2

DiscordIntegration version: 3.0.5

Server type and version: Forge/Spigot/Sponge Forge

Link to pastebin with (censored) config: Optional Nah

Expected behavior

everyone can run discord link to link themselves

Actual behavior

Only ops can run discord link to link themselves

Steps to reproduce

Run discord link on a dedicated server without op permission.

cpw commented 6 years ago

As a comment: the type discrepancy between the discordChannel minecraft entry (requires a long, aka number value in the config) and the Discord channel config (strings all the way baby!) is probably a big reason most people don't get this working properly. You might want to clarify or handle the duality in code.

Mijago commented 6 years ago

Well this happens because the only check for permissions is for /discord, meaning the whole command (and all subcommands, including link) require OP. See the code here.

So possible fixes would be creating a new command for link (/discordlink) or letting anyone execute the command and manage the permissions by ourself in the execute method.

thiakil commented 6 years ago

https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/src/main/java/net/minecraftforge/server/command/CommandTreeBase.java

Mijago commented 6 years ago

@thiakil Now we did the same work ohw ohw :s I am currently working on the integration of config v4 (almost done) and I also added this. I'll push it any moment to my branch.

thiakil commented 6 years ago

I really dont see why it needs a completely new config format, and I needed this for my server. 🤷‍♂️

Mijago commented 6 years ago

It's not a completely new config, just some tweaks discussed in https://github.com/Chikachi/DiscordIntegration/issues/109 and listed https://gist.github.com/Chikachi/bec420e90202a22094f4e6e7ba31999b . Most notably I moved the "token" to another file because people often forgot to remove it there (insecure).

But yea if it works for you, that's great :-)

cpw commented 6 years ago

FYI: this isn't fixed apparently. Someone tried it today. Still need OP.