Merge branch 'development'

This commit is contained in:
Brianna O'Keefe 2024-03-29 11:50:51 -05:00
commit dd5542a715
5 changed files with 25 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>5.0.2</version>
<version>5.0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-API</artifactId>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>5.0.2</version>
<version>5.0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-Plugin</artifactId>
@ -175,7 +175,7 @@
<dependency>
<groupId>com.github.DeadSilenceIV</groupId>
<artifactId>AdvancedChestsAPI</artifactId>
<version>2.4</version>
<version>3.2-BETA</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -2,10 +2,17 @@ package com.craftaro.epichoppers.containers.impl;
import com.craftaro.epichoppers.containers.CustomContainer;
import com.craftaro.epichoppers.containers.IContainer;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import us.lynuxcraft.deadsilenceiv.advancedchests.AdvancedChestsAPI;
import us.lynuxcraft.deadsilenceiv.advancedchests.chest.AdvancedChest;
import us.lynuxcraft.deadsilenceiv.advancedchests.utils.inventory.InteractiveInventory;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class AdvancedChestImpl implements IContainer {
@Override
@ -14,7 +21,7 @@ public class AdvancedChestImpl implements IContainer {
}
static class Container extends CustomContainer {
private final AdvancedChest advancedChest;
private final AdvancedChest<?, ?> advancedChest;
public Container(Block block) {
this.advancedChest = AdvancedChestsAPI.getChestManager().getAdvancedChest(block.getLocation());
@ -22,17 +29,25 @@ public class AdvancedChestImpl implements IContainer {
@Override
public boolean addToContainer(ItemStack itemToMove) {
return AdvancedChestsAPI.addItemToChest(this.advancedChest, itemToMove);
// return AdvancedChestsAPI.addItemToChest(this.advancedChest, itemToMove);
if (advancedChest != null) {
Optional<InteractiveInventory> inv = advancedChest.getSubInventories().stream().filter(subInventory -> subInventory.getBukkitInventory().firstEmpty() != -1).findFirst();
if (inv.isPresent()) {
return inv.get().getBukkitInventory().addItem(itemToMove).isEmpty();
}
}
return false;
}
@Override
public ItemStack[] getItems() {
return this.advancedChest.getAllItems().toArray(new ItemStack[0]);
// return this.advancedChest.getAllItems().toArray(new ItemStack[0]);
return this.advancedChest.getSubInventories().stream().map(subInventory -> subInventory.getBukkitInventory().getContents()).collect(Collectors.toList()).stream().flatMap(Arrays::stream).toArray(ItemStack[]::new);
}
@Override
public void removeFromContainer(ItemStack itemToMove, int amountToMove) {
for (ItemStack item : this.advancedChest.getAllItems()) {
for (ItemStack item : getItems()) {
if (item == null) {
return;
}
@ -41,7 +56,7 @@ public class AdvancedChestImpl implements IContainer {
item.setAmount(item.getAmount() - amountToMove);
if (item.getAmount() <= 0) {
this.advancedChest.getAllItems().remove(item);
item.setType(Material.AIR);
}
return;
}

View File

@ -58,7 +58,7 @@ interface:
filter:
infotitle: '&aFilter Guide'
infolore: '&7Items placed in the leftmost column|&7space will be whitelisted.||&7Items placed in the rightmost column|&7will be void.||&7Items placed in the middle column|&7will be blacklisted.'
infolore: '&7Items placed in the leftmost column|&7space will be whitelisted.||&7Items placed in the middle column|&7will be blacklisted.||&7Items placed in the rightmost column|&7will be void.|||&cThe whitelist and blacklist|&ccannot be used at the same time.'
whitelist: '&f&lWhite List'
blacklist: '&8&lBlack List'
void: '&c&lVoid'

View File

@ -7,7 +7,7 @@
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<packaging>pom</packaging>
<version>5.0.2</version>
<version>5.0.3</version>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z-DEV' to update version recursively -->
<modules>