Fix for offhandedness

This commit is contained in:
dordsor21 2019-03-09 00:28:21 +00:00
parent aa894b8ad9
commit dffbaf89a3

View File

@ -1741,7 +1741,13 @@ import java.util.regex.Pattern;
if (area == null) { if (area == null) {
return; return;
} }
Material type = player.getInventory().getItemInMainHand().getType(); ItemStack hand = player.getInventory().getItemInMainHand();
ItemStack offHand = player.getInventory().getItemInOffHand();
Material type = (hand == null) ? Material.AIR : hand.getType();
Material offType = (offHand == null) ? Material.AIR : offHand.getType();
if (type == Material.AIR) {
type = offType;
}
if (type.toString().toLowerCase().endsWith("egg")) { if (type.toString().toLowerCase().endsWith("egg")) {
Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY); Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY);
if (block != null && block.getType() != Material.AIR) { if (block != null && block.getType() != Material.AIR) {