diff --git a/src/main/java/fr/epicanard/globalmarketchest/commands/CommandHandler.java b/src/main/java/fr/epicanard/globalmarketchest/commands/CommandHandler.java index e26482b6..319f67fd 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/commands/CommandHandler.java +++ b/src/main/java/fr/epicanard/globalmarketchest/commands/CommandHandler.java @@ -17,8 +17,6 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import java.util.stream.Stream; - public class CommandHandler implements CommandExecutor, TabCompleter { @@ -159,7 +157,9 @@ private List shopLocationTabComplete(CommandSender sender, String[] args } if (args.length == 2) { return GlobalMarketChest.plugin.shopManager.getShops().stream() - .filter(shop -> shop.getExists() && shop.getGroup().equals(args[0]) && Integer.toString(shop.getId()).startsWith(args[1]) && shop.getTpLocation().isPresent()) + .filter(shop -> { + return shop.getExists() && shop.getGroup().equals(args[0]) && Integer.toString(shop.getId()).startsWith(args[1]) && shop.getTpLocation().isPresent(); + }) .map(shop -> WorldUtils.getStringFromLocation(shop.getTpLocation().get())) .collect(Collectors.toList()); } diff --git a/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/DeleteConsumer.java b/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/DeleteConsumer.java index 4b957368..47b45911 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/DeleteConsumer.java +++ b/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/DeleteConsumer.java @@ -8,14 +8,13 @@ import fr.epicanard.globalmarketchest.utils.LangUtils; import fr.epicanard.globalmarketchest.utils.PlayerUtils; import fr.epicanard.globalmarketchest.utils.WorldUtils; - import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; - import java.util.List; import java.util.stream.Collectors; + import static fr.epicanard.globalmarketchest.utils.Option.forAll; /** diff --git a/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/SetTpConsumer.java b/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/SetTpConsumer.java index 84473200..bde38828 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/SetTpConsumer.java +++ b/src/main/java/fr/epicanard/globalmarketchest/commands/consumers/SetTpConsumer.java @@ -45,7 +45,7 @@ public Boolean accept(CommandNode node, String command, CommandSender sender, St && exists(shop.getTpLocation(), loc -> args.length < 2 || WorldUtils.compareLocations(loc, argLoc))) .collect(Collectors.toList()); if (shops.size() == 0) { - PlayerUtils.sendMessage(sender, String.format("%s%s %s", LangUtils.get("ErrorMessages.UnknownShop"), args[0], (args.length > 1) ? args[1]: "")); + PlayerUtils.sendMessage(sender, String.format("%s%s %s", LangUtils.get("ErrorMessages.UnknownShop"), args[0], (args.length > 1) ? args[1] : "")); return false; } if (shops.size() > 1 && args.length < 2) { diff --git a/src/main/java/fr/epicanard/globalmarketchest/database/querybuilder/QueryExecutor.java b/src/main/java/fr/epicanard/globalmarketchest/database/querybuilder/QueryExecutor.java index ee56637f..3993b855 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/database/querybuilder/QueryExecutor.java +++ b/src/main/java/fr/epicanard/globalmarketchest/database/querybuilder/QueryExecutor.java @@ -81,7 +81,11 @@ private Boolean setPreparedOneField(PreparedStatement prepared, Object value, At * @param builder BaseBuilder that contains the query * @param onSuccess Callback called with the query response */ - public > Boolean execute(final BaseBuilder builder, final SqlConsumer onSuccess, final Consumer onError) { + public > Boolean execute( + final BaseBuilder builder, + final SqlConsumer onSuccess, + final Consumer onError + ) { Connection co = GlobalMarketChest.plugin.getSqlConnector().getConnection(); Boolean ret = false; AtomicReference res = new AtomicReference<>();