broken-arrow

Untitled

Jan 23rd, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.38 KB | None | 0 0
  1. package com.ghostchu.storageproxy;
  2.  
  3. import org.brokenarrow.storage.CustomContainersMainClass;
  4. import org.brokenarrow.storage.api.ContainerRegistryAPI;
  5. import org.brokenarrow.storage.api.containerholders.InventoryHolders;
  6. import org.brokenarrow.storage.util.TypeOfContainers;
  7. import org.brokenarrow.storage.util.builderclass.ContainerData;
  8. import org.bukkit.Location;
  9. import org.bukkit.inventory.InventoryHolder;
  10. import org.bukkit.inventory.ItemStack;
  11. import org.jetbrains.annotations.NotNull;
  12. import org.jetbrains.annotations.Nullable;
  13. import org.maxgamer.quickshop.api.shop.inventory.InventoryWrapper;
  14. import org.maxgamer.quickshop.api.shop.inventory.InventoryWrapperManager;
  15. import org.maxgamer.quickshop.api.shop.inventory.InventoryWrapperType;
  16. public class CCHWrapper implements InventoryWrapper {
  17.     private final Location cchBindingLocation;
  18.     private final ContainerData data;
  19.     private final int page;
  20.     private final InventoryHolders holders;
  21.     public CCHWrapper(Location loc){
  22.         this.cchBindingLocation = loc;
  23.         this.data = ContainerRegistryAPI.getInstance().findChest(loc);
  24.         if(this.data == null)
  25.             throw new IllegalArgumentException("Target chest not a CCH container");
  26.         if(this.data.getTypeOfContainer() != TypeOfContainers.TypeOfContainer.PAGEDCONTAINER)
  27.             throw new IllegalArgumentException("Target chest not a CCH paged container");
  28.         this.holders = CustomContainersMainClass.getInstance().getInventoryHoldersCached().getInventoryHolder(cchBindingLocation);
  29.         this.page = 0;
  30.     }
  31.  
  32.     @Override
  33.     public int getSize() {
  34.         return holders.getguiSize();
  35.     }
  36.  
  37.     @Override
  38.     public @Nullable ItemStack getItem(int i) {
  39.         holders.getInventory(cchBindingLocation).get(this.page).getItem(i);
  40.         // TODO
  41.     }
  42.  
  43.     @Override
  44.     public void setItem(int i, @Nullable ItemStack itemStack) throws IllegalArgumentException {
  45.         holders.getInventory(cchBindingLocation).get(this.page).setItem(i,itemStack);
  46.         // TODO
  47.     }
  48.  
  49.     @Override
  50.     public @NotNull ItemStack[] getContents() {
  51.         holders.getInventory(cchBindingLocation).get(this.page).getContents();
  52.         // TODO
  53.     }
  54.  
  55.     @Override
  56.     public void setContents(@NotNull ItemStack[] itemStacks) throws IllegalArgumentException {
  57.         holders.getInventory(cchBindingLocation).get(this.page).setContents( itemStacks);
  58.         // TODO
  59.     }
  60.  
  61.     @Override
  62.     public @NotNull ItemStack[] getStorageContents() {
  63.      return   holders.getInventory(cchBindingLocation).get(this.page).getContents();
  64.         // TODO
  65.     }
  66.  
  67.     @Override
  68.     public void setStorageContents(@NotNull ItemStack[] itemStacks) throws IllegalArgumentException {
  69.         holders.getInventory(cchBindingLocation).get(this.page).setContents( itemStacks);
  70.         // TODO
  71.     }
  72.  
  73.     @Override
  74.     public @Nullable InventoryHolder getHolder() {
  75.         holders.getInventory(cchBindingLocation).get(this.page).getHolder();
  76.         return null;
  77.     }
  78.  
  79.     @Override
  80.     public @Nullable Location getLocation() {
  81.         return cchBindingLocation;
  82.     }
  83.  
  84.     @Override
  85.     public @NotNull InventoryWrapperType getInventoryType() {
  86.         return InventoryWrapperType.PLUGIN;
  87.     }
  88.  
  89.     @Override
  90.     public @NotNull InventoryWrapperManager getWrapperManager() {
  91.         return StorageProxy.getInstance().getManager();
  92.     }
  93. }
  94.  
Add Comment
Please, Sign In to add comment