Added a few debug messages

This commit is contained in:
Eric 2016-08-05 12:46:41 +02:00
parent 76ea273ad6
commit e8ab8e33c3

View File

@ -68,6 +68,7 @@ public class ShopInteractListener implements Listener {
if (e.isCancelled() && !perm.has(p, "shopchest.create.protected")) { if (e.isCancelled() && !perm.has(p, "shopchest.create.protected")) {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_PROTECTED)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_CREATE_PROTECTED));
ClickType.removePlayerClickType(p); ClickType.removePlayerClickType(p);
plugin.debug(p.getName() + " is not allowed to create a shop on the selected chest");
return; return;
} }
@ -83,10 +84,12 @@ public class ShopInteractListener implements Listener {
create(p, b.getLocation(), product, buyPrice, sellPrice, shopType); create(p, b.getLocation(), product, buyPrice, sellPrice, shopType);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_BLOCKED)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_BLOCKED));
plugin.debug("Chest is blocked");
} }
} else { } else {
e.setCancelled(true); e.setCancelled(true);
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_ALREADY_SHOP));
plugin.debug("Chest is already a shop");
} }
ClickType.removePlayerClickType(p); ClickType.removePlayerClickType(p);
@ -118,6 +121,7 @@ public class ShopInteractListener implements Listener {
info(p, shop); info(p, shop);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NO_SHOP)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NO_SHOP));
plugin.debug("Chest is not a shop");
} }
ClickType.removePlayerClickType(p); ClickType.removePlayerClickType(p);
@ -133,10 +137,12 @@ public class ShopInteractListener implements Listener {
remove(p, shop); remove(p, shop);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_OTHERS)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_REMOVE_OTHERS));
plugin.debug(p.getName() + " is not permitted to remove another player's shop");
} }
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NO_SHOP)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.CHEST_NO_SHOP));
plugin.debug("Chest is not a shop");
} }
ClickType.removePlayerClickType(p); ClickType.removePlayerClickType(p);
@ -158,12 +164,14 @@ public class ShopInteractListener implements Listener {
e.setCancelled(false); e.setCancelled(false);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_OPEN_OTHERS)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_OPEN_OTHERS));
plugin.debug(p.getName() + " is not permitted to open another player's shop");
} }
} else { } else {
e.setCancelled(false); e.setCancelled(false);
} }
} else { } else {
if (shop.getShopType() == ShopType.ADMIN || !shop.getVendor().getUniqueId().equals(p.getUniqueId())) { if (shop.getShopType() == ShopType.ADMIN || !shop.getVendor().getUniqueId().equals(p.getUniqueId())) {
plugin.debug(p.getName() + " wants to buy");
if (shop.getBuyPrice() > 0) { if (shop.getBuyPrice() > 0) {
if (perm.has(p, "shopchest.buy")) { if (perm.has(p, "shopchest.buy")) {
if (shop.getShopType() == ShopType.ADMIN) { if (shop.getShopType() == ShopType.ADMIN) {
@ -174,13 +182,16 @@ 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));
plugin.debug("Shop is out of stock");
} }
} }
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_BUY)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_BUY));
plugin.debug(p.getName() + " is not permitted to buy");
} }
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUYING_DISABLED)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.BUYING_DISABLED));
plugin.debug("Buying is disabled");
} }
} else { } else {
e.setCancelled(false); e.setCancelled(false);
@ -198,18 +209,22 @@ public class ShopInteractListener implements Listener {
Shop shop = shopUtils.getShop(b.getLocation()); Shop shop = shopUtils.getShop(b.getLocation());
if ((shop.getShopType() == ShopType.ADMIN) || (!shop.getVendor().getUniqueId().equals(p.getUniqueId()))) { if ((shop.getShopType() == ShopType.ADMIN) || (!shop.getVendor().getUniqueId().equals(p.getUniqueId()))) {
plugin.debug(p.getName() + " wants to sell");
if (shop.getSellPrice() > 0) { if (shop.getSellPrice() > 0) {
if (perm.has(p, "shopchest.sell")) { if (perm.has(p, "shopchest.sell")) {
if (Utils.getAmount(p.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) { if (Utils.getAmount(p.getInventory(), shop.getProduct()) >= shop.getProduct().getAmount()) {
sell(p, shop); sell(p, shop);
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NOT_ENOUGH_ITEMS));
plugin.debug(p.getName() + " doesn't have enough items");
} }
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_SELL)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.NO_PERMISSION_SELL));
plugin.debug(p.getName() + " is not permitted to sell");
} }
} else { } else {
p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELLING_DISABLED)); p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SELLING_DISABLED));
plugin.debug("Selling is disabled");
} }
} else { } else {
e.setCancelled(false); e.setCancelled(false);