Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arnokeesman/84411929a02f00b847d1b2cca30ebe18 to your computer and use it in GitHub Desktop.
Save arnokeesman/84411929a02f00b847d1b2cca30ebe18 to your computer and use it in GitHub Desktop.
How to use LuckPerms prefixes on a fabricmc server

A guide on setting up LuckPerms prefixes on a Minecraft Fabric server

This tutorial assumes you have a fabricmc server with fabric-api installed.
Coming over from bukkit, spigot or paper? Make sure to replace all legacy formatting (those done with &) with tags from Simplified Text Format!

Installing the mods

Download Styled Chat, Styled Player List Then get LuckPerms https://luckperms.net/download Download LuckPerms for Fabric

And get Fabric PlaceHolderAPI from the bottom of that same page Download Fabric PlaceHolderAPI

Now put all these files in your mods folder and restart the server.

Configuring the mods

Styled Chat

In your Styled Chat config (/config/styled-chat.json) add the Placeholder for the prefix(%luckperms:prefix%): On line 17 (as of writing this) change "displayName": "${default}", to "displayName": "%luckperms:prefix%${default}", as shown below Adding prefix placeholder Reload Styled Chat by running /styledchat reload

Styled Player List

In your Styled Player List config (/config/styledplayerlist/config.json) change some values to update the names. Set changePlayerName to true and playerNameUpdateRate to 20 as shown below Styled Player List config Reload Styled Chat by running /styledplayerlist reload

Setting up LuckPerms and prefixes

  1. in the console create a group to manage luckperms lp creategroup luckperms
  2. give the group luckperms rights (I will give it all) lp g luckperms permission set luckperms.*
  3. add yourself to the group lp u yourUsername parent add luckperms (this can only work if you have joined before, after doing this you can continue in-game)
  4. create a group with /lp creategroup <name> example: /lp creategroup owner
  5. give the group a prefix /lp g owner meta setprefix "<blue>Owner"
  6. give yourself the group /lp u yourUsername parent add owner

Note: for styling of prefixes use Simplified Text Format, formatting with & will not work.

Result

in-game screenshot

Putting something between the prefix and the username

As you might have noticed in the results, there is nothing between the prefix and the username. You can fix this in your LuckPerms config. Open the LuckPerms config (/config/luckperms/luckperms.conf) and search(ctrl+f) for meta-formatting, in the prefix section of this set end-spacer to " " to add a space between the prefix and your username. LuckPerms config Restart your server for this change to take effect.

Result

in-game screenshot

Common problems

  • Problem: The prefixes shows up but colors don't work
    Solution: Replace all legacy formatting (done with &) with tags from Simplified Text Format
  • Problem: Prefixes do not work/show up
    Possible solution: If you are using a FTB library build between 188 and 204, downgrade to 188 or upgrade to anything newer than or 204
@DymondZ
Copy link

DymondZ commented Jul 12, 2024

Hi,
I'm running a custom modpack server based on Better MC [FABRIC] - BMC1 (1.19.2), updated fabric to latest, added/removed some mods and updated most of the packs mods to latest.

I followed this tutorial step by step a few months ago and everything worked perfectly fine. Means the prefix showed in player list and chat.

After I added/updated some mods the playerlist would get overwitten by another mod. Turned out to be carpets "/log" feature. I disabled it and this made the Styled Player List show again.

Now I'm not able to get the prefix to show up again (both in the player list and in chat).
When I looked through the config files I saw that both styled* mods config files were in its original state (which is odd, I had it working a few months ago, so I must have edited them before), but even after doing every step in the tutorial again, reloading, restarting the minecraft server, no prefix to be seen

Luckperms config on the other hand did actually persist and I also checked /lp user *** info here is the output:
image

you can see the prefix is Präfix: "<dark_red>[Admin]: " in german

This is what it looks like ingame:
image

I made changes to /config/styledplayerlist/styles/default.json and those are actually showing after reloading

I suspect a conflict with another mod and while I'm writing this I removed the "Chat Heads" mod from the client which didnt help.

Here is the list of mods on the server, I know those are a bunch but I might as well send it along for completeness:
https://pastebin.com/jw8V35ZB

Sorry for the essaying, I'm not mad at anyone but myself, should have dealt with it immediately after noticing it and not make another bagillion changes to the mod list (primarily updates)
I tried to word everything as clear as possible (I hope I did not forget anything).

Thanks in advance!

@arnokeesman
Copy link
Author

appreciate the information, narrows down the advice a lot

  • check if the prefix placeholder is still in the config file after reloading it (mostly been a thing since 20.4 though, the mod changed some things from snake to camel case, so guess you specifically are fine here, but doesn't hurt to check)
  • only mod in the provided list that really rings a bell is FTB Teams, they do some stuff with displaynames as well, you can get around this by moving the prefix placeholder from the displayname to chat styling directly (you'll have to add it in SPL as well when taking this route)

@DymondZ
Copy link

DymondZ commented Jul 12, 2024

Thanks a lot for the fast anwser!

  • check if the prefix placeholder is still in the config file after reloading it (mostly been a thing since 20.4 though, the mod changed some things from snake to camel case, so guess you specifically are fine here, but doesn't hurt to check)

This seems to be the problem: after reloading styled chat, styled-chat.json gets reset (the placeholder is not there anymore). However SPL config.json stays the same even after reloading it, so from that logic at least SPL should work (?).

  • only mod in the provided list that really rings a bell is FTB Teams, they do some stuff with displaynames as well, you can get around this by moving the prefix placeholder from the displayname to chat styling directly (you'll have to add it in SPL as well when taking this route)

After discovering the first issue I did not go this route yet

@arnokeesman
Copy link
Author

Guess there's enough of a difference between 19.2 and 20.1 (what the guide is currently on) as well
Try copying only the prefix placeholder over, nothing around it and make sure it's between the ""
Might also be worth checking if the config is properly saved to disk before reloading (how to do this depends on the setup ofc, but it'll be along the lines of closing the file and reopening it)

@DymondZ
Copy link

DymondZ commented Jul 12, 2024

Try copying only the prefix placeholder over, nothing around it and make sure it's between the ""

That fixed it! Many many thanks, I feel a bit dumb now but whatever, its working now!

Here are the differences:

Guide:
"displayName": "%luckperms:prefix%${default}",
My config:
"display_name": "%luckperms:prefix%${default}"

@RustyBl0ck
Copy link

Hii! Using this guide currently, and its been of great aid! Thanks for writing this guide arnokeesman. Just got one slight issue (probably user error):

I'd like to order the TABLIST names by rank not alphabetically. E.G.

[Owner]
[Founder]
[Admin]
...

and its currently saying:

[Admin]
[Founder]
[Owner]
.

How can I fix this? Thanks!

@arnokeesman
Copy link
Author

yeah the tablist will be sorted by playernames
as long as you're not using vanilla teams you can use OrderedPlayerList to sort it by group weight and a bunch of other stuff

@RustyBl0ck
Copy link

Hii! Thank you for replying! IDK if I'm supposed to use both the StyledPlayerList and OrderedPlayerList mods at the same time, but with the OrderedPlayerList mod installed, the server starts up fine including when I join, but as soon as another player joins, it crashes. Heres the image:
IMG_0702
Thank you in advance for helping as well as for replying so swiftly! As a sidenote, I may be using the config wrong, so just in case I will attach my config file:

{ "updateRate": 5, "order": [ { "key": "weight", "reversed": true, "mode": "integer", "type": "metadata" }, { "placeholder": "player:name", "reversed": false, "mode": "string", "type": "placeholder" } ] }

@RustyBl0ck
Copy link

RustyBl0ck commented Jul 30, 2024

Also, sorry for not putting the crash log. I forgot! Here it is:

https://stef.ltd/crash.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment