Skip to content

Commit

Permalink
reduce nested if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Jan 20, 2024
1 parent 738d5c5 commit 8d6fbfd
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,13 @@ object MiscFeatures {
return
}
}
} else if (bzAHTitleRegex.matches(chestName)) {
if (Skytils.config.claimOwnAHBZOnly) {
for (line in ItemUtil.getItemLore(item)) {
if (bzAHAuthorRegex.matches(line)) {
val matches = bzAHAuthorRegex.find(line) ?: return
if (matches.groups["username"]?.value ?: "" != mc.thePlayer.name) {
event.isCanceled = true
return
}
} else if (bzAHTitleRegex.matches(chestName) && Skytils.config.claimOwnAHBZOnly) {
for (line in ItemUtil.getItemLore(item)) {
if (bzAHAuthorRegex.matches(line)) {
val matches = bzAHAuthorRegex.find(line) ?: return
if (matches.groups["username"]?.value ?: "" != mc.thePlayer.name) {
event.isCanceled = true
return
}
}
}
Expand Down

0 comments on commit 8d6fbfd

Please sign in to comment.