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

[FEATURE] Allow server admins to modify other players Prefix, Suffix and name #4

Open
fibberclip opened this issue Oct 1, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@fibberclip
Copy link

Is your feature request related to a problem? Please describe.
In a way. I wanted to use this mod to personally edit player's prefixes and suffixes to give players badges, flags & stuff on my personal server

Describe the solution you'd like, or the feature you want to see implemented
It'd be sick if server admins were able to set other player's prefix, suffix and potentially nicknames too, as well as just an option in the config to block players from editing their own stuff. This would make it so much easier to manually set a player's badges on their suffix without having to make a new team for them.

Describe alternatives you've considered
The workaround i've been using is teams, however it's very tedious, since if i wanna give Player 1 badge A, B and C but player 2 only badge C, i have to make entirely new teams for each player.

Additional context
My server has a custom font to display country flags and badges on the player's name (such as supporter, player, admin, etc) and while it's a pretty straight-forward system, creating a new team for every single player that needs more than 1 very specific badge is tiring.

@fibberclip fibberclip added the enhancement New feature or request label Oct 1, 2024
@eclipseisoffline
Copy link
Owner

Hi, modifying other players names is possible by making use of the vanilla /execute as command, which makes that player execute the given command. For example, this command would set the nickname of the player "Steve" to "NotSteve":

/execute as Steve run name nickname NotSteve

Additionally, you can prevent players from changing prefixes/nicknames/suffixes by not giving them the customname.prefix, customname.nick or customname.suffix permissions respectively. Make sure you have require_permissions set to true in the configuration file.

You can use a permission manager like LuckPerms to manage player permissions. A full description of the mod's permissions can be found in the README. Also, note that LuckPerms can also set prefixes/suffixes, which this mod supports reading from. More on that can be read in LuckPerms Meta Commands wiki page.

I will consider adding support to change other player's names using just the /name command as it has been requested before, I'll keep you updated on this.

@fibberclip
Copy link
Author

Oooh, i see! I did try running the /execute command but it showed as red and didn't go through... I can't recall if the mod was installed on the server only, though, maybe that was the issue? i'll try again tomorrow when players are on the server, thank you!

I mentioned the config option since i've personally had a lot of performance issues with LuckPerms on my server, just adding it tanks the tps a lot, i'll give it another shot, but a simple config option to allow only ops to run commands (off by default, imo) would be a life saver 🙏 tysm for such a quick reply!

@eclipseisoffline
Copy link
Owner

Hm, odd that the /execute command showed as red, as the mod should only have to be installed server-side. Make sure that the normal /name command outside of /execute works, and verify that you entered /execute correctly (/execute as <player> run name <options>).

If you have require_permissions set to true (which it is by default), then only operators or players with said permissions can use the /name command. Since you don't use a permission manager, that should mean only operators can use the command.

Hopefully this helps, if you have any further issues, feel free to let me know!

@fibberclip
Copy link
Author

Yeah, the normal name command works fine outside of that, but when i try to run it inside execute it shows as red. Execute itself works ofc, but trying to do "/execute as [player] run" then name doesn't show up... I'll run proper tests tomorrow since i can't access the server rn, but when i did try it didn't allow me

That's perfect then, all i need ^^ thank you! I'll tweak the configs tomorrow too, thanks a lot!!

@eclipseisoffline
Copy link
Owner

Sounds good, you're welcome! If you're still having issues with /execute, feel free to get back to me here so I can look into it.

@fibberclip
Copy link
Author

I did more testing and /execute seems to work now! Idk why, i didn't change anything and it just suddenly started working... but oh well, if it works that's all i wanted lol. And yes the command only works for OPs, so i have it all up and running now :) thank u so much for the help!!

I did notice suffixes at least don't seem to show up on player's nametags (above their skin in-game), i don't mind this at all but maybe a toggle would be cool to have to switch between showing and not showing on nametags?

@eclipseisoffline
Copy link
Owner

Glad to hear /execute works now!

The reason custom names don't display above players is due to limitations on the Minecraft client. Trying to change the name shown above the player will cause issues with commands and other stuff, as can be seen in #2. I explained why this occurs there:

If you're interested in a technical explanation, [nicknames above player heads] are implemented by sending the nicknames of players as their literal player names to the client. This causes the client to show the nicknames above the player heads as if they were their literal names, but also causes the client to list these nicknames in the player suggestions in commands, since the client thinks these are the real player names [and causes other issues].

A workaround to this would be to hide player names, and instead send an armour stand sitting on the player to the client, with the custom name. However this is a bit finicky, hard to get right, and can cause issues with other mods and such, so I prefer not to do that.

Hopefully that should answer your question - custom names should display fine in the tab list, chat, death messages, etc.

eclipseisoffline added a commit that referenced this issue Oct 9, 2024
… change other people's names

Add configuration option operators_bypass_restrictions and ability to change other people's names (#4)
@eclipseisoffline
Copy link
Owner

This has been implemented in the release for 1.21.2-pre1, available right now on Modrinth. Once 1.21.2 releases I will backport to 1.21 and 1.21.1 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants