Added way to disable vendor messages

(= Messages that a vendor gets after players buy or sell something from/to
his shop)

Closes #33
This commit is contained in:
Eric 2016-11-26 17:23:02 +01:00
parent 98c79f5e8a
commit 192b124eb5
3 changed files with 10 additions and 2 deletions

View File

@ -83,6 +83,9 @@ public class Config {
/** Whether Towny integration should be enabled **/ /** Whether Towny integration should be enabled **/
public boolean enable_towny_integration; public boolean enable_towny_integration;
/** Whether the vendor of the shop should get messages about buys and sells **/
public boolean enable_vendor_messages;
/** Whether admin shops should be excluded of the shop limits **/ /** Whether admin shops should be excluded of the shop limits **/
public boolean exclude_admin_shops; public boolean exclude_admin_shops;
@ -294,6 +297,7 @@ public class Config {
enable_debug_log = plugin.getConfig().getBoolean("enable-debug-log"); enable_debug_log = plugin.getConfig().getBoolean("enable-debug-log");
enable_worldguard_integration = plugin.getConfig().getBoolean("enable-worldguard-integration"); enable_worldguard_integration = plugin.getConfig().getBoolean("enable-worldguard-integration");
enable_towny_integration = plugin.getConfig().getBoolean("enable-towny-integration"); enable_towny_integration = plugin.getConfig().getBoolean("enable-towny-integration");
enable_vendor_messages = plugin.getConfig().getBoolean("enable-vendor-messages");
explosion_protection = plugin.getConfig().getBoolean("explosion-protection"); explosion_protection = plugin.getConfig().getBoolean("explosion-protection");
exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops"); exclude_admin_shops = plugin.getConfig().getBoolean("shop-limits.exclude-admin-shops");
append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name"); append_potion_level_to_item_name = plugin.getConfig().getBoolean("append-potion-level-to-item-name");

View File

@ -677,7 +677,7 @@ public class ShopInteractListener implements Listener {
plugin.debug(executor.getName() + " successfully bought (#" + shop.getID() + ")"); plugin.debug(executor.getName() + " successfully bought (#" + shop.getID() + ")");
if (shop.getVendor().isOnline()) { if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_BOUGHT, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(newAmount)), shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_BOUGHT, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(newAmount)),
new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, String.valueOf(newPrice)), new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, String.valueOf(newPrice)),
new LocalizedMessage.ReplacedRegex(Regex.PLAYER, executor.getName()))); new LocalizedMessage.ReplacedRegex(Regex.PLAYER, executor.getName())));
@ -810,7 +810,7 @@ public class ShopInteractListener implements Listener {
plugin.debug(executor.getName() + " successfully sold (#" + shop.getID() + ")"); plugin.debug(executor.getName() + " successfully sold (#" + shop.getID() + ")");
if (shop.getVendor().isOnline()) { if (shop.getVendor().isOnline() && config.enable_vendor_messages) {
shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_SOLD, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(newAmount)), shop.getVendor().getPlayer().sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SOMEONE_SOLD, new LocalizedMessage.ReplacedRegex(Regex.AMOUNT, String.valueOf(newAmount)),
new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, String.valueOf(newPrice)), new LocalizedMessage.ReplacedRegex(Regex.ITEM_NAME, LanguageUtils.getItemName(product)), new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, String.valueOf(newPrice)),
new LocalizedMessage.ReplacedRegex(Regex.PLAYER, executor.getName()))); new LocalizedMessage.ReplacedRegex(Regex.PLAYER, executor.getName())));

View File

@ -39,6 +39,10 @@ enable-worldguard-integration: true
# Of course, this only works if Towny is installed # Of course, this only works if Towny is installed
enable-towny-integration: true enable-towny-integration: true
# Set whether the vendor of a shop should get messages when players
# buy or sell something from/to his shop
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.
# The first line will be the buy price with the message "message.hologram.only-buy", # The first line will be the buy price with the message "message.hologram.only-buy",
# the second line will be the sell price with the message "message.hologram.only-sell". # the second line will be the sell price with the message "message.hologram.only-sell".