Check if player has balance before trying to add money to shop

This commit is contained in:
Len 2022-08-28 19:46:34 +02:00
parent 777a240757
commit 176e997b9e

View File

@ -4,6 +4,7 @@ import com.alttd.playershops.PlayerShops;
import com.alttd.playershops.conversation.ConversationManager;
import com.alttd.playershops.conversation.ConversationType;
import com.alttd.playershops.shop.PlayerShop;
import com.alttd.playershops.utils.EconomyUtils;
import com.alttd.playershops.utils.ShopUtil;
import com.alttd.playershops.utils.Util;
import net.kyori.adventure.text.Component;
@ -65,7 +66,11 @@ public class ShopManagementGui extends AbstractGui {
if (slot == GuiIcon.MANAGE_SHOP.getSlot() && GuiIcon.MANAGE_SHOP.getItemStack().equals(item)) {
} else if (slot == GuiIcon.MANAGE_SHOP_BALANCE_ADD.getSlot() && GuiIcon.MANAGE_SHOP_BALANCE_ADD.getItemStack().equals(item)) {
openChangePrompt(ConversationType.ADD_BALANCE);
if (EconomyUtils.getFunds(getPlayer()) > 0) {
openChangePrompt(ConversationType.ADD_BALANCE);
} else {
getPlayer().sendMiniMessage("<red>You do not have money to add to this shop", null);
}
} else if (slot == GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getSlot() && GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getItemStack().equals(item)) {
if (shop.getBalance() > 0) {
openChangePrompt(ConversationType.WITHDRAW_BALANCE);