Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to run "role assign @s[type=minecraft:player] (rolename)" from a command block #48

Open
pahanakun opened this issue Jan 7, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@pahanakun
Copy link

Hello!

I'm not sure why I can't run it, but I would be ecstatic if we were able to run the command "role assign @s[type=minecraft:player] (rolename)" from a command block. or just /role assign in general (it doesn't work even if I substitute in a player's name)

I've already got scoreboard and command blocks tracking playtimes in minutes. I have ranks set up, and want to promote players once they hit milestones of playtime minutes. I know the command blocks work fine, they trigger "say test" for example when they hit the right number of minutes. "role assign" just refuses to run. I've already created a command_block role to give them access to every possible command, which has allowed command blocks to run "role reload."

running 1.18.1
fabric loader 0.12.12
mod list: https://pastebin.com/yixz32aU

@haykam821
Copy link
Contributor

haykam821 commented Jan 7, 2022

The @s selector represents an entity executing the command, so it isn't available from command blocks. You need to use /execute as or a different selector.

For general command block use, this bug still should be fixed, though.

@pahanakun
Copy link
Author

@s works just fine in command blocks, when the command starts with "execute as" (which they already did in the sources where I got them)

@s alone does not work while manually running /role assign @s (role) for example, but /role assign @s[type=minecraft:player] does. The mod doesn't like @s because it can include entities, but with @s[type=minecraft:player] it works fine. Command blocks just cant run "role assign" at all, even with a specific username, so @s isn't the issue when used as @s[type=minecraft:player]

@pahanakun
Copy link
Author

pahanakun commented Jan 10, 2022

I just finished setting up discord integration, which let me run /role assign in the console thru discord, and I thought "well, discord can do it, its a shame the command block can't, why not just give it another shot?" and lo and behold, it now works!

Turns out this issue is tied into the config file for Player Roles not being loaded on startup until running /role reload: #45

Having /role reload executed fixes this issue where command blocks cannot execute /role assign. I also went overboard making sure command blocks could use the command (made up some permissions that may or may not exist lol):

{
	"command_blocks": {
	  "apply": {
		"command_block": true
	  },
	  "overrides": {
	  "permission_keys": {
		"playerroles.reload": "allow",
		"role.reload": "allow"
	  },
		"commands": {
		  ".*": "allow",
		  "role reload": "allow"
		} 
	  }
	},

edit: command blocks can run basic /role assign (playername/selector) (rolename) but as soon as it uses the execute command and has conditions it doesn't work. These commands work fine being manually executed, and have no issue being executed by a python script that connects using RCON, which is going to be my solution for the moment. Command blocks would be better in case my script crashes (which it does if it can't connect to the server thru RCON)

@Gegy Gegy added the bug Something isn't working label Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants