Skip to content

Commit 19ac4e8

Browse files
committed
use default category as fallback
1 parent 9a13d0a commit 19ac4e8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/api/main/java/com/ampznetwork/banmod/api/entity/Infraction.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import lombok.experimental.FieldDefaults;
1717
import lombok.experimental.SuperBuilder;
1818
import org.comroid.api.Polyfill;
19-
import org.comroid.api.func.util.Command;
2019
import org.jetbrains.annotations.NotNull;
2120
import org.jetbrains.annotations.Nullable;
2221

@@ -91,7 +90,7 @@ static Factory parse(BanMod mod, String expression) {
9190
var category = mod.getEntityAccessor(PunishmentCategory.TYPE)
9291
.by(PunishmentCategory::getName)
9392
.get(split[0])
94-
.orElseThrow(() -> new Command.Error("Could not find punishment category " + split[0]));
93+
.orElseGet(mod::getDefaultCategory);
9594
var duration = Polyfill.parseDuration(split[1]);
9695
return new SimpleExpressionFactory(mod, category, duration);
9796
}

0 commit comments

Comments
 (0)