Advertisement
broken-arrow

Untitled

Jan 23rd, 2022
584
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class CCHWrapper implements InventoryWrapper {
  2.     private final Location cchBindingLocation;
  3.     private final ContainerData data;
  4.     private final InventoryHolders holders;
  5.     public CCHWrapper(Location loc){
  6.         this.cchBindingLocation = loc;
  7.         this.data = ContainerRegistryAPI.getInstance().findChest(loc);
  8.         if(this.data == null)
  9.             throw new IllegalArgumentException("Target chest not a CCH container");
  10.         if(this.data.getTypeOfContainer() != TypeOfContainers.TypeOfContainer.PAGEDCONTAINER)
  11.             throw new IllegalArgumentException("Target chest not a CCH paged container");
  12.         this.holders = CustomContainersMainClass.getInstance().getInventoryHoldersCached().getInventoryHolder(cchBindingLocation);
  13.     }
  14.  
  15.     @Override
  16.     public int getSize() {
  17.         return holders.getguiSize();
  18.     }
  19.  
  20.     @Override
  21.     public @Nullable ItemStack getItem(int i) {
  22.         holders.getInventory(cchBindingLocation).get(0).getItem(i);
  23.         // TODO
  24.     }
  25.  
  26.     @Override
  27.     public void setItem(int i, @Nullable ItemStack itemStack) throws IllegalArgumentException {
  28.         holders.getInventory(cchBindingLocation).get(0).setItem(i,itemStack);
  29.         // TODO
  30.     }
  31.  
  32.     @Override
  33.     public @NotNull ItemStack[] getContents() {
  34.         holders.getInventory(cchBindingLocation).get(0).getContents();
  35.         // TODO
  36.     }
  37.  
  38.     @Override
  39.     public void setContents(@NotNull ItemStack[] itemStacks) throws IllegalArgumentException {
  40.         holders.getInventory(cchBindingLocation).get(0).setContents( itemStacks);
  41.         // TODO
  42.     }
  43.  
  44.     @Override
  45.     public @NotNull ItemStack[] getStorageContents() {
  46.      return   holders.getInventory(cchBindingLocation).get(0).getContents();
  47.         // TODO
  48.     }
  49.  
  50.     @Override
  51.     public void setStorageContents(@NotNull ItemStack[] itemStacks) throws IllegalArgumentException {
  52.         holders.getInventory(cchBindingLocation).get(0).setContents( itemStacks);
  53.         // TODO
  54.     }
  55.  
  56.     @Override
  57.     public @Nullable InventoryHolder getHolder() {
  58.         holders.getInventory(cchBindingLocation).get(0).getHolder();
  59.         return null;
  60.     }
  61.  
  62.     @Override
  63.     public @Nullable Location getLocation() {
  64.         return cchBindingLocation;
  65.     }
  66.  
  67.     @Override
  68.     public @NotNull InventoryWrapperType getInventoryType() {
  69.         return InventoryWrapperType.PLUGIN;
  70.     }
  71.  
  72.     @Override
  73.     public @NotNull InventoryWrapperManager getWrapperManager() {
  74.         return StorageProxy.getInstance().getManager();
  75.     }
  76. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement