Revert "Added option for shulkers in ender chest"

This reverts commit 7189db10
This commit is contained in:
Auxilor
2021-07-17 19:00:44 +02:00
parent a40c7a54b1
commit 1be2b8f9d1
2 changed files with 5 additions and 44 deletions

View File

@@ -46,11 +46,6 @@ public class TalismanChecks {
*/
private static boolean readShulkerBoxes = true;
/**
* If shulker boxes in ender chests should be read.
*/
private static boolean readShulkerInEnderChest = true;
/**
* If only offhand should be read.
*/
@@ -157,36 +152,24 @@ public class TalismanChecks {
List<ItemStack> contents = new ArrayList<>();
Set<TalismanLevel> found = new HashSet<>();
Map<ItemStack, Boolean> rawContents = new HashMap<>();
for (ItemStack stack : player.getInventory().getContents()) {
rawContents.put(stack, false);
}
List<ItemStack> rawContents = new ArrayList<>(Arrays.asList(player.getInventory().getContents()));
if (readEnderChest) {
for (ItemStack stack : player.getEnderChest().getContents()) {
rawContents.put(stack, true);
}
rawContents.addAll(Arrays.asList(player.getEnderChest().getContents()));
}
if (offhandOnly) {
rawContents.clear();
rawContents.put(player.getInventory().getItemInOffHand(), false);
rawContents.add(player.getInventory().getItemInOffHand());
}
for (ItemStack stack : extra) {
rawContents.put(stack, false);
}
rawContents.addAll(Arrays.asList(extra));
for (ItemStack rawContent : rawContents.keySet()) {
for (ItemStack rawContent : rawContents) {
if (rawContent == null) {
continue;
}
if (readShulkerBoxes) {
if (rawContents.get(rawContent)) {
continue;
}
ItemMeta meta = rawContent.getItemMeta();
if (meta instanceof BlockStateMeta shulkerMeta) {
if (!shulkerMeta.hasBlockState()) {
@@ -200,26 +183,6 @@ public class TalismanChecks {
}
}
}
if (readShulkerInEnderChest) {
if (!rawContents.get(rawContent)) {
continue;
}
ItemMeta meta = rawContent.getItemMeta();
if (meta instanceof BlockStateMeta shulkerMeta) {
if (!shulkerMeta.hasBlockState()) {
continue;
}
BlockState state = shulkerMeta.getBlockState();
if (state instanceof ShulkerBox shulkerBox) {
contents.addAll(Arrays.asList(shulkerBox.getInventory().getContents()));
continue;
}
}
}
contents.add(rawContent);
}
@@ -279,7 +242,6 @@ public class TalismanChecks {
public static void reload() {
readEnderChest = PLUGIN.getConfigYml().getBool("read-enderchest");
readShulkerBoxes = PLUGIN.getConfigYml().getBool("read-shulkerboxes");
readShulkerInEnderChest = PLUGIN.getConfigYml().getBool("read-enderchest-boxes");
offhandOnly = PLUGIN.getConfigYml().getBool("offhand-only");
}
}

View File

@@ -12,6 +12,5 @@ crafting:
read-enderchest: true # If a player's ender chest should be checked for talismans
read-shulkerboxes: true # If a player's shulker boxes should be checked for talismans
read-enderchest-boxes: true # If shulker boxes in a player's ender chest should be checked for talismans.
offhand-only: false # If talismans or shulkers of talismans need to be in the offhand to work