mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-23 18:45:34 +01:00
Merge branch 'development'
This commit is contained in:
commit
c3014b55b1
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class SongodaCore {
|
||||
* This has been added as of Rev 6 <br>
|
||||
* This value is automatically filled in by gitlab-ci
|
||||
*/
|
||||
private final static String coreVersion = "2.4.5";
|
||||
private final static String coreVersion = "2.4.6";
|
||||
|
||||
/**
|
||||
* This is specific to the website api
|
||||
|
@ -3,11 +3,15 @@ package com.songoda.core.hooks;
|
||||
import com.songoda.core.hooks.economies.Economy;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* A convenience class for static access to an Economy HookManager
|
||||
*/
|
||||
public class EconomyManager {
|
||||
|
||||
private static String currencySymbol = "$";
|
||||
|
||||
private static final HookManager<Economy> manager = new HookManager(Economy.class);
|
||||
|
||||
/**
|
||||
@ -58,8 +62,9 @@ public class EconomyManager {
|
||||
* @param amt amount to display
|
||||
* @return a currency string as formatted by the economy plugin
|
||||
*/
|
||||
public static String formatEconomy(double amt) {
|
||||
return manager.isEnabled() ? manager.getCurrentHook().formatEconomy(amt) : String.valueOf(amt);
|
||||
public String formatEconomy(double amt) {
|
||||
DecimalFormat formatter = new DecimalFormat(amt == Math.ceil(amt) ? "#,###" : "#,###.00");
|
||||
return currencySymbol + formatter.format(amt);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,4 +115,13 @@ public class EconomyManager {
|
||||
public static boolean deposit(OfflinePlayer player, double amount) {
|
||||
return manager.isEnabled() && manager.getCurrentHook().deposit(player, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the curency symbl used in the #formatEconomy method.
|
||||
*
|
||||
* @param currencySymbol the new symbol
|
||||
*/
|
||||
public static void setCurrencySymbol(String currencySymbol) {
|
||||
EconomyManager.currencySymbol = currencySymbol;
|
||||
}
|
||||
}
|
||||
|
@ -41,15 +41,4 @@ public abstract class Economy implements Hook {
|
||||
* @return true if the total amount was added successfully
|
||||
*/
|
||||
public abstract boolean deposit(OfflinePlayer player, double amount);
|
||||
|
||||
/**
|
||||
* Format the given amount to a human-readable string in this currency
|
||||
*
|
||||
* @param amt amount to display
|
||||
* @return a currency string as formatted by the economy plugin
|
||||
*/
|
||||
public String formatEconomy(double amt) {
|
||||
DecimalFormat formatter = new DecimalFormat(amt == Math.ceil(amt) ? "#,###" : "#,###.00");
|
||||
return "$" + formatter.format(amt);
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,6 @@ public class ReserveEconomy extends Economy {
|
||||
return "Reserve";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatEconomy(double amt) {
|
||||
return economyAPI.format(BigDecimal.valueOf(amt));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(OfflinePlayer player) {
|
||||
return economyAPI.getBankHoldings(player.getUniqueId()).doubleValue();
|
||||
|
@ -29,11 +29,6 @@ public class VaultEconomy extends Economy {
|
||||
return "Vault";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatEconomy(double amt) {
|
||||
return vault != null ? vault.format(amt) : super.formatEconomy(amt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(OfflinePlayer player) {
|
||||
if (vault == null)
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore-Modules</artifactId>
|
||||
<version>2.4.5</version>
|
||||
<version>2.4.6</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user