clean up if/else formatting

This commit is contained in:
nossr50
2024-05-19 14:09:00 -07:00
parent 7266563ca9
commit d0ab2bdb2f
107 changed files with 526 additions and 1038 deletions

View File

@@ -54,8 +54,7 @@ public class AcrobaticsCommand extends SkillCommand {
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
if (abstractSubSkill != null)
{
if (abstractSubSkill != null) {
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])

View File

@@ -26,15 +26,12 @@ public class MmoInfoCommand implements TabExecutor {
/*
* Only allow players to use this command
*/
if (commandSender instanceof Player player)
{
if (commandSender instanceof Player player) {
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
return false;
if (Permissions.mmoinfo(player))
{
if (args[0].equalsIgnoreCase( "???"))
{
if (Permissions.mmoinfo(player)) {
if (args[0].equalsIgnoreCase( "???")) {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
@@ -57,8 +54,7 @@ public class MmoInfoCommand implements TabExecutor {
}
public SubSkillType matchSubSkill(String name) {
for(SubSkillType subSkillType : SubSkillType.values())
{
for(SubSkillType subSkillType : SubSkillType.values()) {
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|| subSkillType.name().equalsIgnoreCase(name))
return subSkillType;
@@ -74,8 +70,7 @@ public class MmoInfoCommand implements TabExecutor {
return ImmutableList.of();
}
private void displayInfo(Player player, SubSkillType subSkillType)
{
private void displayInfo(Player player, SubSkillType subSkillType) {
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillType.getLocaleName()));
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));

View File

@@ -88,8 +88,7 @@ public abstract class SkillCommand implements TabExecutor {
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
/*for(TextComponent tc : subskillTextComponents)
{
/*for(TextComponent tc : subskillTextComponents) {
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
}*/
@@ -149,8 +148,7 @@ public abstract class SkillCommand implements TabExecutor {
// send header
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
if (!SkillTools.isChildSkill(skill))
{
if (!SkillTools.isChildSkill(skill)) {
/*
* NON-CHILD SKILLS
*/
@@ -175,10 +173,8 @@ public abstract class SkillCommand implements TabExecutor {
StringBuilder parentMessage = new StringBuilder();
for(int i = 0; i < parentList.size(); i++)
{
if (i+1 < parentList.size())
{
for(int i = 0; i < parentList.size(); i++) {
if (i+1 < parentList.size()) {
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY).append(", ");
} else {
@@ -237,11 +233,9 @@ public abstract class SkillCommand implements TabExecutor {
int length;
if (abilityLengthCap <= 0)
{
if (abilityLengthCap <= 0) {
length = 2 + (int) (skillValue / abilityLengthVar);
}
else {
} else {
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
}
@@ -254,20 +248,17 @@ public abstract class SkillCommand implements TabExecutor {
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
}
protected String getStatMessage(SubSkillType subSkillType, String... vars)
{
protected String getStatMessage(SubSkillType subSkillType, String... vars) {
return getStatMessage(false, false, subSkillType, vars);
}
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
{
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if (isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else
{
else {
String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList);
}

View File

@@ -77,8 +77,7 @@ public class SkillGuideCommand implements CommandExecutor {
while (allStrings.size() < 9) {
if (pageIndexStart + allStrings.size() > guide.size()) {
allStrings.add("");
}
else {
} else {
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
}
}

View File

@@ -101,8 +101,7 @@ public class SwordsCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
}
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
{
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB)) {
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
}