Amount must be greater than 0

This commit is contained in:
Eric 2016-10-12 18:25:36 +02:00
parent 99a15fd8f6
commit 6009ad20c3
5 changed files with 11 additions and 0 deletions

View File

@ -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)) {

View File

@ -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.")));

View File

@ -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,

View File

@ -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.

View File

@ -118,6 +118,9 @@ message.error-occurred=&cAn error occurred: %ERROR%
# Set the message when the arguments <AMOUNT>, <BUY-PRICE> and/or <SELL-PRICE> 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 <AMOUNT> 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.