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

add: add option to format the star text in the list #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

VilleKokkarinen
Copy link

added an option to format the text in the star list

with tags {world} {tier} {location}

so you can swap their places or have any custom formatting

@Jannyboy11
Copy link
Owner

Hi there, thank you for the pull request. The main repository for this plugin is actually located here: https://github.com/Jannyboy11/F2P-Star-Assist. Even though usually I am open to new features, I cannot really see what a configurable starinfo format accomplishes. The 'T' and 'W' are also still hardcoded, so it's not even truly configurable. In order for me to accept this PR, I would like the T and W to be user-configurable as well (so, part of the format string).

section = MISCELLANEOUS
)
default String callOutFormat() {
return "{world} {tier} {location}";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "W{world} T{tier} {location}" then, right?

final String text = "T" + star.getTier().getSize() + " W" + star.getWorld() + " " + star.getLocation();
final String text = this.config.callOutFormat

if(text.contains("{world}") && text.contains("{tier}") && text.contains("{location}")){ // if provided format is valid
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this codebase I use spaces before and after keywords, so this should be if ( at the beginning of the line, and at the end of the line ) {.

text.replace("{world}", star.getWorld());
text.replace("{tier}", "T"+star.getTier().getSize());
text.replace("{location}", star.getLocation());
}else{ // otherwise default
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces: } else {.

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

Successfully merging this pull request may close these issues.

2 participants