Finishes the scrapper implementation
Some checks failed
EpicKnarvik97/Blacksmith/pipeline/head There was a failure building this commit
Some checks failed
EpicKnarvik97/Blacksmith/pipeline/head There was a failure building this commit
This commit is contained in:
@ -48,7 +48,17 @@ public class EconomyManager {
|
||||
* @return <p>Whether the player cannot pay for the reforge</p>
|
||||
*/
|
||||
public static boolean cannotPayForHeldItemReforge(@NotNull Player player) {
|
||||
return !(economy.getBalance(player) - getHeldItemCost(player) >= 0);
|
||||
return economy.getBalance(player) - getHeldItemCost(player) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the given player cannot pay for salvaging an item
|
||||
*
|
||||
* @param player <p>The player holding an item</p>
|
||||
* @return <p>Whether the player cannot pay for the salvage</p>
|
||||
*/
|
||||
public static boolean cannotPayForSalvage(@NotNull Player player) {
|
||||
return economy.getBalance(player) - BlacksmithPlugin.getInstance().getGlobalScrapperSettings().getCost() < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,11 +67,23 @@ public class EconomyManager {
|
||||
* @param player <p>The player holding an item</p>
|
||||
* @return <p>The formatted cost</p>
|
||||
*/
|
||||
public static String formatCost(@NotNull Player player) {
|
||||
@NotNull
|
||||
public static String formatBlacksmithCost(@NotNull Player player) {
|
||||
double cost = getHeldItemCost(player);
|
||||
return economy.format(cost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the human-readable cost of salvaging an item
|
||||
*
|
||||
* @return <p>The formatted cost</p>
|
||||
*/
|
||||
@NotNull
|
||||
public static String formatScrapperCost() {
|
||||
double cost = BlacksmithPlugin.getInstance().getGlobalScrapperSettings().getCost();
|
||||
return economy.format(cost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Withdraws the reforging cost from the given player
|
||||
*
|
||||
@ -69,8 +91,23 @@ public class EconomyManager {
|
||||
*
|
||||
* @param player <p>The player to withdraw from</p>
|
||||
*/
|
||||
public static void withdraw(@NotNull Player player) {
|
||||
economy.withdrawPlayer(player, getHeldItemCost(player));
|
||||
public static void withdrawBlacksmith(@NotNull Player player) {
|
||||
double cost = getHeldItemCost(player);
|
||||
if (cost > 0) {
|
||||
economy.withdrawPlayer(player, cost);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Withdraws the salvaging cost from the given player
|
||||
*
|
||||
* @param player <p>The player to withdraw from</p>
|
||||
*/
|
||||
public static void withdrawScrapper(Player player) {
|
||||
double cost = BlacksmithPlugin.getInstance().getGlobalScrapperSettings().getCost();
|
||||
if (cost > 0) {
|
||||
economy.withdrawPlayer(player, cost);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user