From 20737004abbd8aedc749dd221b465511099151f4 Mon Sep 17 00:00:00 2001
From: Ghost_chu <2908803755@qq.com>
Date: Fri, 30 Nov 2018 18:33:00 +0800
Subject: [PATCH] Fix unlimited shop
Former-commit-id: 52ff55c030d5398c2b28c06dc90e4ad447777012 [formerly f3af8b15d0c7d690d69287a40199dc87a3728729]
Former-commit-id: 3390084be8bef8701478e1629b5d6051c2f45ad3
---
pom.xml | 2 +-
.../org/maxgamer/quickshop/Shop/ShopManager.java | 14 +++++---------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/pom.xml b/pom.xml
index 75affe7e2..dfd610c0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
org.maxgamer
QuickShop
- Reremake 1.3.1.7
+ Reremake 1.3.1.8
diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java
index e9105e5bd..37a742a3e 100644
--- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java
+++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java
@@ -371,6 +371,8 @@ public class ShopManager {
@SuppressWarnings("deprecation")
private void actionBuy(Player p, HashMap actions2, Info info, String message, Shop shop, int amount) {
int space = shop.getRemainingSpace();
+ if(space == -1)
+ space=10000;
if (space < amount) {
p.sendMessage(MsgUtil.getMessage("shop-has-no-space", "" + space, shop.getDataName()));
return;
@@ -434,15 +436,7 @@ public class ShopManager {
shop.setSignText(); // Update the signs count
}
@SuppressWarnings("deprecation")
- private void actionSell(Player p, HashMap actions2, Info info, String message, Shop shop2, int amount2) {
- int amount = 0;
- try {
- amount = Integer.parseInt(message);
- } catch (NumberFormatException e) {
- p.sendMessage(MsgUtil.getMessage("shop-purchase-cancelled"));
- return;
- }
- // Get the shop they interacted with
+ private void actionSell(Player p, HashMap actions2, Info info, String message, Shop shop2, int amount) {
Shop shop = plugin.getShopManager().getShop(info.getLocation());
// It's not valid anymore
if (shop == null || Util.canBeShop(info.getLocation().getBlock()) == false) {
@@ -454,6 +448,8 @@ public class ShopManager {
return;
}
int stock = shop.getRemainingStock();
+ if(stock==-1)
+ stock=10000;
if (stock < amount) {
p.sendMessage(MsgUtil.getMessage("shop-stock-too-low", "" + shop.getRemainingStock(), shop.getDataName()));
return;