Skip to content

Commit 7da4eef

Browse files
committed
Added deleteCurrency(Currency) method to CurrencyHolder
Introduced a default method to delete currencies using their object reference. Delegates internally to `deleteCurrency(String)` for streamlined logic and API flexibility.
1 parent 9dee09e commit 7da4eef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ default Currency createCurrency(Currency.Builder builder) {
104104
throw new UnsupportedOperationException("Not implemented yet");
105105
}
106106

107+
/**
108+
* Deletes the specified currency.
109+
*
110+
* @param currency the currency to delete
111+
* @return {@code true} if the currency was successfully deleted, otherwise {@code false}
112+
* @throws UnsupportedOperationException if {@link #hasMultiCurrencySupport()} is {@code false}
113+
*/
114+
default boolean deleteCurrency(Currency currency) {
115+
return deleteCurrency(currency.getName());
116+
}
117+
107118
/**
108119
* Deletes a currency with the specified name.
109120
*
@@ -128,6 +139,7 @@ default boolean deleteCurrency(String name) {
128139
*
129140
* @return {@code true} if multi-currency is supported, otherwise {@code false}
130141
* @implSpec If multiple currencies are supported, all respective methods have to be implemented.
142+
* @see #createCurrency(Currency.Builder)
131143
* @see #createCurrency(String, Consumer)
132144
* @see #deleteCurrency(String)
133145
* @see #getCurrencies()

0 commit comments

Comments
 (0)