Closed tebbbi closed 2 years ago
happening still with the newer release... this is a very big issue as it gives any user who logs in access to commands they shouldn't have until i run /role reload my server is set up to automatically restart if stopped or crashed, and until this is fixed the mod is unusable, unless I can find something that autoruns commands on server start. There doesn't seem to be any solutions for fabric that do that
Oh no, this is definitely not good! What mod/MC version are you using, and with what other mods installed?
Minecraft 1.18.1 Fabric loader 0.12.12 fabric-api 0.45.0+1.18 player_roles 1.5.0
It happens when your mod, and the fabric api are the only mods loaded. In that test, since I disabled all my other mods, there aren't any commands that players at the lowest rank have access to that they shouldn't, but the issue is still there, if I give them access to commands that they would need OP for it still doesn't work until I force a "re"load of the permissions after server start.
For some reason /op and /tp did not work even after reloading, but /stop did work. Upon server start /stop did not work, but once /role reload was executed, it did work. Stopping and starting the server once again unloaded roles/permissions until reloading them. /give is another command that did work like /stop (but obviously also required /role reload to take affect).
Adding styled chat 1.2.3+1.18.1 better illustrates the issue, as the rank name and colors/styles aren't applied after server start, until /role reload is executed.
Here is the rest of the mods I am using in case you're curious, even though the issue persists with all of them disabled:
Hopefully this is a quick fix, because I'm at the point in my mod selection where the next mods I add are mostly going to give commands for players to use, and I prefer the simplicity of player roles to luckperms for example, and I'd rather not switch
I've figured out a temporary solution! with scoreboard and command blocks you can track the number of ticks the server has processed. Once someone joins they will have been there for less ticks than the server has been running, /role reload is executed, and then their ticks is set to the same as the global server ticks, so that /role reload is only executed once
It will of course execute /role reload everytime a player joins the game, but the performance impact should be minimal. the important part is role and permissions will be applied after a server startup/restart.
One thing that still boggles my mind, is that the mod seems to be able to load the command_block role (and is necessary for this workaround) but doesn't load any of the other roles until the config is "re"loaded. Hopefully this observation can help you awesome devs figure out what the issue is!
Edit: Someone also made this handy fabric mod that will run whatever commands you specify at server start! Pretty awesome, it runs /role reload and doesn't give the server extra work by counting and comparing ticks like the previous solution I was using https://www.reddit.com/r/fabricmc/comments/rwi83w/any_mods_to_run_a_command_on_server_start/hrr3jyz/ Strangely enough the author also uses Player Roles, and couldn't recreate the issue I and tebbbi are having.
Weirdly I seem to be unable to reproduce this issue with 1.5.0- can you share the roles config you are using when this occurs? And also steps to reproduce if possible
@Gegy Here is a script that sets up a min repro server with EssentialCommands + PlayerRoles.
(Uploaded as md, but this is valid .sh
, just need to change the extension (GH doesn't like executable things, arguably for good reason))
make_fabric_server_dir.md
fabric_test_server/start-FABRIC.sh
/spawn set
(Permissions have already been granted via roles.json
in setup script)/role reload
/spawn set
(it will still be red, as if no access, but run the command anyway)Thank you for providing such detailed reproduction instructions! This has been really helpful. 🙂
Okay- this is really interesting! It looks like the important part here which I was not testing is the use of permission_keys
:
To break down, there's a few issues here:
permission_keys
without a mod installed that handles these, the config silently fails to loadThese issues should be resolved in 1.5.1- I'm going to put out a release now. Thanks so much! 🙂
im not entirely sure if this is an issue but whenever my server restarts i have to reload run /role reload for them to work again.
Im really sorry if this is supposed to happen, im not trying to waste your time.