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
@NotFlow69
Copy link

Excuse me, but im new to github, so could you just link a direct download? sorry 😅

@arnokeesman
Copy link
Author

arnokeesman commented Mar 31, 2023

edit: OPL now has releases, downloads can be grabbed from there.

@karacries
Copy link

hi! thank you for the well written tutorial! for some reason when i adjust everything the prefixes aren't added in chat or the playerlist and i've done everything. i'm not sure if i'm doing something wrong

@Superxp666
Copy link

Doesn't seem to support Minecraft 1.18.2?

@arnokeesman
Copy link
Author

arnokeesman commented May 9, 2023 via email

@StevenG5
Copy link

Does not work on 1.19.2 either. Followed instructions to the letter, no luck.

@arnokeesman
Copy link
Author

@StevenG5 The guide has not yet been updated since 1.19, what exact problems are you running into?

@StevenG5
Copy link

Here are some screenshots @arnokeesman

What it looks like in chat: https://gyazo.com/233989bb01e8a0d2f1611b01e4a69534
What I typed in the config file: https://gyazo.com/c53dafe003c80c66e87174f87ef1d494

I think it's close, but something must've bugged out; I copied it verbatim.

@arnokeesman
Copy link
Author

The prefix literally showing usually means you don't have LuckPerms-Fabric-PlaceholderAPI-Hook installed.
If you do have it installed, try moving the prefix from the display_name to the chat line (2 lines below). Some other mod might be caching the username and messing with things.

@StevenG5
Copy link

That did the trick! Moving it to the chat line seemed to override whatever was causing this error to begin with. Thank you for your help!

@arnokeesman
Copy link
Author

A side effect of moving it to the chat line is that it won't automatically transfer over to the playerlist, you'll have to add the prefix there as well.

@YTpooshistic
Copy link

What should I change if the styledplayerlist config is version 2?

@arnokeesman
Copy link
Author

means you're probably still on 1.18, check the first version of this guide
also means you're gonna need an old version of the placeholder hook which doesn't have an official download anymore, you should be able to grab it here though

@YTpooshistic
Copy link

@arnokeesman I use 1.20.1

@arnokeesman
Copy link
Author

ah wait, yes, got some things mixed up, principles of all the relevant options are the same, they just moved around a bit and got renamed
changePlayerName -> player.modify_name
playerNameUpdateRate -> player.update_tick_time

@infinity-atom
Copy link

If you do have it installed, try moving the prefix from the display_name to the chat line (2 lines below). Some other mod might be caching the username and messing with things.

I tried this but still did not work. It just says <%luckperms:prefix%player> Hi in chat.
This is my code:

...
"displayName": "${default}",
"chat": "<%luckperms:prefix%${player}> ${message}",
...

@arnokeesman
Copy link
Author

arnokeesman commented Oct 13, 2023

Yeah your config looks good, it's probably some combination of mods not wanting to work together
Send your modlist in the styled-chat channel on Patbox' Discord (link can be found on the mod pages of the styled- mods) so we can look further into it tomorrow (maybe someone else knows whats up before I can take a look as well)

Edit: Solved! LP placeholder hook was missing

@GeekCornerGH
Copy link

Does anybody have such mods for forge?

@shvecia
Copy link

shvecia commented Jun 20, 2024

on 1.21 fabric luckperms and fabric placeholder crashes the server

@arnokeesman
Copy link
Author

saw a report on this in the discord a couple days back as well
guess the fabric placeholder hook needs an update to 1.21
appears Polymeta has already updated it, just needs to get merged and released LuckPerms placeholders #58

@shvecia
Copy link

shvecia commented Jun 20, 2024

thx for the answer!

@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