Added offhand read only

This commit is contained in:
Auxilor
2021-03-08 20:53:36 +00:00
parent d487da5937
commit 56fe8ecd6b
2 changed files with 13 additions and 0 deletions

View File

@@ -46,6 +46,11 @@ public class TalismanChecks {
*/
private static boolean readShulkerBoxes = true;
/**
* If only offhand should be read.
*/
private static boolean offhandOnly = false;
/**
* The associated plugin instance.
*/
@@ -149,6 +154,11 @@ public class TalismanChecks {
rawContents.addAll(Arrays.asList(player.getEnderChest().getContents()));
}
if (offhandOnly) {
rawContents.clear();
rawContents.add(player.getInventory().getItemInOffHand());
}
rawContents.addAll(Arrays.asList(extra));
for (ItemStack rawContent : rawContents) {
@@ -207,5 +217,6 @@ public class TalismanChecks {
public static void reload() {
readEnderChest = PLUGIN.getConfigYml().getBool("read-enderchest");
readShulkerBoxes = PLUGIN.getConfigYml().getBool("read-shulkerboxes");
offhandOnly = PLUGIN.getConfigYml().getBool("offhand-only");
}
}

View File

@@ -20,3 +20,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
offhand-only: false # If talismans or shulkers of talismans need to be in the offhand to work