-
-
Notifications
You must be signed in to change notification settings - Fork 869
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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());
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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_")) { |
There was a problem hiding this comment.
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)+""; |
There was a problem hiding this comment.
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
Should be all tidied up now |
Cleaned up PAPI Expansion, narrowing it down to only 1 class