use of com.robomwm.prettysimpleshop.event.ShopBreakEvent in project PrettySimpleShop by MLG-Fortress.
the class ShopListener method onBreakShop.
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
private void onBreakShop(BlockBreakEvent event) {
Block block = event.getBlock();
if (!config.isShopBlock(block.getType()))
return;
Container container = (Container) block.getState();
if (!shopAPI.isShop(container))
return;
instance.getServer().getPluginManager().callEvent(new ShopBreakEvent(event.getPlayer(), new ShopInfo(shopAPI.getLocation(container), shopAPI.getItemStack(container), shopAPI.getPrice(container)), event));
double deposit = shopAPI.getRevenue(container, true);
if (deposit <= 0)
return;
Player player = event.getPlayer();
economy.depositPlayer(player, deposit);
config.sendMessage(player, "collectRevenue", economy.format(deposit));
}
Aggregations