Code: ArrayList<Integer> id = new ArrayList<>(); id.add(20); id.add(355); id.add(24); id.add(121); id.add(30); id.add(95); id.add(46); id.add(54); for(Integer d : id){ if(!(e.getBlock().getType().getId() == d)){ e.setCancelled(true); } } It cancel ALLLLLL Pls help
Probably because you're checking if it's not equal instead of if it is. Also you should use Material instead of the IDs, they're deprecated.
@Omel Why not just use Materials like @Xerox262 said and use the if(list.contains()) method instead of creating a for loop?
@Omel You aren't using a material list, you're using an Integer list. Also, you don't need to do this Code: ArrayList<Integer> id = new ArrayList<>(); id.add(20); id.add(355); id.add(24); id.add(121); id.add(30); id.add(95); id.add(46); id.add(54); You can do Code: ArrayList<Integer> id = Arrays.asList(20, 355, 24, 121, 30, 95, 46, 54); And rather than create that every time a player breaks a block, just create it in your constructor once.