diff --git a/src/main/java/world/bentobox/bentobox/hooks/VaultHook.java b/src/main/java/world/bentobox/bentobox/hooks/VaultHook.java index 0c3eb3459..9530927d0 100644 --- a/src/main/java/world/bentobox/bentobox/hooks/VaultHook.java +++ b/src/main/java/world/bentobox/bentobox/hooks/VaultHook.java @@ -12,6 +12,7 @@ import world.bentobox.bentobox.api.user.User; */ public class VaultHook extends Hook { + private static final String AMOUNT_MUST_BE_POSITIVE = "Amount must be positive."; private Economy economy; public VaultHook() { @@ -61,7 +62,7 @@ public class VaultHook extends Hook { throw new IllegalArgumentException("User must be a Player or an OfflinePlayer"); } if (amount < 0.0D) { - throw new IllegalArgumentException("Amount must be positive."); + throw new IllegalArgumentException(AMOUNT_MUST_BE_POSITIVE); } return economy.withdrawPlayer(user.getPlayer(), amount); } @@ -77,7 +78,7 @@ public class VaultHook extends Hook { throw new IllegalArgumentException("User must be a Player or an OfflinePlayer"); } if (amount < 0.0D) { - throw new IllegalArgumentException("Amount must be positive."); + throw new IllegalArgumentException(AMOUNT_MUST_BE_POSITIVE); } return economy.depositPlayer(user.getPlayer(), amount); } @@ -92,7 +93,7 @@ public class VaultHook extends Hook { */ public boolean has(User user, double amount) { if (amount < 0.0D) { - throw new IllegalArgumentException("Amount must be positive."); + throw new IllegalArgumentException(AMOUNT_MUST_BE_POSITIVE); } return user.isPlayer() && economy.has(user.getPlayer(), amount); } diff --git a/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java b/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java index 13edd25b4..d558c5a76 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/JoinLeaveListener.java @@ -88,9 +88,9 @@ public class JoinLeaveListener implements Listener { plugin.getIWM().getOverWorlds().forEach(w -> { Island island = plugin.getIslands().getIsland(w, User.getInstance(event.getPlayer())); // Are there any online players still for this island? - if (island != null && !plugin.getServer().getOnlinePlayers().stream() + if (island != null && plugin.getServer().getOnlinePlayers().stream() .filter(p -> !event.getPlayer().equals(p)) - .anyMatch(p -> plugin.getIslands().getMembers(w, event.getPlayer().getUniqueId()).contains(p.getUniqueId()))) { + .noneMatch(p -> plugin.getIslands().getMembers(w, event.getPlayer().getUniqueId()).contains(p.getUniqueId()))) { // No, there are no more players online on this island // Tell players they are being removed island.getMembers().entrySet().stream() diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/BreedingListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/BreedingListener.java index 0bc9db45c..603fece06 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/BreedingListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/BreedingListener.java @@ -40,10 +40,8 @@ public class BreedingListener extends FlagListener { if (e.getHand().equals(EquipmentSlot.OFF_HAND)) { inHand = e.getPlayer().getInventory().getItemInOffHand(); } - if (inHand != null && BREEDING_ITEMS.contains(inHand.getType())) { - if (!checkIsland(e, e.getRightClicked().getLocation(), Flags.BREEDING)) { - ((Animals)e.getRightClicked()).setBreed(false); - } + if (inHand != null && BREEDING_ITEMS.contains(inHand.getType()) && !checkIsland(e, e.getRightClicked().getLocation(), Flags.BREEDING)) { + ((Animals)e.getRightClicked()).setBreed(false); } } }