diff --git a/src/main/java/ch/njol/skript/effects/EffHealth.java b/src/main/java/ch/njol/skript/effects/EffHealth.java index 7d51039081d..c01788c7f03 100644 --- a/src/main/java/ch/njol/skript/effects/EffHealth.java +++ b/src/main/java/ch/njol/skript/effects/EffHealth.java @@ -80,7 +80,7 @@ public boolean init(final Expression[] vars, final int matchedPattern, final damage = (Expression) vars[1]; heal = (matchedPattern >= 1); - if (vars.length >= 2) dmgCause = (Expression) vars[2]; + if (vars.length >= 3) dmgCause = (Expression) vars[2]; return true; } diff --git a/src/main/java/ch/njol/skript/events/EvtClick.java b/src/main/java/ch/njol/skript/events/EvtClick.java index 4d9e6f4b915..14e2c19d916 100644 --- a/src/main/java/ch/njol/skript/events/EvtClick.java +++ b/src/main/java/ch/njol/skript/events/EvtClick.java @@ -338,126 +338,4 @@ public static boolean checkUseOffHand(Player player, int clickType, @Nullable Bl return false; // Both hands are AIR material! } - private boolean checkOffHandUse2(@Nullable ItemStack mainHand, @Nullable ItemStack offHand, int clickType, Player player, @Nullable Block target) { - boolean mainUsable = false; - boolean offUsable = false; - - if (mainHand == null) mainHand = new ItemStack(Material.AIR); - - if (clickType == RIGHT) { - if (offHand == null) return false; - switch (offHand.getType()) { - case BOW: - case EGG: - case SPLASH_POTION: - case SNOW_BALL: - case BUCKET: - case FISHING_ROD: - case FLINT_AND_STEEL: - case WOOD_HOE: - case STONE_HOE: - case IRON_HOE: - case GOLD_HOE: - case DIAMOND_HOE: - case LEASH: - case SHEARS: - case WOOD_SPADE: - case STONE_SPADE: - case IRON_SPADE: - case GOLD_SPADE: - case DIAMOND_SPADE: - case SHIELD: - case ENDER_PEARL: - offUsable = true; - break; - //$CASES-OMITTED$ - default: - offUsable = false; - } - - if (offHand.getType().isBlock() || offHand.getType().isEdible()) { - offUsable = true; - } - - switch (mainHand.getType()) { - case BOW: - case EGG: - case SPLASH_POTION: - case SNOW_BALL: - case BUCKET: - case FISHING_ROD: - case FLINT_AND_STEEL: - case WOOD_HOE: - case STONE_HOE: - case IRON_HOE: - case GOLD_HOE: - case DIAMOND_HOE: - case LEASH: - case SHEARS: - case WOOD_SPADE: - case STONE_SPADE: - case IRON_SPADE: - case GOLD_SPADE: - case DIAMOND_SPADE: - case ENDER_PEARL: - mainUsable = true; - break; - //$CASES-OMITTED$ - default: - mainUsable = false; - } - - if (mainHand.getType().isBlock() || mainHand.getType().isEdible()) { - mainUsable = true; - } - - if (target != null) { - switch (target.getType()) { - case ANVIL: - case BEACON: - case BED: - case BREWING_STAND: - case CAKE: - case CAULDRON: - case CHEST: - case TRAPPED_CHEST: - case ENDER_CHEST: - case WORKBENCH: - case ENCHANTMENT_TABLE: - case FURNACE: - case WOOD_DOOR: - case ACACIA_DOOR: - case JUNGLE_DOOR: - case DARK_OAK_DOOR: - case SPRUCE_DOOR: - case BIRCH_DOOR: - case IRON_DOOR: - case TRAP_DOOR: - case IRON_TRAPDOOR: - case FENCE_GATE: - case ACACIA_FENCE_GATE: - case JUNGLE_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case SPRUCE_FENCE_GATE: - case BIRCH_FENCE_GATE: - case HOPPER: - case DISPENSER: - case DROPPER: - case LEVER: - case WOOD_BUTTON: - case STONE_BUTTON: - case COMMAND: - if (player.isSneaking()) { - if (offHand.getType() == Material.AIR && mainHand.getType() != Material.AIR) return true; - } else { - mainUsable = true; - } - } - } - } - - if (mainUsable) return false; - else if (offUsable) return true; - else return false; - } -} +} \ No newline at end of file