Skip to content

Commit

Permalink
Update Version, Add Component for format methods, add deprecation.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Oct 6, 2024
1 parent f098820 commit 69b46bf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultUnlockedAPI</artifactId>
<version>2.5</version>
<version>2.6</version>


<name>VaultUnlockedAPI</name>
Expand Down Expand Up @@ -89,6 +89,12 @@
<version>24.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.17.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
32 changes: 29 additions & 3 deletions src/main/java/net/milkbowl/vault2/economy/Economy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package net.milkbowl.vault2.economy;

import net.kyori.adventure.text.Component;
import net.milkbowl.vault2.economy.EconomyResponse.ResponseType;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -84,26 +85,51 @@ public interface Economy {
* Plugins use this method to format a given BigDecimal amount into a human-readable
* amount using your economy plugin's currency names/conventions.
*
* @param pluginName The name of the plugin that is calling the method.
* @param amount to format.
*
* @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds.
* @deprecated Use {@link #format(String, BigDecimal)} instead.
*/
@NotNull
String format(final String pluginName, BigDecimal amount);
String format(BigDecimal amount);

/**
* Plugins use this method to format a given BigDecimal amount into a human-readable
* amount using your economy plugin's currency names/conventions.
*
* @param pluginName The name of the plugin that is calling the method.
* @param amount to format.
*
* @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds.
*/
@NotNull
Component format(final String pluginName, BigDecimal amount);

/**
* Plugins use this method to format a given BigDecimal amount into a human-readable
* amount using your economy plugin's currency names/conventions.
*
* @param amount to format.
* @param currency the currency to use for the format.
*
* @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds.
* @deprecated Use {@link #format(String, BigDecimal, String)} instead.
*/
@NotNull
String format(BigDecimal amount, final String currency);

/**
* Plugins use this method to format a given BigDecimal amount into a human-readable
* amount using your economy plugin's currency names/conventions.
*
* @param pluginName The name of the plugin that is calling the method.
* @param amount to format.
* @param currency the currency to use for the format.
*
* @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds.
*/
@NotNull
String format(final String pluginName, BigDecimal amount, final String currency);
Component format(final String pluginName, BigDecimal amount, final String currency);

/**
* Returns true if a currency with the specified name exists.
Expand Down

0 comments on commit 69b46bf

Please sign in to comment.