Package com.kellerkindt.scs.shops

Examples of com.kellerkindt.scs.shops.Shop


   * Is called, if items should be added to a shop
   * @param sciae  ShowCaseItemAddEvent with needed information about the shop and player
   */
  @EventHandler (ignoreCancelled=true, priority=EventPriority.MONITOR)
  public void onShowCaseItemAddEvent (ShowCaseItemAddEvent sciae) {
    Shop      shop  = sciae.getShop();
    ExchangeShop  shopEx  = shop instanceof ExchangeShop ? ((ExchangeShop)shop) : null;
    int        amount  = sciae.getAmount();
   
    if (shop.getItemStack().isSimilar(sciae.getItemStack())) {
      // add the amount
      shop.setAmount(shop.getAmount() + amount);
     
      // set the message
      sciae.setMsgSuccessfully(Term.INVENTORY_UPDATE.get(""+amount, ""+shop.getAmount()));
   
    } else if (shopEx != null && shopEx.getExchangeItemStack().isSimilar(sciae.getItemStack())) {
   
      // add the amount
      shopEx.setExchangeAmount(shopEx.getExchangeAmount() + amount);
View Full Code Here


   * Is called, if a member should be added to a shop
   * @param scmae  ShowCaseMemberAddEvent with needed information about the shop and the member to add
   */
  @EventHandler (ignoreCancelled=true, priority=EventPriority.MONITOR)
  public void onShowCaseMemberAddEvent (ShowCaseMemberAddEvent scmae) {
    Shop  shop  = scmae.getShop();
    String  member  = scmae.getMember();
   
    shop.addMember(member);
  }
View Full Code Here

   * @param scce  ShowCaseCreateEvent with needed information about the shop and player
   */
  @EventHandler (ignoreCancelled=true, priority=EventPriority.MONITOR)
  public void onShowCaseCreateEvent (ShowCaseCreateEvent scce) {
    // get the shop to add
    Shop  shop  = scce.getShop();
    double  cost  = scs.getCreatePrice(shop.getClass());
   
    // add the shop
    scs.getShopHandler().addShop(scce.getShop());
    scs.getShopHandler().show  (scce.getShop());
   
View Full Code Here

   * @param scire  ShowCaseItemRemoveEvent with needed information about the shop and player
   */
  @EventHandler (ignoreCancelled=true, priority=EventPriority.MONITOR)
  public void onShowCaseItemRemoveEvent (ShowCaseItemRemoveEvent scire) {
   
    Shop      shop  = scire.getShop();
    ExchangeShop  shopEx  = shop instanceof ExchangeShop ? ((ExchangeShop)shop) : null;
    int        amount  = scire.getAmount();
   
    if (shop.getItemStack().isSimilar(scire.getItemStack())) {
     
      // add the amount
      shop.setAmount(shop.getAmount() - amount);
     
      // set the message
      scire.setMsgSuccessfully(Term.INVENTORY_UPDATE.get(""+amount, ""+shop.getAmount()));
   
    } else if (shopEx != null && shopEx.getExchangeItemStack().isSimilar(scire.getItemStack())) {
   
      // add the amount
      shopEx.setExchangeAmount(shopEx.getExchangeAmount() - amount);
View Full Code Here

   */
  @Override
  @EventHandler (ignoreCancelled=true, priority=EventPriority.MONITOR)
  public void onShowCasePlayerBuyEvent(ShowCasePlayerBuyEvent scpbe) {
   
    Shop  shop  = scpbe.getShop();
   
    int   added = ItemStackUtilities.addToInventory(scpbe.getPlayer().getInventory(), shop.getItemStack(), scpbe.getQuantity());
    double  price = added * shop.getPrice();
   
    scs.getBalanceHandler().sub(scpbe.getPlayer(), price);
    scs.getBalanceHandler().add(shop.getOwner(),   price);
   
    // ignore unlimited - later you can see how many were sold ^^
    shop.setAmount(shop.getAmount() - added);

    // set successfully message
    scpbe.setMsgSuccessfully(Term.MESSAGE_SELL_COSTUMER.get(MaterialNames.getItemName(shop.getItemStack()), ""+added, ""+price));
  }
View Full Code Here

TOP

Related Classes of com.kellerkindt.scs.shops.Shop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.