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

@@ -51,13 +51,11 @@ public class CleanBackupsTask extends CancellableRunnable {
if (isPast24Hours(date) && mcMMO.p.getGeneralConfig().getKeepLast24Hours()) {
// Keep all files from the last 24 hours
continue;
}
else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
} else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
// Keep daily backups of the past week
savedDays.add(dayOfWeek);
continue;
}
else {
} else {
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {

View File

@@ -64,8 +64,7 @@ public class McrankCommandDisplayTask extends CancellableRunnable {
public void displayBoard() {
if (sender.getName().equalsIgnoreCase(playerName)) {
ScoreboardManager.showPlayerRankScoreboard((Player) sender, skills);
}
else {
} else {
ScoreboardManager.showPlayerRankScoreboardOthers((Player) sender, playerName, skills);
}
}

View File

@@ -54,16 +54,13 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
if (skill == null) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
} else {
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")));
}
}
else {
} else {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
else {
} else {
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill))));
}
}
@@ -76,8 +73,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
// 12. Playername - skill value
if (sender instanceof Player) {
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
}
else {
} else {
sender.sendMessage(String.format("%2d. %s - %s", place, stat.name, stat.statVal));
}
@@ -88,8 +84,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
private void displayBoard() {
if (skill == null) {
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
}
else {
} else {
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats);
}
}

View File

@@ -11,10 +11,8 @@ public class NotifySquelchReminderTask extends CancellableRunnable {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (UserManager.getPlayer(player) != null)
{
if (!UserManager.getPlayer(player).useChatNotifications())
{
if (UserManager.getPlayer(player) != null) {
if (!UserManager.getPlayer(player).useChatNotifications()) {
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
}
}

View File

@@ -44,8 +44,7 @@ public class FormulaConversionTask extends CancellableRunnable {
editValues(profile);
// Since this is a temporary profile, we save it here.
profile.scheduleAsyncSave();
}
else {
} else {
profile = mcMMOPlayer.getProfile();
editValues(profile);
}

View File

@@ -60,8 +60,7 @@ public class TeleportationWarmup extends CancellableRunnable {
if (!Permissions.partyTeleportWorld(targetPlayer, targetWorld)) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(teleportingPlayer, targetWorld)) {
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(teleportingPlayer, targetWorld)) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}

View File

@@ -58,8 +58,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
}
// Print errors to console/logs if we're failing at least 2 times in a row to load the profile
if (attempt >= 3)
{
if (attempt >= 3) {
//Log the error
mcMMO.p.getLogger().severe(LocaleLoader.getString("Profile.Loading.FailureNotice",
player.getName(), String.valueOf(attempt)));

View File

@@ -9,8 +9,7 @@ public class BleedContainer {
public LivingEntity target;
public LivingEntity damageSource;
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, int toolTier, LivingEntity damageSource)
{
public BleedContainer(LivingEntity target, int bleedTicks, int bleedRank, int toolTier, LivingEntity damageSource) {
this.target = target;
this.bleedTicks = bleedTicks;
this.bleedRank = bleedRank;

View File

@@ -10,8 +10,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
public final PrimarySkillType primarySkillType;
public final ExperienceBarManager experienceBarManagerRef;
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType)
{
public ExperienceBarHideTask(ExperienceBarManager experienceBarManagerRef, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType) {
this.experienceBarManagerRef = experienceBarManagerRef;
this.mcMMOPlayer = mcMMOPlayer;
this.primarySkillType = primarySkillType;

View File

@@ -16,8 +16,7 @@ public class SkillUnlockNotificationTask extends CancellableRunnable {
* @param subSkillType the subskill that they just unlocked
* @param rank the rank of the subskill
*/
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank)
{
public SkillUnlockNotificationTask(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType, int rank) {
this.mcMMOPlayer = mcMMOPlayer;
this.subSkillType = subSkillType;
this.rank = rank;