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

Flagname with colors #28

Open
Lauwy222 opened this issue Jun 13, 2024 · 1 comment
Open

Flagname with colors #28

Lauwy222 opened this issue Jun 13, 2024 · 1 comment

Comments

@Lauwy222
Copy link

Hey,

I'm currently using protectionstones and bluemap. I am using this flag in the BlueBridgeWG:
${flag:ps-name} But it will also show the color/markup.
image
What can I do to remove these?

@Mark-225
Copy link
Owner

Currently nothing except maybe if Protectionstones has a different flag for the raw flag without formatting.
Since those are legacy color codes with a non standard symbol ('&' instead of '§') I don't think I'll specifically add support for this.
However, if I do ever continue actively working on this plugin, I was planning on adding support for recursive replacements and some utility functions like regex replacements in placeholder values etc. So you might be able to work your way around this in the future and I'll definitely keep this issue in mind when I implement something like that, to make sure situations like this one can be resolved using those features.

For now, if you really need this to work and know your way around Java a bit, you could change the final return statement in line 195 in RegionStringLookup.java to something like this:

//Add this to the existing imports at the top of the file
import org.bukkit.ChatColor;

//[...]

//Replace line 195 with the following:
String flagValueString = flagValue.toString();
if("ps-name".equals(flagName)){
    //Uses Bukkit API to translate from & to § codes and then removes all formatting
    flagValueString = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', flagValueString));
}
return BlueBridgeUtils.escapeHtml(flagValueString);

Just clone this repo, change the code in that file and recompile using ./gradlew build in the repo's root directory.
That would be a pretty simple fix for your case but as it's very hardcoded and specific, I can't release this as a new version right now.

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

No branches or pull requests

2 participants