Package com.kellerkindt.scs.shops

Examples of com.kellerkindt.scs.shops.Shop


    }
  }
 
  @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
  public void onShopDeleteEvent (ShowCaseDeleteEvent scde) {
    Shop    shop    = scde.getShop();
    Inventory   inventory   = inventories.get(shop);
   
    if (inventory != null) {
      closeInventoryForShop(shop);
      updateShop(inventory, scde.getPlayer(), shop);
View Full Code Here


    }
  }
 
  @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
  public void onShopRemoveEvent (ShowCaseRemoveEvent scre) {
    Shop    shop    = scre.getShop();
    Inventory   inventory   = inventories.get(shop);
   
    if (inventory != null) {
      closeInventoryForShop(shop);
      updateShop(inventory, scre.getPlayer(), shop);
View Full Code Here

    }
  }
 
  @EventHandler(ignoreCancelled=true// TODO
  public void onShopInteraction (final ShowCaseInteractEvent scie) {
    Shop shop  = scie.getShop();
   
    // also for display showcases?
    if (shop instanceof DisplayShop && !Properties.DISPLAY_USE_STORAGE) {
      return;
    }
   
    // open the inventory only if there are no todos
    if (scie.getTodo() != null) {
      return;
    }
   
    // no inventory for DisplayShops
    if (shop instanceof DisplayShop) {
      return;
    }
   
    // show the inventory to the owner and members
    if (shop.isOwnerOrMember(scie.getPlayer().getName())) {
      // get the inventory
      Inventory inventory = getOrCreateInventory(shop);
     
      if (inventory.getViewers().size() == 0) {
        // update the inventory
View Full Code Here

 
  @EventHandler(ignoreCancelled=true)
  public void onInventoryClose (InventoryCloseEvent event) {
   
    Inventory  inventory  = event.getInventory();
    Shop    shop    = null;
   
   
   
    if (inventory.getHolder() instanceof ShopHolder) {
     
View Full Code Here

      try {
        YamlConfiguration conf = new YamlConfiguration();
        conf.load(file);
       
        // deserialize
        Shop shop = (Shop)conf.get(PATH);
       
        // reset has changed
        shop.resetHasChanged();
       
        // add it
        shops.add(shop);
       
      } catch (Exception e) {
View Full Code Here

                            data = line[line.length - 1];
                    } else {
                            continue;
                    }
                    Location loc = new Location(world, x, y, z);
                    Shop p = argumentsToShop(loc, type, matdata, player, showtype, data);
                    if(p != null)
                        shops.add(p);
                }
               
                r.close();
View Full Code Here

        ItemStack is;
        double price = 1.0;
       

        String[] args = data.split(";");
        Shop shop  = null;

        if(loc == null) {
            ShowCaseStandalone.slog(Level.INFO, "Showcase import: location is null, " + getClass().getName());
            return null;
        }
       

        if(owner.equals("")){
            ShowCaseStandalone.slog(Level.INFO, "Could not owner for shop, " + getClass().getName());
            return null;
        }
       

        try {
            is   = Utilities.getItemStackFromString(mat + ":" + matdata);
        } catch (IOException ioe) {
            ShowCaseStandalone.slog(Level.INFO, "Could not load materials for shop");
            ioe.printStackTrace();
            return null;
        }
       
       
        //Based on shop type, I'm going to set basic parameters, then try to
        //parse the data into those parameters.  If anything fails, I'll go
        //with the default parameters.
       
        price = 1.0;
        if (type.equalsIgnoreCase("infinite")) {
            //data = String.valueOf(price)
            //Try to parse, but ignore if I can't.
            if(data != "")
                try {
                    price = Double.parseDouble(data);
                } catch (NumberFormatException nfe) {}
           
            // new shop
            shop = new SellShop(UUID.randomUUID(), owner, loc, is);
            shop.setUnlimited(true);
           
           
        } else if (type.equalsIgnoreCase("finite")) {
            //data = itemAmount + ";" + pricePerItem; FINITE
            if(args.length > 1)
                try {
                    amount = Integer.parseInt(args[0]);
                    price = Double.parseDouble(args[1]);
                } catch (Exception e) {}
           
            // new shop
            shop = new SellShop(UUID.randomUUID(), owner, loc, is);
           
        } else if (type.equalsIgnoreCase("exchange")) {
            amount = 0;
            //data =  Exchange-type;Exchange-data;buy-amount;exchange-amount;exchange-rate-left;exchange-rate-right
            if(args.length >= 3)
                try {
                    maxAmount = Integer.parseInt(args[2]);
                } catch (Exception e) {}
           
            // new shop
            shop = new BuyShop(UUID.randomUUID(), owner, loc, is);
            ((BuyShop)shop).setMaxAmount(maxAmount);
           
        } else if (type.equalsIgnoreCase("basic") || type.equalsIgnoreCase("tutorial")) {
            amount = 0;
            price = 0.0;
            //No need to parse the data.
           
            // new shop
            shop = new DisplayShop(UUID.randomUUID(), owner, loc, is);
           
        } else {
            ShowCaseStandalone.slog(Level.INFO, "Could not get activity for shop, " + getClass().getName());
            return null;
        }


        // add the rest of the data
      shop.setAmount    (amount      );
      shop.setItemStack  (is        );
      shop.setPrice    (price      );
      shop.setOwner    (owner      );
      
        return shop;
    }
View Full Code Here

   * @param frame  ItemFrame to remove
   */
  private void removeFrame (ItemFrame frame) {
   
    // remove frame to shop link
    Shop shop = frameShops.remove(frame);
   
    // remove shop to frame link
    shopFrames.get(shop).remove(frame);
  }
View Full Code Here

       
          // iterate through all block faces
          for (BlockFace face : faces) {
           
            Block   blockRelative   = block.getRelative(face);
            Shop  shop      = getShop(blockRelative);
           
            // Shop found?
            if (shop != null) {
             
              // add the frames
View Full Code Here

   * @see com.kellerkindt.scs.interfaces.ShopHandler#onItemFrameDestroyed(org.bukkit.entity.ItemFrame)
   */
  @Override
  public void removeItemFrame(ItemFrame frame) {
   
    final Shop shop  = frameShops.get(frame);
   
    // not above a shop?
    if (shop == null) {
      return;
    }
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.