Added notification for withdrawal of shop creation price

This commit is contained in:
Eric 2017-06-05 13:39:01 +02:00
parent de2046e6b5
commit 18d3e36390
5 changed files with 21 additions and 5 deletions

View File

@ -997,7 +997,8 @@ public class LanguageUtils {
generationNames.add(new BookGenerationName(CustomBookMeta.Generation.TATTERED, langConfig.getString("book.generation.3", "Tattered"))); generationNames.add(new BookGenerationName(CustomBookMeta.Generation.TATTERED, langConfig.getString("book.generation.3", "Tattered")));
// Add ShopChest Messages // Add ShopChest Messages
messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_CREATED, langConfig.getString("message.shop-created", "&6Shop created."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_CREATED, langConfig.getString("message.shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this shop."), Placeholder.CREATION_PRICE));
messages.add(new LocalizedMessage(LocalizedMessage.Message.ADMIN_SHOP_CREATED, langConfig.getString("message.admin-shop-created", "&6You were withdrawn &c%CREATION-PRICE% &6to create this admin shop."), Placeholder.CREATION_PRICE));
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP, langConfig.getString("message.chest-already-shop", "&cChest already shop."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP, langConfig.getString("message.chest-already-shop", "&cChest already shop.")));
messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_BLOCKED, langConfig.getString("message.chest-blocked", "&cThere must not be a block above the chest."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.CHEST_BLOCKED, langConfig.getString("message.chest-blocked", "&cThere must not be a block above the chest.")));
messages.add(new LocalizedMessage(LocalizedMessage.Message.DOUBLE_CHEST_BLOCKED, langConfig.getString("message.double-chest-blocked", "&cThere must not be a block above the chest."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.DOUBLE_CHEST_BLOCKED, langConfig.getString("message.double-chest-blocked", "&cThere must not be a block above the chest.")));

View File

@ -43,6 +43,7 @@ public class LocalizedMessage {
public enum Message { public enum Message {
SHOP_CREATED, SHOP_CREATED,
ADMIN_SHOP_CREATED,
CHEST_ALREADY_SHOP, CHEST_ALREADY_SHOP,
CHEST_BLOCKED, CHEST_BLOCKED,
DOUBLE_CHEST_BLOCKED, DOUBLE_CHEST_BLOCKED,

View File

@ -644,7 +644,8 @@ public class ShopInteractListener implements Listener {
EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice); EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice);
if (!r.transactionSuccess()) { if (!r.transactionSuccess()) {
plugin.debug("Economy transaction failed: " + r.errorMessage); plugin.debug("Economy transaction failed: " + r.errorMessage);
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r.errorMessage))); executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED,
new LocalizedMessage.ReplacedPlaceholder(Placeholder.ERROR, r.errorMessage)));
return; return;
} }
@ -653,7 +654,14 @@ public class ShopInteractListener implements Listener {
plugin.debug("Shop created"); plugin.debug("Shop created");
shopUtils.addShop(shop, true); shopUtils.addShop(shop, true);
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATED)); LocalizedMessage.ReplacedPlaceholder placeholder = new LocalizedMessage.ReplacedPlaceholder(
Placeholder.CREATION_PRICE, String.valueOf(creationPrice));
if (shopType == ShopType.ADMIN) {
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ADMIN_SHOP_CREATED, placeholder));
} else {
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATED, placeholder));
}
for (Player p : location.getWorld().getPlayers()) { for (Player p : location.getWorld().getPlayers()) {
if (p.getLocation().distanceSquared(location) <= Math.pow(config.maximal_distance, 2)) { if (p.getLocation().distanceSquared(location) <= Math.pow(config.maximal_distance, 2)) {

View File

@ -1,4 +1,5 @@
message.shop-created=&6Shop erstellt. message.shop-created=&6Dir wurden &c%CREATION-PRICE% abgenommen, um diesen Shop zu erstellen.
message.admin-shop-created=&6Dir wurden &c%CREATION-PRICE% abgenommen, um diesen Admin Shop zu erstellen.
message.chest-already-shop=&cTruhe ist bereits ein Shop. message.chest-already-shop=&cTruhe ist bereits ein Shop.
message.chest-blocked=&cÜber der Truhe ist kein Platz. message.chest-blocked=&cÜber der Truhe ist kein Platz.
message.double-chest-blocked=&cÜber der Truhe ist kein Platz. message.double-chest-blocked=&cÜber der Truhe ist kein Platz.

View File

@ -1,5 +1,10 @@
# Set the message when a shop is created at the clicked chest. # Set the message when a shop is created at the clicked chest.
message.shop-created=&6Shop created. # Usable Placeholders: %CREATION-PRICE%
message.shop-created=&6You were withdrawn &c%CREATION-PRICE% &6to create this shop.
# Set the message when an admin shop is created at the clicked chest.
# Usable Placeholders: %CREATION-PRICE%
message.admin-shop-created=&6You were withdrawn &c%CREATION-PRICE% &6to create this admin shop.
# Set the message when the clicked chest already is a shop. # Set the message when the clicked chest already is a shop.
message.chest-already-shop=&cChest already is shop. message.chest-already-shop=&cChest already is shop.