Check if player has balance before trying to add money to shop
This commit is contained in:
parent
777a240757
commit
176e997b9e
|
|
@ -4,6 +4,7 @@ import com.alttd.playershops.PlayerShops;
|
||||||
import com.alttd.playershops.conversation.ConversationManager;
|
import com.alttd.playershops.conversation.ConversationManager;
|
||||||
import com.alttd.playershops.conversation.ConversationType;
|
import com.alttd.playershops.conversation.ConversationType;
|
||||||
import com.alttd.playershops.shop.PlayerShop;
|
import com.alttd.playershops.shop.PlayerShop;
|
||||||
|
import com.alttd.playershops.utils.EconomyUtils;
|
||||||
import com.alttd.playershops.utils.ShopUtil;
|
import com.alttd.playershops.utils.ShopUtil;
|
||||||
import com.alttd.playershops.utils.Util;
|
import com.alttd.playershops.utils.Util;
|
||||||
import net.kyori.adventure.text.Component;
|
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)) {
|
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)) {
|
} 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)) {
|
} else if (slot == GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getSlot() && GuiIcon.MANAGE_SHOP_BALANCE_REMOVE.getItemStack().equals(item)) {
|
||||||
if (shop.getBalance() > 0) {
|
if (shop.getBalance() > 0) {
|
||||||
openChangePrompt(ConversationType.WITHDRAW_BALANCE);
|
openChangePrompt(ConversationType.WITHDRAW_BALANCE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user