Skip to content

Commit 43696c2

Browse files
committed
Oops... Java has 0-based arrays
1 parent d170c80 commit 43696c2

File tree

2 files changed

+2
-124
lines changed

2 files changed

+2
-124
lines changed

src/main/java/ch/njol/skript/effects/EffHealth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public boolean init(final Expression<?>[] vars, final int matchedPattern, final
8080
damage = (Expression<Number>) vars[1];
8181
heal = (matchedPattern >= 1);
8282

83-
if (vars.length >= 2) dmgCause = (Expression<DamageCause>) vars[2];
83+
if (vars.length >= 3) dmgCause = (Expression<DamageCause>) vars[2];
8484
return true;
8585
}
8686

src/main/java/ch/njol/skript/events/EvtClick.java

Lines changed: 1 addition & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -338,126 +338,4 @@ public static boolean checkUseOffHand(Player player, int clickType, @Nullable Bl
338338
return false; // Both hands are AIR material!
339339
}
340340

341-
private boolean checkOffHandUse2(@Nullable ItemStack mainHand, @Nullable ItemStack offHand, int clickType, Player player, @Nullable Block target) {
342-
boolean mainUsable = false;
343-
boolean offUsable = false;
344-
345-
if (mainHand == null) mainHand = new ItemStack(Material.AIR);
346-
347-
if (clickType == RIGHT) {
348-
if (offHand == null) return false;
349-
switch (offHand.getType()) {
350-
case BOW:
351-
case EGG:
352-
case SPLASH_POTION:
353-
case SNOW_BALL:
354-
case BUCKET:
355-
case FISHING_ROD:
356-
case FLINT_AND_STEEL:
357-
case WOOD_HOE:
358-
case STONE_HOE:
359-
case IRON_HOE:
360-
case GOLD_HOE:
361-
case DIAMOND_HOE:
362-
case LEASH:
363-
case SHEARS:
364-
case WOOD_SPADE:
365-
case STONE_SPADE:
366-
case IRON_SPADE:
367-
case GOLD_SPADE:
368-
case DIAMOND_SPADE:
369-
case SHIELD:
370-
case ENDER_PEARL:
371-
offUsable = true;
372-
break;
373-
//$CASES-OMITTED$
374-
default:
375-
offUsable = false;
376-
}
377-
378-
if (offHand.getType().isBlock() || offHand.getType().isEdible()) {
379-
offUsable = true;
380-
}
381-
382-
switch (mainHand.getType()) {
383-
case BOW:
384-
case EGG:
385-
case SPLASH_POTION:
386-
case SNOW_BALL:
387-
case BUCKET:
388-
case FISHING_ROD:
389-
case FLINT_AND_STEEL:
390-
case WOOD_HOE:
391-
case STONE_HOE:
392-
case IRON_HOE:
393-
case GOLD_HOE:
394-
case DIAMOND_HOE:
395-
case LEASH:
396-
case SHEARS:
397-
case WOOD_SPADE:
398-
case STONE_SPADE:
399-
case IRON_SPADE:
400-
case GOLD_SPADE:
401-
case DIAMOND_SPADE:
402-
case ENDER_PEARL:
403-
mainUsable = true;
404-
break;
405-
//$CASES-OMITTED$
406-
default:
407-
mainUsable = false;
408-
}
409-
410-
if (mainHand.getType().isBlock() || mainHand.getType().isEdible()) {
411-
mainUsable = true;
412-
}
413-
414-
if (target != null) {
415-
switch (target.getType()) {
416-
case ANVIL:
417-
case BEACON:
418-
case BED:
419-
case BREWING_STAND:
420-
case CAKE:
421-
case CAULDRON:
422-
case CHEST:
423-
case TRAPPED_CHEST:
424-
case ENDER_CHEST:
425-
case WORKBENCH:
426-
case ENCHANTMENT_TABLE:
427-
case FURNACE:
428-
case WOOD_DOOR:
429-
case ACACIA_DOOR:
430-
case JUNGLE_DOOR:
431-
case DARK_OAK_DOOR:
432-
case SPRUCE_DOOR:
433-
case BIRCH_DOOR:
434-
case IRON_DOOR:
435-
case TRAP_DOOR:
436-
case IRON_TRAPDOOR:
437-
case FENCE_GATE:
438-
case ACACIA_FENCE_GATE:
439-
case JUNGLE_FENCE_GATE:
440-
case DARK_OAK_FENCE_GATE:
441-
case SPRUCE_FENCE_GATE:
442-
case BIRCH_FENCE_GATE:
443-
case HOPPER:
444-
case DISPENSER:
445-
case DROPPER:
446-
case LEVER:
447-
case WOOD_BUTTON:
448-
case STONE_BUTTON:
449-
case COMMAND:
450-
if (player.isSneaking()) {
451-
if (offHand.getType() == Material.AIR && mainHand.getType() != Material.AIR) return true;
452-
} else {
453-
mainUsable = true;
454-
}
455-
}
456-
}
457-
}
458-
459-
if (mainUsable) return false;
460-
else if (offUsable) return true;
461-
else return false;
462-
}
463-
}
341+
}

0 commit comments

Comments
 (0)