diff --git a/src/main/java/de/epiceric/shopchest/ShopCommand.java b/src/main/java/de/epiceric/shopchest/ShopCommand.java index e4e4fa5..1112af9 100644 --- a/src/main/java/de/epiceric/shopchest/ShopCommand.java +++ b/src/main/java/de/epiceric/shopchest/ShopCommand.java @@ -264,6 +264,11 @@ class ShopCommand extends BukkitCommand { return; } + if (amount <= 0) { + p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.AMOUNT_IS_ZERO)); + return; + } + plugin.debug(p.getName() + " has entered numbers as prices and amount"); if (!plugin.getShopChestConfig().allow_decimals_in_price && (buyPrice != (int) buyPrice || sellPrice != (int) sellPrice)) { diff --git a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java index bb0ce74..6d0b4d2 100644 --- a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java +++ b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java @@ -879,6 +879,7 @@ public class LanguageUtils { messages.add(new LocalizedMessage(LocalizedMessage.Message.OUT_OF_STOCK, langConfig.getString("message.out-of-stock", "&cShop out of stock."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.ERROR_OCCURRED, langConfig.getString("message.error-occurred", "&cAn error occurred: %ERROR%"), Regex.ERROR)); messages.add(new LocalizedMessage(LocalizedMessage.Message.AMOUNT_PRICE_NOT_NUMBER, langConfig.getString("message.amount-and-price-not-number", "&cAmount and price must be a number."))); + messages.add(new LocalizedMessage(LocalizedMessage.Message.AMOUNT_IS_ZERO, langConfig.getString("message.amount-is-zero", "&cAmount must be greater than 0."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.PRICES_CONTAIN_DECIMALS, langConfig.getString("message.prices-contain-decimals", "&cPrices must not contain decimals."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.NO_ITEM_IN_HAND, langConfig.getString("message.no-item-in-hand", "&cNo item in hand"))); messages.add(new LocalizedMessage(LocalizedMessage.Message.CLICK_CHEST_CREATE, langConfig.getString("message.click-chest-to-create-shop", "&aClick a chest to create a shop."))); diff --git a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java index c14f0c9..ae01c76 100644 --- a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java +++ b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java @@ -76,6 +76,7 @@ public class LocalizedMessage { OUT_OF_STOCK, ERROR_OCCURRED, AMOUNT_PRICE_NOT_NUMBER, + AMOUNT_IS_ZERO, PRICES_CONTAIN_DECIMALS, NO_ITEM_IN_HAND, CLICK_CHEST_CREATE, diff --git a/src/main/resources/lang/de_DE.lang b/src/main/resources/lang/de_DE.lang index bfb14d2..ca6c0d7 100644 --- a/src/main/resources/lang/de_DE.lang +++ b/src/main/resources/lang/de_DE.lang @@ -32,6 +32,7 @@ message.vendor-not-enough-money=&cVerkäufer hat nicht genug Geld. message.out-of-stock=&cShop ausverkauft. message.error-occurred=&cEin Fehler ist aufgetreten: %ERROR% message.amount-and-price-not-number=&cAnzahl und Preise müssen Zahlen sein. +message.amount-is-zero=&cAnzahl muss größer als 0 sein. message.prices-contain-decimals=&cPreise dürfen keine Dezimalen enthalten. message.no-item-in-hand=&cKein Item in der Hand. message.click-chest-to-create-shop=&aKlicke auf eine Truhe, um einen Shop zu erstellen. diff --git a/src/main/resources/lang/en_US.lang b/src/main/resources/lang/en_US.lang index 3aef3d0..e7d04b2 100644 --- a/src/main/resources/lang/en_US.lang +++ b/src/main/resources/lang/en_US.lang @@ -118,6 +118,9 @@ message.error-occurred=&cAn error occurred: %ERROR% # Set the message when the arguments , and/or of '/shop create' are not a number. message.amount-and-price-not-number=&cAmount and prices must be numbers. +# Set the message when the argument is zero +message.amount-is-zero=&cAmount must be greater than 0. + # Set the message when the config value "allow-decimals-in-prices" is set to false # and a player enters a price with decimals message.prices-contain-decimals=&cPrices must not contain decimals.