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

Cleaned up PAPI Expansion #4906

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

Cleaned up PAPI Expansion #4906

wants to merge 2 commits into from

Conversation

cj89898
Copy link

@cj89898 cj89898 commented Jun 20, 2023

Cleaned up PAPI Expansion, narrowing it down to only 1 class

Copy link
Member

@nossr50 nossr50 left a comment

Choose a reason for hiding this comment

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

Would you be up for changing it a bit further before I merge it?

if (user == null) return null;

if (params.startsWith("level_")) {
PrimarySkillType skill = PrimarySkillType.valueOf(params.substring(6).toUpperCase());
Copy link
Member

@nossr50 nossr50 Jun 20, 2023

Choose a reason for hiding this comment

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

you could make use of constants to avoid these hard coded magic numbers
public static final String SKILL_LEVEL = "level_";

// later on
PrimarySkillType skill = PrimarySkillType.valueOf(params.substring(SKILL_LEVEL.length()).toUpperCase());

Copy link
Author

Choose a reason for hiding this comment

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

Would you like this done for those only needing substring or all?
Eg. "in_party"

Copy link
Member

Choose a reason for hiding this comment

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

for all would make sense to me

if (params.startsWith("level_")) {
PrimarySkillType skill = PrimarySkillType.valueOf(params.substring(6).toUpperCase());
return skill == null ? null : user.getSkillLevel(skill)+"";
}else if (params.startsWith("xp_needed_")) {
Copy link
Member

Choose a reason for hiding this comment

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

would prefer space after }

return skill == null ? null : (user.getXpToLevel(skill) - user.getSkillXpLevel(skill))+"";
}else if (params.startsWith("xp_")) {
PrimarySkillType skill = PrimarySkillType.valueOf(params.substring(3).toUpperCase());
return skill == null ? null : user.getSkillXpLevel(skill)+"";
Copy link
Member

Choose a reason for hiding this comment

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

Would prefer String.valueOf() but this is perhaps a small nitpick

@cj89898
Copy link
Author

cj89898 commented Jun 21, 2023

Should be all tidied up 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

Successfully merging this pull request may close these issues.

None yet

2 participants