Skip to content

Commit 9dee09e

Browse files
committed
Added exception to editCurrency method in Currency
Declared `throws IllegalArgumentException` for `editCurrency` to handle duplicate currency names explicitly. This improves API safety and clarity for consumers.
1 parent 3982838 commit 9dee09e

File tree

1 file changed

+2
-1
lines changed
  • src/main/java/net/thenextlvl/service/api/economy/currency

1 file changed

+2
-1
lines changed

src/main/java/net/thenextlvl/service/api/economy/currency/Currency.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ default Component format(Number amount, Audience audience) {
111111
*
112112
* @param consumer a {@code Consumer} that accepts a {@code Builder} instance to define customizations for the currency
113113
* @return {@code true} if the edit succeeded, otherwise {@code false}
114+
* @throws IllegalArgumentException if a currency with the same name already exists
114115
*/
115-
boolean editCurrency(Consumer<Builder> consumer);
116+
boolean editCurrency(Consumer<Builder> consumer) throws IllegalArgumentException;
116117

117118
/**
118119
* A builder interface for constructing instances of {@link Currency}.

0 commit comments

Comments
 (0)