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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,19 @@ default boolean markDoubleHoppingTiles() {
return false;
}

@ConfigItem(
position = 15,
keyName = "call out format",
name = "call out format",
description = "Specify the format in which the callout is output.<br>" +
"{world} {tier} {location}:<br>" +
"eg. {world} {tier} {location} => \"W420 T5 Draynor <br>\""
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?

}

// \\
// ======================================================================================== \\

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,16 @@ private class StarAssistPanelRow extends JPanel {

setToolTipText(tooltipText.toString());

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 {.

text = "T" + star.getTier().getSize() + " W" + star.getWorld() + " " + star.getLocation();
}

final JLabel textLabel = new JLabel(text);
textLabel.setFont(FontManager.getRunescapeSmallFont());
add(textLabel);
Expand Down