From 1dc4da8beb39f3458409888afa22a955ae96ff02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Tue, 14 Jul 2020 13:21:59 +0200 Subject: [PATCH] Fix issues from previous merge --- .../java/com/plotsquared/bukkit/BukkitMain.java | 1 - .../bukkit/uuid/SquirrelIdUUIDService.java | 15 ++++++++++----- .../java/com/plotsquared/core/PlotSquared.java | 10 ---------- .../java/com/plotsquared/core/plot/PlotArea.java | 3 ++- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 083f7e58d..e68466d6a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -933,7 +933,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< return perm; } } catch (Throwable ignored) { - PlotSquared.debug("No permissions detected!"); } return null; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java index 8c8dfca83..bb1640d33 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java @@ -26,14 +26,15 @@ package com.plotsquared.bukkit.uuid; import com.google.common.util.concurrent.RateLimiter; -import com.plotsquared.core.PlotSquared; -import com.plotsquared.core.configuration.Captions; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDService; import com.sk89q.squirrelid.Profile; import com.sk89q.squirrelid.resolver.HttpRepositoryService; import com.sk89q.squirrelid.resolver.ProfileService; import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; @@ -47,6 +48,8 @@ import java.util.UUID; @SuppressWarnings("UnstableApiUsage") public class SquirrelIdUUIDService implements UUIDService { + private static final Logger logger = LoggerFactory.getLogger("P2/" + SquirrelIdUUIDService.class.getSimpleName()); + private final ProfileService profileService; private final RateLimiter rateLimiter; @@ -78,7 +81,9 @@ public class SquirrelIdUUIDService implements UUIDService { // go through them one by one // if (uuids.size() >= 2) { - PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID in batch. Will try each UUID individually."); + if (Settings.DEBUG) { + logger.info("[P2] (UUID) Found invalid UUID in batch. Will try each UUID individually."); + } for (final UUID uuid : uuids) { final List result = this.getNames(Collections.singletonList(uuid)); if (result.isEmpty()) { @@ -86,8 +91,8 @@ public class SquirrelIdUUIDService implements UUIDService { } results.add(result.get(0)); } - } else if (uuids.size() == 1) { - PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID: " + uuids.get(0)); + } else if (uuids.size() == 1 && Settings.DEBUG) { + logger.info("[P2] (UUID) Found invalid UUID: {}", uuids.get(0)); } } } catch (IOException | InterruptedException e) { diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 25e62db2a..d5618ed0f 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -1716,18 +1716,8 @@ public class PlotSquared { } catch (IOException ignored) { logger.error("[P2] Failed to save storage.yml"); } - try { - this.commandsFile = new File(folder, "commands.yml"); - if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) { - logger.error("[P2] Could not create the commands file. Please create 'commands.yml' manually"); - } - this.commands = YamlConfiguration.loadConfiguration(this.commandsFile); - } catch (IOException ignored) { - logger.error("[P2] Failed to save commands.yml"); - } try { this.style.save(this.styleFile); - this.commands.save(this.commandsFile); } catch (IOException e) { logger.error("[P2] Configuration file saving failed", e); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java index d2e0d3fda..25230ab89 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -408,7 +408,8 @@ public abstract class PlotArea { prefix = ", "; } } - PlotSquared.log(Captions.PREFIX + "&3 - road flags: &7" + roadFlagBuilder.toString()); + + logger.info("[P2] - road flags: {}", roadFlagBuilder.toString()); loadConfiguration(config); }