Code:java if ((players.getWorld() != player.getWorld()) || (players.getLocation().distance(player.getLocation()) > 2000 && !players.hasPermission("priziuretojas.snipas"))) { event.getRecipients().remove(players); } 1) What's the difference between this: Code:java if ((players.getWorld() != player.getWorld()) And this: Code:java if (players.getWorld() != player.getWorld() 2) What's the difference between this: Code:java player.getWorld()) || (players.getLocation And this: Code:java player.getWorld()) | (players.getLocation
Ibas To 1.: Every ( you set needs a ). They are always in pairs and the second misses the ending ) To 2.: || is the logical OR, while | is a bitwise inclusive OR. So first is for values true and false, second for handling bits and bytes EDIT: To 1.: Just saw you missed the ending ) in both cases, so in your example the both are meaning the same, so the ( ) are just working like in math when it comes to * vs +. It just gives the order of evaluate the statements
Tarestudio Concerning the second question: if you are not dealing with bits and bytes, the | or & tokens are used to make sure that the compiler interprets all parts of the expression. For example: (false || true) The compiler would stop interpreting at false. (false | true) The compiler would interpret the whole expression.
Dyprex 1. if(false || true) is true, not false... if (false && true) is false and breaks after false, because it cant get true anyway. 2. booleans have 1 bit, so true would be 1 and false would be 0. doing a bitwise inclusive OR on that will result 1, would be true. So you dont interpret the whole expression, you just operating on the bits.