Added offhand read only
This commit is contained in:
@@ -46,6 +46,11 @@ public class TalismanChecks {
|
|||||||
*/
|
*/
|
||||||
private static boolean readShulkerBoxes = true;
|
private static boolean readShulkerBoxes = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If only offhand should be read.
|
||||||
|
*/
|
||||||
|
private static boolean offhandOnly = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The associated plugin instance.
|
* The associated plugin instance.
|
||||||
*/
|
*/
|
||||||
@@ -149,6 +154,11 @@ public class TalismanChecks {
|
|||||||
rawContents.addAll(Arrays.asList(player.getEnderChest().getContents()));
|
rawContents.addAll(Arrays.asList(player.getEnderChest().getContents()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (offhandOnly) {
|
||||||
|
rawContents.clear();
|
||||||
|
rawContents.add(player.getInventory().getItemInOffHand());
|
||||||
|
}
|
||||||
|
|
||||||
rawContents.addAll(Arrays.asList(extra));
|
rawContents.addAll(Arrays.asList(extra));
|
||||||
|
|
||||||
for (ItemStack rawContent : rawContents) {
|
for (ItemStack rawContent : rawContents) {
|
||||||
@@ -207,5 +217,6 @@ public class TalismanChecks {
|
|||||||
public static void reload() {
|
public static void reload() {
|
||||||
readEnderChest = PLUGIN.getConfigYml().getBool("read-enderchest");
|
readEnderChest = PLUGIN.getConfigYml().getBool("read-enderchest");
|
||||||
readShulkerBoxes = PLUGIN.getConfigYml().getBool("read-shulkerboxes");
|
readShulkerBoxes = PLUGIN.getConfigYml().getBool("read-shulkerboxes");
|
||||||
|
offhandOnly = PLUGIN.getConfigYml().getBool("offhand-only");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,3 +20,5 @@ crafting:
|
|||||||
|
|
||||||
read-enderchest: true # If a player's ender chest should be checked for talismans
|
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-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
|
||||||
|
|||||||
Reference in New Issue
Block a user