Answer the question
In order to leave comments, you need to log in
How to make a double IF condition in Java?
I have a condition (If in hand = a stone sword, and the block on which we press the chest, then) for example: (If in the hand there is a stone sword or an iron sword or a wooden sword and the block on which we press the chest, then, but works like:
If in hand a stone sword or an iron sword or "a wooden sword and a block on which we press the chest" i.e. only with the latter)
Code:
if(a == Action.LEFT_CLICK_BLOCK && a == Action.RIGHT_CLICK_BLOCK && p.getInventory().getItemInMainHand().getType() == Material.DIAMOND_SWORD && Material.IRON_SWORD && e.getClickedBlock().getType() == Material.CHEST || e.getClickedBlock().getType() == Material.ENDER_CHEST) {
e.setCancelled(true);
p.sendMessage(ChatColor.BOLD + ("Убери меч из рук"));
p.playSound(p.getLocation(), Sound.BLOCK_DISPENSER_FAIL, 2, 1);
}
Answer the question
In order to leave comments, you need to log in
if(a==0 || b ==1 ){do(a,b)} else{
if(a==0){do(a)} }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question