Added vendor information about a sold out shop

This commit is contained in:
Eric 2017-01-04 18:46:50 +01:00
parent f6f8d93b85
commit 4194c72bd4
6 changed files with 12 additions and 1 deletions

View File

@ -939,6 +939,7 @@ public class LanguageUtils {
messages.add(new LocalizedMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS, langConfig.getString("message.not-enough-items", "&cNot enough items."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS, langConfig.getString("message.not-enough-items", "&cNot enough items.")));
messages.add(new LocalizedMessage(LocalizedMessage.Message.VENDOR_NOT_ENOUGH_MONEY, langConfig.getString("message.vendor-not-enough-money", "&cVendor has not enough money."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.VENDOR_NOT_ENOUGH_MONEY, langConfig.getString("message.vendor-not-enough-money", "&cVendor has not enough money.")));
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.OUT_OF_STOCK, langConfig.getString("message.out-of-stock", "&cShop out of stock.")));
messages.add(new LocalizedMessage(LocalizedMessage.Message.VENDOR_OUT_OF_STOCK, langConfig.getString("message.vendor-out-of-stock", "&cYour shop that sells &6%AMOUNT% x %ITEMNAME% &cis out of stock."), Regex.AMOUNT, Regex.ITEM_NAME));
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.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_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.AMOUNT_IS_ZERO, langConfig.getString("message.amount-is-zero", "&cAmount must be greater than 0.")));

View File

@ -74,6 +74,7 @@ public class LocalizedMessage {
NOT_ENOUGH_ITEMS, NOT_ENOUGH_ITEMS,
VENDOR_NOT_ENOUGH_MONEY, VENDOR_NOT_ENOUGH_MONEY,
OUT_OF_STOCK, OUT_OF_STOCK,
VENDOR_OUT_OF_STOCK,
ERROR_OCCURRED, ERROR_OCCURRED,
AMOUNT_PRICE_NOT_NUMBER, AMOUNT_PRICE_NOT_NUMBER,
AMOUNT_IS_ZERO, AMOUNT_IS_ZERO,

View File

@ -284,6 +284,11 @@ public class ShopInteractListener implements Listener {
buy(p, shop); buy(p, shop);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OUT_OF_STOCK)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.OUT_OF_STOCK));
if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.VENDOR_OUT_OF_STOCK,
new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(shop.getProduct().getAmount())),
new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(shop.getProduct()))));
}
plugin.debug("Shop is out of stock"); plugin.debug("Shop is out of stock");
} }
} }

View File

@ -40,7 +40,7 @@ enable-worldguard-integration: true
enable-towny-integration: true enable-towny-integration: true
# Set whether the vendor of a shop should get messages when players # Set whether the vendor of a shop should get messages when players
# buy or sell something from/to his shop # buy or sell something from/to his shop or if his shop is out of stock
enable-vendor-messages: true enable-vendor-messages: true
# Set whether the buy- and sell price should be arranged below each other. # Set whether the buy- and sell price should be arranged below each other.

View File

@ -30,6 +30,7 @@ message.not-enough-money=&cNicht genug Geld.
message.not-enough-items=&cNicht genug Items. message.not-enough-items=&cNicht genug Items.
message.vendor-not-enough-money=&cVerkäufer hat nicht genug Geld. message.vendor-not-enough-money=&cVerkäufer hat nicht genug Geld.
message.out-of-stock=&cShop ausverkauft. message.out-of-stock=&cShop ausverkauft.
message.vendor-out-of-stock=&cDein Shop, der &6%AMOUNT% x %ITEMNAME% &cverkauft, ist ausverkauft.
message.error-occurred=&cEin Fehler ist aufgetreten: %ERROR% message.error-occurred=&cEin Fehler ist aufgetreten: %ERROR%
message.amount-and-price-not-number=&cAnzahl und Preise müssen Zahlen sein. 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.amount-is-zero=&cAnzahl muss größer als 0 sein.

View File

@ -111,6 +111,9 @@ message.vendor-not-enough-money=&cVendor has not enough money.
# Set the message when the shop is out of stock. # Set the message when the shop is out of stock.
message.out-of-stock=&cShop out of stock. message.out-of-stock=&cShop out of stock.
# Set the message the vendor gets when his shop is out of stock
message.vendor-out-of-stock=&cYour shop that sells &6%AMOUNT% x %ITEMNAME% &cis out of stock.
# Set the message when an error occurred. # Set the message when an error occurred.
# Usable regex: %ERROR% # Usable regex: %ERROR%
message.error-occurred=&cAn error occurred: %ERROR% message.error-occurred=&cAn error occurred: %ERROR%