From 6664d49928a8ee9da8bfcb873c1e32a0b8300b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Mon, 13 Jul 2020 23:04:27 +0200 Subject: [PATCH] Prefix all log messages --- .../com/plotsquared/bukkit/BukkitMain.java | 49 +++--- .../entity/ReplicatingEntityWrapper.java | 4 +- .../plotsquared/bukkit/util/BukkitUtil.java | 4 +- .../plotsquared/bukkit/util/ContentMap.java | 2 +- .../bukkit/util/UpdateUtility.java | 10 +- .../com/plotsquared/core/PlotSquared.java | 120 +++++++------- .../com/plotsquared/core/command/Debug.java | 8 +- .../plotsquared/core/command/DebugExec.java | 4 +- .../com/plotsquared/core/command/Purge.java | 6 +- .../com/plotsquared/core/command/Trim.java | 8 +- .../components/ComponentPresetManager.java | 6 +- .../core/configuration/Config.java | 6 +- .../configuration/file/YamlConfiguration.java | 8 +- .../plotsquared/core/database/SQLManager.java | 150 +++++++++--------- .../com/plotsquared/core/database/SQLite.java | 2 +- .../core/generator/HybridPlotWorld.java | 10 +- .../core/generator/HybridUtils.java | 16 +- .../core/generator/SquarePlotWorld.java | 2 +- .../plotsquared/core/player/PlotPlayer.java | 2 +- .../java/com/plotsquared/core/plot/Plot.java | 4 +- .../com/plotsquared/core/plot/PlotArea.java | 2 +- .../core/plot/expiration/PlotAnalysis.java | 48 +++--- .../core/plot/flag/FlagContainer.java | 2 +- .../plot/flag/types/BlockTypeWrapper.java | 2 +- .../core/plot/message/PlotMessage.java | 2 +- .../com/plotsquared/core/util/Expression.java | 2 +- .../com/plotsquared/core/util/MainUtil.java | 2 +- .../plotsquared/core/util/RegionManager.java | 2 +- .../core/util/SchematicHandler.java | 2 +- .../core/util/net/IncendoPaster.java | 2 +- .../plotsquared/core/uuid/UUIDPipeline.java | 8 +- 31 files changed, 247 insertions(+), 248 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index ca3406018..85c3bc5b5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -225,12 +225,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } if (PremiumVerification.isPremium()) { - logger.info("PlotSquared version licensed to Spigot user {}", getUserID()); - logger.info("https://www.spigotmc.org/resources/{}", getResourceID()); - logger.info("Download ID: {}", getDownloadID()); - logger.info("Thanks for supporting us :)"); + logger.info("[P2] PlotSquared version licensed to Spigot user {}", getUserID()); + logger.info("[P2] https://www.spigotmc.org/resources/{}", getResourceID()); + logger.info("[P2] Download ID: {}", getDownloadID()); + logger.info("[P2] Thanks for supporting us :)"); } else { - logger.info("Couldn't verify purchase :("); + logger.info("[P2] Couldn't verify purchase :("); } final UUIDPipeline impromptuPipeline = PlotSquared.get().getImpromptuUUIDPipeline(); @@ -250,7 +250,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService(); impromptuPipeline.registerService(offlineModeUUIDService); backgroundPipeline.registerService(offlineModeUUIDService); - logger.info("(UUID) Using the offline mode UUID service"); + logger.info("[P2] (UUID) Using the offline mode UUID service"); } final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService(); @@ -270,7 +270,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final LuckPermsUUIDService luckPermsUUIDService; if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) { luckPermsUUIDService = new LuckPermsUUIDService(); - logger.info("(UUID) Using LuckPerms as a complementary UUID service"); + logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service"); } else { luckPermsUUIDService = null; } @@ -278,7 +278,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final BungeePermsUUIDService bungeePermsUUIDService; if (Bukkit.getPluginManager().getPlugin("BungeePerms") != null) { bungeePermsUUIDService = new BungeePermsUUIDService(); - logger.info("(UUID) Using BungeePerms as a complementary UUID service"); + logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service"); } else { bungeePermsUUIDService = null; } @@ -286,7 +286,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final EssentialsUUIDService essentialsUUIDService; if (Bukkit.getPluginManager().getPlugin("Essentials") != null) { essentialsUUIDService = new EssentialsUUIDService(); - logger.info("(UUID) Using Essentials as a complementary UUID service"); + logger.info("[P2] (UUID) Using Essentials as a complementary UUID service"); } else { essentialsUUIDService = null; } @@ -297,7 +297,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final PaperUUIDService paperUUIDService = new PaperUUIDService(); impromptuPipeline.registerService(paperUUIDService); backgroundPipeline.registerService(paperUUIDService); - logger.info("(UUID) Using Paper as a complementary UUID service"); + logger.info("[P2] (UUID) Using Paper as a complementary UUID service"); } impromptuPipeline.registerService(sqLiteUUIDService); @@ -350,9 +350,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) { ChatFormatter.formatters.add(new PlaceholderFormatter()); } - logger.info("PlotSquared hooked into PlaceholderAPI"); + logger.info("[P2] PlotSquared hooked into PlaceholderAPI"); } else { - logger.info("PlaceholderAPI is not in use. Hook deactivated"); + logger.info("[P2] PlaceholderAPI is not in use. Hook deactivated"); } this.startMetrics(); @@ -368,8 +368,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< try { this.backupManager = new SimpleBackupManager(); } catch (final Exception e) { - logger.error("Failed to initialize backup manager", e); - logger.error("Backup features will be disabled"); + logger.error("[P2] Failed to initialize backup manager", e); + logger.error("[P2] Backup features will be disabled"); this.backupManager = new NullBackupManager(); } @@ -381,7 +381,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< this.worldManager = new BukkitWorldManager(); } - logger.info("Using platform world manager: {}", this.worldManager.getName()); + logger.info("[P2] Using platform world manager: {}", this.worldManager.getName()); // Clean up potential memory leak Bukkit.getScheduler().runTaskTimer(this, () -> { @@ -442,7 +442,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< final Chunk[] chunks = world.getLoadedChunks(); if (chunks.length == 0) { if (!Bukkit.unloadWorld(world, true)) { - logger.warn("Failed to unload {}", world.getName()); + logger.warn("[P2] Failed to unload {}", world.getName()); } return; } else { @@ -493,7 +493,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } }); - logger.info("(UUID) {} UUIDs will be cached", uuidQueue.size()); + logger.info("[P2] (UUID) {} UUIDs will be cached", uuidQueue.size()); Executors.newSingleThreadScheduledExecutor().schedule(() -> { // Begin by reading all the SQLite cache at once @@ -501,7 +501,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< // Now fetch names for all known UUIDs final int totalSize = uuidQueue.size(); int read = 0; - logger.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT); + logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT); final List uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT); // Used to indicate that the second retrieval has been attempted @@ -509,7 +509,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) { if (!uuidList.isEmpty() && secondRun) { - logger.warn("(UUID) Giving up on last batch. Fetching new batch instead"); + logger.warn("[P2] (UUID) Giving up on last batch. Fetching new batch instead"); uuidList.clear(); } if (uuidList.isEmpty()) { @@ -534,14 +534,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< // Print progress final double percentage = ((double) read / (double) totalSize) * 100.0D; if (Settings.DEBUG) { - logger.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage)); + logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage)); } } catch (final InterruptedException | ExecutionException e) { - logger.error("(UUID) Failed to retrieve last batch. Will try again", e); - e.printStackTrace(); + logger.error("[P2] (UUID) Failed to retrieve last batch. Will try again", e); } } - logger.info("(UUID) PlotSquared has cached all UUIDs"); + logger.info("[P2] (UUID) PlotSquared has cached all UUIDs"); }, 10, TimeUnit.SECONDS); } @@ -603,7 +602,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< } @Override @SuppressWarnings("deprecation") public void runEntityTask() { - logger.info("KillAllEntities started"); + logger.info("[P2] KillAllEntities started"); TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> { final World world = Bukkit.getWorld(plotArea.getWorldName()); try { @@ -1013,7 +1012,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain< SetGenCB.setGenerator(BukkitUtil.getWorld(worldName)); } } catch (final Exception e) { - logger.error("Failed to reload world: {} | {}", world, e.getMessage()); + logger.error("[P2] Failed to reload world: {} | {}", world, e.getMessage()); Bukkit.getServer().unloadWorld(world, false); return; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java index 253de36ae..11e653141 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/entity/ReplicatingEntityWrapper.java @@ -388,7 +388,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { try { entity.getInventory().setContents(this.inventory); } catch (IllegalArgumentException e) { - logger.error("Failed to restore inventory", e); + logger.error("[P2] Failed to restore inventory", e); } } @@ -732,7 +732,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { return entity; default: if (Settings.DEBUG) { - logger.info("Could not identify entity: {}", entity.getType()); + logger.info("[P2] Could not identify entity: {}", entity.getType()); } return entity; // END LIVING diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index 286458614..c72d40b0e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -508,7 +508,7 @@ public class BukkitUtil extends WorldUtil { @NonNull final BiomeType biomeType) { final World world = getWorld(worldName); if (world == null) { - logger.warn("An error occured while setting the biome because the world was null", new RuntimeException()); + logger.warn("[P2] An error occured while setting the biome because the world was null", new RuntimeException()); return; } final Biome biome = BukkitAdapter.adapt(biomeType); @@ -622,7 +622,7 @@ public class BukkitUtil extends WorldUtil { } break; default: { - logger.error("Unknown entity category requested: {}", category); + logger.error("[P2] Unknown entity category requested: {}", category); } break; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java index 78d941808..47d6d23ec 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/ContentMap.java @@ -126,7 +126,7 @@ public class ContentMap { try { entity.spawn(world, xOffset, zOffset); } catch (Exception e) { - logger.error("Failed to restore entity", e); + logger.error("[P2] Failed to restore entity", e); } } this.entities.clear(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java index c28fe8740..88594abd5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/UpdateUtility.java @@ -71,22 +71,22 @@ public class UpdateUtility implements Listener { .getAsJsonObject(); spigotVersion = result.get("current_version").getAsString(); } catch (IOException e) { - logger.error("Unable to check for updates. Error: {}", e.getMessage()); + logger.error("[P2] Unable to check for updates. Error: {}", e.getMessage()); return; } if (internalVersion.isLaterVersion(spigotVersion)) { - logger.info("There appears to be a PlotSquared update available!"); - logger.info("You are running version {}, the latest version is {}", + logger.info("[P2] There appears to be a PlotSquared update available!"); + logger.info("[P2] You are running version {}, the latest version is {}", internalVersion.versionString(), spigotVersion); - logger.info("https://www.spigotmc.org/resources/77506/updates"); + logger.info("[P2] https://www.spigotmc.org/resources/77506/updates"); hasUpdate = true; if (Settings.UpdateChecker.NOTIFY_ONCE) { cancelTask(); } } else if (notify) { notify = false; - logger.info("Congratulations! You are running the latest PlotSquared version"); + logger.info("[P2] Congratulations! You are running the latest PlotSquared version"); } }, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20); } diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 4c50026e4..b213460be 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -237,7 +237,7 @@ public class PlotSquared { if (!getConfigurationVersion().equalsIgnoreCase("v5")) { // Perform upgrade if (DBFunc.dbManager.convertFlags()) { - logger.info("Flags were converted successfully"); + logger.info("[P2] Flags were converted successfully"); // Update the config version setConfigurationVersion("v5"); } @@ -285,7 +285,7 @@ public class PlotSquared { if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { if (this.IMP.initWorldEdit()) { - logger.info("{} hooked into WorldEdit", imp().getPluginName()); + logger.info("[P2] {} hooked into WorldEdit", imp().getPluginName()); this.worldedit = WorldEdit.getInstance(); WorldEdit.getInstance().getEventBus().register(new WESubscriber()); if (Settings.Enabled_Components.COMMANDS) { @@ -294,7 +294,7 @@ public class PlotSquared { } } catch (Throwable e) { - logger.error("Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); + logger.error("[P2] Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); } } @@ -308,7 +308,7 @@ public class PlotSquared { try { new ComponentPresetManager(); } catch (final Exception e) { - logger.error("Failed to initialize the preset system", e); + logger.error("[P2] Failed to initialize the preset system", e); } } @@ -329,11 +329,11 @@ public class PlotSquared { continue; } if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) { - logger.warn("`{}` was not properly loaded - {} will now try to load it properly", + logger.warn("[P2] `{}` was not properly loaded - {} will now try to load it properly", world, imp().getPluginName()); - logger.warn(" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); - logger.warn(" - Your world management plugin may be faulty (or non existent)"); - logger.warn(" This message may also be a false positive and could be ignored."); + logger.warn("[P2] - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); + logger.warn("[P2] - Your world management plugin may be faulty (or non existent)"); + logger.warn("[P2] This message may also be a false positive and could be ignored."); PlotSquared.this.IMP.setGenerator(world); } } @@ -509,16 +509,16 @@ public class PlotSquared { regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1]))); chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1]))); int height = (int) list.get(2); - logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height); - logger.info(" - Regions: {}", regions.size()); - logger.info(" - Chunks: {}", chunks.size()); + logger.info("[P2] Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height); + logger.info("[P2] - Regions: {}", regions.size()); + logger.info("[P2] - Chunks: {}", chunks.size()); HybridUtils.UPDATE = true; HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks); } catch (IOException | ClassNotFoundException e) { - logger.error("Error restarting road regeneration", e); + logger.error("[P2] Error restarting road regeneration", e); } finally { if (!file.delete()) { - logger.error("Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId()); + logger.error("[P2] Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId()); } } }); @@ -1105,10 +1105,10 @@ public class PlotSquared { // Conventional plot generator PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null); PlotManager plotManager = plotArea.getPlotManager(); - logger.info("Detected world load for '{}'", world); - logger.info(" - generator: {}>{}", baseGenerator, plotGenerator); - logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName()); - logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName()); + logger.info("[P2] Detected world load for '{}'", world); + logger.info("[P2] - generator: {}>{}", baseGenerator, plotGenerator); + logger.info("[P2] - plot world: {}", plotArea.getClass().getCanonicalName()); + logger.info("[P2] - plot area manager: {}", plotManager.getClass().getCanonicalName()); if (!this.worlds.contains(path)) { this.worlds.createSection(path); worldSection = this.worlds.getConfigurationSection(path); @@ -1132,7 +1132,7 @@ public class PlotSquared { if (plotAreaManager.getPlotAreas(world, null).length != 0) { return; } - logger.info("Detected world load for '{}'", world); + logger.info("[P2] Detected world load for '{}'", world); String gen_string = worldSection.getString("generator.plugin", IMP.getPluginName()); if (type == PlotAreaType.PARTIAL) { Set clusters = @@ -1148,7 +1148,7 @@ public class PlotSquared { String fullId = name + "-" + pos1 + "-" + pos2; worldSection.createSection("areas." + fullId); DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE - logger.info(" - {}-{}-{}", name, pos1, pos2); + logger.info("[P2] - {}-{}-{}", name, pos1, pos2); GeneratorWrapper areaGen = this.IMP.getGenerator(world, gen_string); if (areaGen == null) { throw new IllegalArgumentException("Invalid Generator: " + gen_string); @@ -1162,10 +1162,10 @@ public class PlotSquared { } catch (IOException e) { e.printStackTrace(); } - logger.info(" | generator: {}>{}", baseGenerator, areaGen); - logger.info(" | plot world: {}", pa); - logger.info(" | manager: {}", pa); - logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name); + logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen); + logger.info("[P2] | plot world: {}", pa); + logger.info("[P2] | manager: {}", pa); + logger.info("[P2] Note: Area created for cluster '{}' (invalid or old configuration?)", name); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); toLoad.add(pa); @@ -1187,9 +1187,9 @@ public class PlotSquared { } catch (IOException e) { e.printStackTrace(); } - logger.info(" - generator: {}>{}", baseGenerator, areaGen); - logger.info(" - plot world: {}", pa); - logger.info(" - plot area manager: {}", pa.getPlotManager()); + logger.info("[P2] - generator: {}>{}", baseGenerator, areaGen); + logger.info("[P2] - plot world: {}", pa); + logger.info("[P2] - plot area manager: {}", pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1201,7 +1201,7 @@ public class PlotSquared { + PlotAreaType.AUGMENTED + "`"); } for (String areaId : areasSection.getKeys(false)) { - logger.info(" - {}", areaId); + logger.info("[P2] - {}", areaId); String[] split = areaId.split("(?<=[^;-])-"); if (split.length != 3) { throw new IllegalArgumentException("Invalid Area identifier: " + areaId @@ -1263,10 +1263,10 @@ public class PlotSquared { } catch (IOException e) { e.printStackTrace(); } - logger.info("Detected area load for '{}'", world); - logger.info(" | generator: {}>{}", baseGenerator, areaGen); - logger.info(" | plot world: {}", pa); - logger.info(" | manager: {}", pa.getPlotManager()); + logger.info("[P2] Detected area load for '{}'", world); + logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen); + logger.info("[P2] | plot world: {}", pa); + logger.info("[P2] | manager: {}", pa.getPlotManager()); areaGen.getPlotGenerator().initialize(pa); areaGen.augment(pa); addPlotArea(pa); @@ -1335,7 +1335,7 @@ public class PlotSquared { for (String element : split) { String[] pair = element.split("="); if (pair.length != 2) { - logger.error("No value provided for '{}'", element); + logger.error("[P2] No value provided for '{}'", element); return false; } String key = pair[0].toLowerCase(); @@ -1383,11 +1383,11 @@ public class PlotSquared { ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()); break; default: - logger.error("Key not found: {}", element); + logger.error("[P2] Key not found: {}", element); return false; } } catch (Exception e) { - logger.error("Invalid value '{}' for arg '{}'", value, element); + logger.error("[P2] Invalid value '{}' for arg '{}'", value, element); e.printStackTrace(); return false; } @@ -1466,7 +1466,7 @@ public class PlotSquared { } } } catch (IOException e) { - logger.error("Could not save {}", file); + logger.error("[P2] Could not save {}", file); e.printStackTrace(); } } @@ -1502,7 +1502,7 @@ public class PlotSquared { // Close the connection DBFunc.close(); } catch (NullPointerException throwable) { - logger.error("Could not close database connection", throwable); + logger.error("[P2] Could not close database connection", throwable); throwable.printStackTrace(); } } @@ -1515,9 +1515,9 @@ public class PlotSquared { HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) { return; } - logger.info("Road regeneration incomplete. Saving incomplete regions to disk"); - logger.info(" - regions: {}", HybridUtils.regions.size()); - logger.info(" - chunks: {}", HybridUtils.chunks.size()); + logger.info("[P2] Road regeneration incomplete. Saving incomplete regions to disk"); + logger.info("[P2] - regions: {}", HybridUtils.regions.size()); + logger.info("[P2] - chunks: {}", HybridUtils.chunks.size()); ArrayList regions = new ArrayList<>(); ArrayList chunks = new ArrayList<>(); for (BlockVector2 r : HybridUtils.regions) { @@ -1534,14 +1534,14 @@ public class PlotSquared { this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area .getId() + "_" + HybridUtils.area.getWorldName()); if (file.exists() && !file.delete()) { - logger.error("persistent_regene_data file already exists and could not be deleted"); + logger.error("[P2] persistent_regene_data file already exists and could not be deleted"); return; } try (ObjectOutputStream oos = new ObjectOutputStream( Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) { oos.writeObject(list); } catch (IOException e) { - logger.error("Error creating persistent_region_data file", e); + logger.error("[P2] Error creating persistent_region_data file", e); } } @@ -1561,7 +1561,7 @@ public class PlotSquared { File file = MainUtil.getFile(IMP.getDirectory(), Storage.SQLite.DB + ".db"); database = new SQLite(file); } else { - logger.error("No storage type is set. Disabling PlotSquared"); + logger.error("[P2] No storage type is set. Disabling PlotSquared"); this.IMP.shutdown(); //shutdown used instead of disable because no database is set return; } @@ -1579,11 +1579,11 @@ public class PlotSquared { } this.clusters_tmp = DBFunc.getClusters(); } catch (ClassNotFoundException | SQLException e) { - logger.error("Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite"); - logger.error("==== Here is an ugly stacktrace, if you are interested in those things ==="); + logger.error("[P2] Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite"); + logger.error("[P2] ==== Here is an ugly stacktrace, if you are interested in those things ==="); e.printStackTrace(); - logger.error("&d==== End of stacktrace ===="); - logger.error("&6Please go to the {} 'storage.yml' and configure the database correctly", + logger.error("[P2] &d==== End of stacktrace ===="); + logger.error("[P2] &6Please go to the {} 'storage.yml' and configure the database correctly", imp().getPluginName()); this.IMP.shutdown(); //shutdown used instead of disable because of database error } @@ -1609,7 +1609,7 @@ public class PlotSquared { try { worlds.save(worldsFile); } catch (IOException e) { - logger.error("Failed to save worlds.yml", e); + logger.error("[P2] Failed to save worlds.yml", e); e.printStackTrace(); } } @@ -1642,12 +1642,12 @@ public class PlotSquared { public boolean setupConfigs() { File folder = new File(this.IMP.getDirectory(), "config"); if (!folder.exists() && !folder.mkdirs()) { - logger.error("Failed to create the /plugins/config folder. Please create it manually"); + logger.error("[P2] Failed to create the /plugins/config folder. Please create it manually"); } try { this.worldsFile = new File(folder, "worlds.yml"); if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) { - logger.error("Could not create the worlds file. Please create 'worlds.yml' manually"); + logger.error("[P2] Could not create the worlds file. Please create 'worlds.yml' manually"); } this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile); @@ -1680,17 +1680,17 @@ public class PlotSquared { this.worlds.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION); } } catch (IOException ignored) { - logger.error("Failed to save worlds.yml"); + logger.error("[P2] Failed to save worlds.yml"); } try { this.configFile = new File(folder, "settings.yml"); if (!this.configFile.exists() && !this.configFile.createNewFile()) { - logger.error("Could not create the settings file. Please create 'settings.yml' manually"); + logger.error("[P2] Could not create the settings file. Please create 'settings.yml' manually"); } this.config = YamlConfiguration.loadConfiguration(this.configFile); setupConfig(); } catch (IOException ignored) { - logger.error("Failed to save settings.yml"); + logger.error("[P2] Failed to save settings.yml"); } try { this.styleFile = MainUtil.getFile(IMP.getDirectory(), @@ -1700,38 +1700,38 @@ public class PlotSquared { this.styleFile.getParentFile().mkdirs(); } if (!this.styleFile.createNewFile()) { - logger.error("Failed to create the style file. Please create 'translations/style.yml' manually"); + logger.error("[P2] Failed to create the style file. Please create 'translations/style.yml' manually"); } } this.style = YamlConfiguration.loadConfiguration(this.styleFile); setupStyle(); } catch (IOException ignored) { - logger.error("Failed to save style.yml"); + logger.error("[P2] Failed to save style.yml"); } try { this.storageFile = new File(folder, "storage.yml"); if (!this.storageFile.exists() && !this.storageFile.createNewFile()) { - logger.error("Could not create the storage settings file. Please create 'storage.yml' manually"); + logger.error("[P2] Could not create the storage settings file. Please create 'storage.yml' manually"); } this.storage = YamlConfiguration.loadConfiguration(this.storageFile); setupStorage(); } catch (IOException ignored) { - logger.error("Failed to save storage.yml"); + 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("Could not create the commands file. Please create 'commands.yml' manually"); + 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("Failed to save commands.yml"); + logger.error("[P2] Failed to save commands.yml"); } try { this.style.save(this.styleFile); this.commands.save(this.commandsFile); } catch (IOException e) { - logger.error("Configuration file saving failed", e); + logger.error("[P2] Configuration file saving failed", e); } return true; } @@ -1762,7 +1762,7 @@ public class PlotSquared { if (Settings.DEBUG) { Map components = Settings.getFields(Settings.Enabled_Components.class); for (Entry component : components.entrySet()) { - logger.info("Key: {} | Value: {}", component.getKey(), component.getValue()); + logger.info("[P2] Key: {} | Value: {}", component.getKey(), component.getValue()); } } } diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java index c395f09d8..cff10feeb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -84,10 +84,10 @@ public class Debug extends SubCommand { return true; } if (args.length > 0 && "logging".equalsIgnoreCase(args[0])) { - logger.info("Info!"); - logger.warn("Warning!"); - logger.error("Error!", new RuntimeException()); - logger.debug("Debug!"); + logger.info("[P2] Info!"); + logger.warn("[P2] Warning!"); + logger.error("[P2] Error!", new RuntimeException()); + logger.debug("[P2] Debug!"); return true; } if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) { diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index 842d403b7..52bb92069 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -463,12 +463,12 @@ public class DebugExec extends SubCommand { } catch (ScriptException e) { e.printStackTrace(); } - logger.info("> {}ms -> {}", System.currentTimeMillis() - start, result); + logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result); }); } else { long start = System.currentTimeMillis(); Object result = this.engine.eval(script, this.scope); - logger.info("> {}ms -> {}", System.currentTimeMillis() - start, result); + logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result); } return true; } catch (ScriptException e) { diff --git a/Core/src/main/java/com/plotsquared/core/command/Purge.java b/Core/src/main/java/com/plotsquared/core/command/Purge.java index 7d714a224..7056bd836 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Purge.java +++ b/Core/src/main/java/com/plotsquared/core/command/Purge.java @@ -175,7 +175,7 @@ public class Purge extends SubCommand { boolean finalClear = clear; Runnable run = () -> { if (Settings.DEBUG) { - logger.info("Calculating plots to purge, please wait..."); + logger.info("[P2] Calculating plots to purge, please wait..."); } HashSet ids = new HashSet<>(); Iterator iterator = toDelete.iterator(); @@ -191,7 +191,7 @@ public class Purge extends SubCommand { if (finalClear) { plot.clear(false, true, () -> { if (Settings.DEBUG) { - logger.info("Plot {} cleared by purge", plot.getId()); + logger.info("[P2] Plot {} cleared by purge", plot.getId()); } }); } else { @@ -202,7 +202,7 @@ public class Purge extends SubCommand { PlotListener.plotEntry(pp, plot); } } catch (NullPointerException e) { - logger.error("NullPointer during purge detected. This is likely" + logger.error("[P2] NullPointer during purge detected. This is likely" + " because you are deleting a world that has been removed", e); } } diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java index cd8e14434..e7444face 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -181,15 +181,15 @@ public class Trim extends SubCommand { @Override public void run(Set viable, final Set nonViable) { Runnable regenTask; if (regen) { - logger.info("Starting regen task"); - logger.info(" - This is a VERY slow command"); - logger.info(" - It will say 'Trim done!' when complete"); + logger.info("[P2] Starting regen task"); + logger.info("[P2] - This is a VERY slow command"); + logger.info("[P2] - It will say 'Trim done!' when complete"); regenTask = new Runnable() { @Override public void run() { if (nonViable.isEmpty()) { Trim.TASK = false; player.sendMessage("Trim done!"); - logger.info("Trim done!"); + logger.info("[P2] Trim done!"); return; } Iterator iterator = nonViable.iterator(); diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index 76b4d8ab2..a3b2f76e4 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -74,7 +74,7 @@ public class ComponentPresetManager { e.printStackTrace(); } if (!created) { - logger.error("Failed to create components.yml"); + logger.error("[P2] Failed to create components.yml"); this.guiName = "&cInvalid!"; this.presets = new ArrayList<>(); return; @@ -90,7 +90,7 @@ public class ComponentPresetManager { try { yamlConfiguration.save(file); } catch (IOException e) { - logger.error("Failed to save default values to components.yml", e); + logger.error("[P2] Failed to save default values to components.yml", e); } } this.guiName = yamlConfiguration.getString("title", "&6Plot Components"); @@ -108,7 +108,7 @@ public class ComponentPresetManager { try { yamlConfiguration.save(file); } catch (final IOException e) { - logger.error("Failed to save default values to components.yml", e); + logger.error("[P2] Failed to save default values to components.yml", e); } this.presets = defaultPreset; } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Config.java b/Core/src/main/java/com/plotsquared/core/configuration/Config.java index 3f75eb56f..3995ff964 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Config.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Config.java @@ -98,12 +98,12 @@ public class Config { field.set(instance, value); return; } catch (final Throwable e) { - logger.error("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName()); + logger.error("[P2] Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName()); e.printStackTrace(); } } } - logger.error("Failed to set config option '{}: {}' | {}", key, value, instance); + logger.error("[P2] Failed to set config option '{}: {}' | {}", key, value, instance); } public static boolean load(File file, Class root) { @@ -289,7 +289,7 @@ public class Config { setAccessible(field); return field; } catch (final Throwable e) { - logger.error("Invalid config field: {} for {}", + logger.error("[P2] Invalid config field: {} for {}", StringMan.join(split, "."), toNodeName(instance.getClass().getSimpleName())); e.printStackTrace(); return null; diff --git a/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java b/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java index 027ee7d4c..3008ca451 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/file/YamlConfiguration.java @@ -82,11 +82,11 @@ public class YamlConfiguration extends FileConfiguration { } Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); if (Settings.DEBUG) { - logger.error("Could not read: {}", file); - logger.error("Renamed to: {}", file); - logger.error("============ Full stacktrace ============"); + logger.error("[P2] Could not read: {}", file); + logger.error("[P2] Renamed to: {}", file); + logger.error("[P2] ============ Full stacktrace ============"); ex.printStackTrace(); - logger.error("========================================="); + logger.error("[P2] ========================================="); } } catch (IOException e) { e.printStackTrace(); diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index c2a363d6b..be9758fb5 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -358,12 +358,12 @@ public class SQLManager implements AbstractDB { try { task.run(); } catch (Throwable e) { - logger.error("============ DATABASE ERROR ============"); - logger.error("============ DATABASE ERROR ============"); - logger.error("There was an error updating the database."); - logger.error(" - It will be corrected on shutdown"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] There was an error updating the database."); + logger.error("[P2] - It will be corrected on shutdown"); e.printStackTrace(); - logger.error("========================================"); + logger.error("[P2] ========================================"); } } commit(); @@ -413,12 +413,12 @@ public class SQLManager implements AbstractDB { } lastTask = task; } catch (Throwable e) { - logger.error("============ DATABASE ERROR ============"); - logger.error("There was an error updating the database."); - logger.error(" - It will be corrected on shutdown"); - logger.error("========================================"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] There was an error updating the database."); + logger.error("[P2] - It will be corrected on shutdown"); + logger.error("[P2] ========================================"); e.printStackTrace(); - logger.error("========================================"); + logger.error("[P2] ========================================"); } } if (statement != null && task != null) { @@ -458,12 +458,12 @@ public class SQLManager implements AbstractDB { } lastTask = task; } catch (Throwable e) { - logger.error("============ DATABASE ERROR ============"); - logger.error("There was an error updating the database."); - logger.error(" - It will be corrected on shutdown"); - logger.error("========================================"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] There was an error updating the database."); + logger.error("[P2] - It will be corrected on shutdown"); + logger.error("[P2] ========================================"); e.printStackTrace(); - logger.error("========================================"); + logger.error("[P2] ========================================"); } } if (statement != null && task != null) { @@ -504,12 +504,12 @@ public class SQLManager implements AbstractDB { } lastTask = task; } catch (Throwable e) { - logger.error("============ DATABASE ERROR ============"); - logger.error("There was an error updating the database."); - logger.error(" - It will be corrected on shutdown"); - logger.error("========================================"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] There was an error updating the database."); + logger.error("[P2] - It will be corrected on shutdown"); + logger.error("[P2] ========================================"); e.printStackTrace(); - logger.error("========================================"); + logger.error("[P2] ========================================"); } } if (statement != null && task != null) { @@ -533,12 +533,12 @@ public class SQLManager implements AbstractDB { this.plotTasks.clear(); } } catch (Throwable e) { - logger.error("============ DATABASE ERROR ============"); - logger.error("There was an error updating the database."); - logger.error(" - It will be corrected on shutdown"); - logger.error("========================================"); + logger.error("[P2] ============ DATABASE ERROR ============"); + logger.error("[P2] There was an error updating the database."); + logger.error("[P2] - It will be corrected on shutdown"); + logger.error("[P2] ========================================"); e.printStackTrace(); - logger.error("========================================"); + logger.error("[P2] ========================================"); } return false; } @@ -626,7 +626,7 @@ public class SQLManager implements AbstractDB { } }))))); } catch (SQLException e) { - logger.warn("Failed to set all flags and member tiers for plots", e); + logger.warn("[P2] Failed to set all flags and member tiers for plots", e); try { SQLManager.this.connection.commit(); } catch (SQLException e1) { @@ -635,7 +635,7 @@ public class SQLManager implements AbstractDB { } }); } catch (Exception e) { - logger.warn("Warning! Failed to set all helper for plots", e); + logger.warn("[P2] Warning! Failed to set all helper for plots", e); try { SQLManager.this.connection.commit(); } catch (SQLException e1) { @@ -704,19 +704,19 @@ public class SQLManager implements AbstractDB { try { preparedStatement.executeBatch(); } catch (final Exception e) { - logger.error("Failed to store flag values for plot with entry ID: {}", plot); + logger.error("[P2] Failed to store flag values for plot with entry ID: {}", plot); e.printStackTrace(); continue; } if (Settings.DEBUG) { - logger.info("- Finished converting flag values for plot with entry ID: {}", + logger.info("[P2] - Finished converting flag values for plot with entry ID: {}", plot.getId()); } } } catch (final Exception e) { - logger.error("Failed to store flag values", e); + logger.error("[P2] Failed to store flag values", e); } - logger.info("Finished converting flags ({} plots processed)", plots.size()); + logger.info("[P2] Finished converting flags ({} plots processed)", plots.size()); whenDone.run(); } @@ -833,7 +833,7 @@ public class SQLManager implements AbstractDB { return; } catch (SQLException e) { if (this.mySQL) { - logger.error("1: | {}", objList.get(0).getClass().getCanonicalName()); + logger.error("[P2] 1: | {}", objList.get(0).getClass().getCanonicalName()); e.printStackTrace(); } } @@ -871,8 +871,8 @@ public class SQLManager implements AbstractDB { preparedStmt.close(); } catch (SQLException e) { e.printStackTrace(); - logger.error("2: | {}", objList.get(0).getClass().getCanonicalName()); - logger.error("Could not bulk save!"); + logger.error("[P2] 2: | {}", objList.get(0).getClass().getCanonicalName()); + logger.error("[P2] Could not bulk save!"); try (PreparedStatement preparedStmt = this.connection .prepareStatement(mod.getCreateSQL())) { for (T obj : objList) { @@ -881,7 +881,7 @@ public class SQLManager implements AbstractDB { } preparedStmt.executeBatch(); } catch (SQLException e3) { - logger.error("Failed to save all", e); + logger.error("[P2] Failed to save all", e); e3.printStackTrace(); } } @@ -933,7 +933,7 @@ public class SQLManager implements AbstractDB { try { preparedStatement.executeBatch(); } catch (final Exception e) { - logger.error("Failed to store settings for plot with entry ID: {}", legacySettings.id); + logger.error("[P2] Failed to store settings for plot with entry ID: {}", legacySettings.id); e.printStackTrace(); continue; } @@ -945,13 +945,13 @@ public class SQLManager implements AbstractDB { try { preparedStatement.executeBatch(); } catch (final Exception e) { - logger.error("Failed to store settings", e); + logger.error("[P2] Failed to store settings", e); } } } catch (final Exception e) { - logger.error("Failed to store settings", e); + logger.error("[P2] Failed to store settings", e); } - logger.info("Finished converting settihgs ({} plots processed)", myList.size()); + logger.info("[P2] Finished converting settihgs ({} plots processed)", myList.size()); whenDone.run(); } @@ -1632,11 +1632,11 @@ public class SQLManager implements AbstractDB { } } } catch (final Exception e) { - logger.error("Failed to load old flag values", e); + logger.error("[P2] Failed to load old flag values", e); return false; } - logger.info("Loaded {} plot flag collections...", flagMap.size()); - logger.info("Attempting to store these flags in the new table..."); + logger.info("[P2] Loaded {} plot flag collections...", flagMap.size()); + logger.info("[P2] Attempting to store these flags in the new table..."); try (final PreparedStatement preparedStatement = this.connection.prepareStatement( "INSERT INTO `" + SQLManager.this.prefix + "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) { @@ -1664,7 +1664,7 @@ public class SQLManager implements AbstractDB { try { preparedStatement.executeBatch(); } catch (final Exception e) { - logger.error("Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey()); + logger.error("[P2] Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey()); e.printStackTrace(); continue; } @@ -1672,17 +1672,17 @@ public class SQLManager implements AbstractDB { if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap .size()) { timeStarted = System.currentTimeMillis(); - logger.info("... Flag conversion in progress. {}% done", + logger.info("[P2] ... Flag conversion in progress. {}% done", String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100)); } if (Settings.DEBUG) { - logger.info("- Finished converting flags for plot with entry ID: {}", + logger.info("[P2] - Finished converting flags for plot with entry ID: {}", plotFlagEntry.getKey()); } } } catch (final Exception e) { - logger.error("Failed to store flag values", e); + logger.error("[P2] Failed to store flag values", e); return false; } return true; @@ -1774,7 +1774,7 @@ public class SQLManager implements AbstractDB { time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable) .getTime(); } catch (ParseException e) { - logger.error("Could not parse date for plot: #{}({};{}) ({})", + logger.error("[P2] Could not parse date for plot: #{}({};{}) ({})", id, areaID, plot_id, parsable); time = System.currentTimeMillis() + id; } @@ -1789,7 +1789,7 @@ public class SQLManager implements AbstractDB { if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(last.temp); } else if (Settings.DEBUG) { - logger.info("Plot #{}({}) in `{}plot` is a duplicate." + logger.info("[P2] Plot #{}({}) in `{}plot` is a duplicate." + " Delete this plot or set `database-purger: true` in the settings.yml", id, last, this.prefix); } } @@ -1821,7 +1821,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_rating` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_rating` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -1849,7 +1849,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_helpers` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_helpers` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -1876,7 +1876,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_trusted` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_trusted` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -1903,7 +1903,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_denied` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_denied` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -1931,8 +1931,8 @@ public class SQLManager implements AbstractDB { plot.getFlagContainer().addFlag(plotFlag.parse(value)); } catch (final FlagParseException e) { e.printStackTrace(); - logger.error("Plot with ID {} has an invalid value:", id); - logger.error("Failed to parse flag '{}', value '{}': {}", + logger.error("[P2] Plot with ID {} has an invalid value:", id); + logger.error("[P2] Failed to parse flag '{}', value '{}': {}", plotFlag.getName(), e.getValue(), e.getErrorMessage()); if (!invalidFlags.containsKey(plot)) { invalidFlags.put(plot, new ArrayList<>()); @@ -1943,7 +1943,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_flags` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_flags` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -1999,7 +1999,7 @@ public class SQLManager implements AbstractDB { } else if (Settings.Enabled_Components.DATABASE_PURGER) { toDelete.add(id); } else if (Settings.DEBUG) { - logger.info("Entry #{}({}) in `plot_settings` does not exist." + logger.info("[P2] Entry #{}({}) in `plot_settings` does not exist." + " Create this plot or set `database-purger: true` in settings.yml", id, plot); } } @@ -2017,15 +2017,15 @@ public class SQLManager implements AbstractDB { String worldName = entry.getKey(); invalidPlot = true; if (Settings.DEBUG) { - logger.info("Warning! Found {} plots in DB for non existent world: '{}'", + logger.info("[P2] Warning! Found {} plots in DB for non existent world: '{}'", entry.getValue().intValue(), worldName); } } if (invalidPlot && Settings.DEBUG) { - logger.info("Warning! Please create the world(s) or remove the plots using the purge command"); + logger.info("[P2] Warning! Please create the world(s) or remove the plots using the purge command"); } } catch (SQLException e) { - logger.error("Failed to load plots", e); + logger.error("[P2] Failed to load plots", e); } return newPlots; } @@ -2066,7 +2066,7 @@ public class SQLManager implements AbstractDB { preparedStatement.setInt(3, id2); preparedStatement.execute(); } catch (final Exception e) { - logger.error("Failed to persist wap of {} and {}", plot1, plot2); + logger.error("[P2] Failed to persist wap of {} and {}", plot1, plot2); e.printStackTrace(); future.complete(false); return; @@ -2209,12 +2209,12 @@ public class SQLManager implements AbstractDB { commit(); } } catch (SQLException e) { - logger.error("Failed to purge plots", e); + logger.error("[P2] Failed to purge plots", e); return; } } if (Settings.DEBUG) { - logger.info("Successfully purged {} plots", uniqueIds.size()); + logger.info("[P2] Successfully purged {} plots", uniqueIds.size()); } } }); @@ -2238,7 +2238,7 @@ public class SQLManager implements AbstractDB { } purgeIds(ids); } catch (SQLException e) { - logger.error("Failed to purge area '{}'", area); + logger.error("[P2] Failed to purge area '{}'", area); e.printStackTrace(); } for (Iterator iterator = plots.iterator(); iterator.hasNext(); ) { @@ -2495,7 +2495,7 @@ public class SQLManager implements AbstractDB { } } } catch (SQLException e) { - logger.error("Failed to fetch rating for plot {}", plot.getId().toString()); + logger.error("[P2] Failed to fetch rating for plot {}", plot.getId().toString()); e.printStackTrace(); } return map; @@ -2716,7 +2716,7 @@ public class SQLManager implements AbstractDB { if (cluster != null) { cluster.helpers.add(user); } else if (Settings.DEBUG) { - logger.warn("Cluster #{}({}) in cluster_helpers does not exist." + logger.warn("[P2] Cluster #{}({}) in cluster_helpers does not exist." + " Please create the cluster or remove this entry", id, cluster); } } @@ -2735,7 +2735,7 @@ public class SQLManager implements AbstractDB { if (cluster != null) { cluster.invited.add(user); } else if (Settings.DEBUG) { - logger.warn("Cluster #{}({}) in cluster_helpers does not exist." + logger.warn("[P2] Cluster #{}({}) in cluster_helpers does not exist." + " Please create the cluster or remove this entry", id, cluster); } } @@ -2770,7 +2770,7 @@ public class SQLManager implements AbstractDB { } cluster.settings.setMerged(merged); } else if (Settings.DEBUG) { - logger.warn("Cluster #{}({}) in cluster_helpers does not exist." + logger.warn("[P2] Cluster #{}({}) in cluster_helpers does not exist." + " Please create the cluster or remove this entry", id, cluster); } } @@ -2780,13 +2780,13 @@ public class SQLManager implements AbstractDB { for (Entry entry : noExist.entrySet()) { String a = entry.getKey(); invalidPlot = true; - logger.warn("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a); + logger.warn("[P2] Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a); } if (invalidPlot) { - logger.warn("Warning! Please create the world(s) or remove the clusters using the purge command"); + logger.warn("[P2] Warning! Please create the world(s) or remove the clusters using the purge command"); } } catch (SQLException e) { - logger.error("Failed to load clusters", e); + logger.error("[P2] Failed to load clusters", e); } return newClusters; } @@ -2978,7 +2978,7 @@ public class SQLManager implements AbstractDB { if (!isValid()) { reconnect(); } - logger.info("All DB transactions during this session are being validated (This may take a while if corrections need to be made)"); + logger.info("[P2] All DB transactions during this session are being validated (This may take a while if corrections need to be made)"); commit(); while (true) { if (!sendBatch()) { @@ -2999,13 +2999,13 @@ public class SQLManager implements AbstractDB { continue; } if (plot.getArea() == null) { - logger.error("CRITICAL ERROR IN VALIDATION TASK!"); - logger.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!"); + logger.error("[P2] CRITICAL ERROR IN VALIDATION TASK!"); + logger.error("[P2] PLOT AREA CANNOT BE NULL! SKIPPING PLOT!"); continue; } if (database == null) { - logger.error("CRITICAL ERROR IN VALIDATION TASK!"); - logger.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!"); + logger.error("[P2] CRITICAL ERROR IN VALIDATION TASK!"); + logger.error("[P2] DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!"); break; } HashMap worldPlots = database.get(plot.getArea().toString()); diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLite.java b/Core/src/main/java/com/plotsquared/core/database/SQLite.java index fd9ba5027..00f1bce1a 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLite.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLite.java @@ -68,7 +68,7 @@ public class SQLite extends Database { try { file.createNewFile(); } catch (IOException ignored) { - logger.error("Unable to create database"); + logger.error("[P2] Unable to create database"); } } Class.forName("org.sqlite.JDBC"); diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 496acc747..82f87eb90 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -164,7 +164,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { // Dump world settings if (Settings.DEBUG) { - logger.info("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName()); + logger.info("[P2] - Dumping settings for ClassicPlotWorld with name {}", this.getWorldName()); final Field[] fields = this.getClass().getFields(); for (final Field field : fields) { final String name = field.getName().toLowerCase(Locale.ENGLISH); @@ -180,7 +180,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { } catch (final IllegalAccessException e) { value = String.format("Failed to parse: %s", e.getMessage()); } - logger.info("-- {} = {}", name, value); + logger.info("[P2] -- {} = {}", name, value); } } } @@ -282,12 +282,12 @@ public class HybridPlotWorld extends ClassicPlotWorld { } if (Settings.DEBUG) { - logger.info(" - plot schematic: {}", schematic3File.getPath()); + logger.info("[P2] - plot schematic: {}", schematic3File.getPath()); } } if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) { if (Settings.DEBUG) { - logger.info(" - schematic: false"); + logger.info("[P2] - schematic: false"); } return; } @@ -364,7 +364,7 @@ public class HybridPlotWorld extends ClassicPlotWorld { int pair = MathMan.pair(x, z); BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]); if (y >= height) { - logger.error("Error adding overlay block. `y > height`"); + logger.error("[P2] Error adding overlay block. `y > height`"); return; } existing[y] = id; diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java index 209eddec1..7d21d9579 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -413,24 +413,24 @@ public abstract class HybridUtils { iter.remove(); boolean regenedRoad = regenerateRoad(area, chunk, extend); if (!regenedRoad && Settings.DEBUG) { - logger.info("Failed to regenerate roads"); + logger.info("[P2] Failed to regenerate roads"); } ChunkManager.manager.unloadChunk(area.getWorldName(), chunk, true); } if (Settings.DEBUG) { - logger.info("Cancelled road task"); + logger.info("[P2] Cancelled road task"); } return; } count.incrementAndGet(); if (count.intValue() % 20 == 0) { - logger.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048); + logger.info("[P2] Progress: {}%", 100 * (2048 - chunks.size()) / 2048); } if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) { regeneratePlotWalls(area); HybridUtils.UPDATE = false; - logger.info("Finished road conversion"); + logger.info("[P2] Finished road conversion"); // CANCEL TASK } else { final Runnable task = this; @@ -443,9 +443,9 @@ public abstract class HybridUtils { BlockVector2 loc = iterator.next(); iterator.remove(); if (Settings.DEBUG) { - logger.info("Updating .mcr: {}, {} (approx 1024 chunks)", + logger.info("[P2] Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ()); - logger.info("- Remaining: {}", HybridUtils.regions.size()); + logger.info("[P2] - Remaining: {}", HybridUtils.regions.size()); } chunks.addAll(getChunks(loc)); System.gc(); @@ -463,7 +463,7 @@ public abstract class HybridUtils { boolean regenedRoads = regenerateRoad(area, chunk, extend); if (!regenedRoads && Settings.DEBUG) { - logger.info("Failed to regenerate road"); + logger.info("[P2] Failed to regenerate road"); } } } @@ -474,7 +474,7 @@ public abstract class HybridUtils { Iterator iterator = HybridUtils.regions.iterator(); BlockVector2 loc = iterator.next(); iterator.remove(); - logger.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", + logger.error("[P2] Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", area.getWorldHash(), loc.getX(), loc.getZ()); int sx = loc.getX() << 5; int sz = loc.getZ() << 5; diff --git a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java index f2a6b2284..53d00089b 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java @@ -49,7 +49,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld { @Override public void loadConfiguration(ConfigurationSection config) { if (!config.contains("plot.height")) { if (Settings.DEBUG) { - logger.info(" - Configuration is null? ({})", config.getCurrentPath()); + logger.info("[P2] - Configuration is null? ({})", config.getCurrentPath()); } } diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 304317c10..07307f37a 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -585,7 +585,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer for (Plot owned : getPlots()) { owned.deletePlot(null); if (Settings.DEBUG) { - logger.info("Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName()); + logger.info("[P2] Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName()); } } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index be1efa86e..a746dd272 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -1745,7 +1745,7 @@ public class Plot { if (updateDB) { if (!create(player.getUUID(), true)) { - logger.error("Player {} attempted to claim plot {}, but the database failed to update", + logger.error("[P2] Player {} attempted to claim plot {}, but the database failed to update", player.getName(), this.getId().toCommaSeparatedString()); return false; } @@ -1833,7 +1833,7 @@ public class Plot { }); return true; } - logger.info("Failed to add plot {} to plot area {}", + logger.info("[P2] Failed to add plot {} to plot area {}", this.getId().toCommaSeparatedString(), this.area.toString()); return false; } 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 32b650a2a..9501768ed 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java @@ -1063,7 +1063,7 @@ public abstract class PlotArea { try { flags.add(flagInstance.parse(split[1])); } catch (final FlagParseException e) { - logger.warn("Failed to parse default flag with key '{}' and value '{}'. " + logger.warn("[P2] Failed to parse default flag with key '{}' and value '{}'. " + "Reason: {}. This flag will not be added as a default flag.", e.getFlag().getName(), e.getValue(), diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java index d3e9e956e..0cfa1e1d9 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java +++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java @@ -97,7 +97,7 @@ public class PlotAnalysis { public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) { if (running) { if (Settings.DEBUG) { - logger.info("Calibration task already in progress!"); + logger.info("[P2] Calibration task already in progress!"); } return; } @@ -114,7 +114,7 @@ public class PlotAnalysis { @Override public void run() { Iterator iterator = plots.iterator(); if (Settings.DEBUG) { - logger.info("- Reducing {} plots to those with sufficient data", plots.size()); + logger.info("[P2] - Reducing {} plots to those with sufficient data", plots.size()); } while (iterator.hasNext()) { Plot plot = iterator.next(); @@ -139,7 +139,7 @@ public class PlotAnalysis { } if (Settings.DEBUG) { - logger.info("- Analyzing plot contents (this may take a while)"); + logger.info("[P2] - Analyzing plot contents (this may take a while)"); } int[] changes = new int[plots.size()]; @@ -167,7 +167,7 @@ public class PlotAnalysis { (plot.getAverageRating() + plot.getSettings().getRatings().size()) * 100); if (Settings.DEBUG) { - logger.info(" | {} (rating) {}", plot, ratings[i]); + logger.info("[P2] | {} (rating) {}", plot, ratings[i]); } } } @@ -181,7 +181,7 @@ public class PlotAnalysis { break; } if (Settings.DEBUG) { - logger.info(" | {}", queuePlot); + logger.info("[P2] | {}", queuePlot); } final Object lock = new Object(); TaskManager.runTask(new Runnable() { @@ -213,7 +213,7 @@ public class PlotAnalysis { } if (Settings.DEBUG) { - logger.info(" - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size()); + logger.info("[P2] - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size()); } try { @@ -229,7 +229,7 @@ public class PlotAnalysis { for (int i = 0; i < plots.size(); i++) { Plot plot = plots.get(i); if (Settings.DEBUG) { - logger.info(" | {}", plot); + logger.info("[P2] | {}", plot); } PlotAnalysis analysis = plot.getComplexity(null); @@ -247,7 +247,7 @@ public class PlotAnalysis { } if (Settings.DEBUG) { - logger.info(" - Calculating rankings"); + logger.info("[P2] - Calculating rankings"); } int[] rankRatings = rank(ratings); @@ -256,7 +256,7 @@ public class PlotAnalysis { int optimalIndex = (int) Math.round((1 - threshold) * (n - 1)); if (Settings.DEBUG) { - logger.info(" - Calculating rank correlation: "); + logger.info("[P2] - Calculating rank correlation: "); logger.info( " - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking"); logger.info( @@ -275,7 +275,7 @@ public class PlotAnalysis { (int) (factorChanges * 1000 / MathMan.getMean(changes)); if (Settings.DEBUG) { - logger.info(" - | changes {}", factorChanges); + logger.info("[P2] - | changes {}", factorChanges); } int[] rankFaces = rank(faces); @@ -287,7 +287,7 @@ public class PlotAnalysis { factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces)); if (Settings.DEBUG) { - logger.info(" - | faces {}", factorFaces); + logger.info("[P2] - | faces {}", factorFaces); } int[] rankData = rank(data); @@ -299,7 +299,7 @@ public class PlotAnalysis { factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data)); if (Settings.DEBUG) { - logger.info(" - | data {}", factor_data); + logger.info("[P2] - | data {}", factor_data); } int[] rank_air = rank(air); @@ -311,7 +311,7 @@ public class PlotAnalysis { factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air)); if (Settings.DEBUG) { - logger.info("- | air {}", factor_air); + logger.info("[P2] - | air {}", factor_air); } int[] rank_variety = rank(variety); @@ -324,7 +324,7 @@ public class PlotAnalysis { (int) (factor_variety * 1000 / MathMan.getMean(variety)); if (Settings.DEBUG) { - logger.info("- | variety {}", factor_variety); + logger.info("[P2] - | variety {}", factor_variety); } int[] rank_changes_sd = rank(changes_sd); @@ -337,7 +337,7 @@ public class PlotAnalysis { (int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd)); if (Settings.DEBUG) { - logger.info(" - | changed_sd {}", factor_changes_sd); + logger.info("[P2] - | changed_sd {}", factor_changes_sd); } int[] rank_faces_sd = rank(faces_sd); @@ -350,7 +350,7 @@ public class PlotAnalysis { (int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd)); if (Settings.DEBUG) { - logger.info(" - | faced_sd {}", factor_faces_sd); + logger.info("[P2] - | faced_sd {}", factor_faces_sd); } int[] rank_data_sd = rank(data_sd); @@ -363,7 +363,7 @@ public class PlotAnalysis { (int) (factor_data_sd * 1000 / MathMan.getMean(data_sd)); if (Settings.DEBUG) { - logger.info(" - | data_sd {}", factor_data_sd); + logger.info("[P2] - | data_sd {}", factor_data_sd); } int[] rank_air_sd = rank(air_sd); @@ -375,7 +375,7 @@ public class PlotAnalysis { factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd)); if (Settings.DEBUG) { - logger.info(" - | air_sd {}", factor_air_sd); + logger.info("[P2] - | air_sd {}", factor_air_sd); } int[] rank_variety_sd = rank(variety_sd); @@ -388,13 +388,13 @@ public class PlotAnalysis { (int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd)); if (Settings.DEBUG) { - logger.info(" - | variety_sd {}", factor_variety_sd); + logger.info("[P2] - | variety_sd {}", factor_variety_sd); } int[] complexity = new int[n]; if (Settings.DEBUG) { - logger.info(" Calculating threshold"); + logger.info("[P2] Calculating threshold"); } int max = 0; @@ -426,7 +426,7 @@ public class PlotAnalysis { logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings))))); if (optimalComplexity == Integer.MAX_VALUE) { if (Settings.DEBUG) { - logger.info("Insufficient data to determine correlation! {} | {}", + logger.info("[P2] Insufficient data to determine correlation! {} | {}", optimalIndex, n); } running = false; @@ -447,7 +447,7 @@ public class PlotAnalysis { // Save calibration if (Settings.DEBUG) { - logger.info(" Saving calibration"); + logger.info("[P2] Saving calibration"); } Settings.AUTO_CLEAR.put("auto-calibrated", settings); Settings.save(PlotSquared.get().worldsFile); @@ -456,7 +456,7 @@ public class PlotAnalysis { plot.removeRunning(); } if (Settings.DEBUG) { - logger.info(" Done!"); + logger.info("[P2] Done!"); } whenDone.run(); } @@ -465,7 +465,7 @@ public class PlotAnalysis { public static void logln(Object obj) { if (Settings.DEBUG) { - logger.info(log(obj)); + logger.info("[P2] " + log(obj)); } } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java index 2c398d1c7..871cf48c7 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java @@ -148,7 +148,7 @@ import java.util.Map; this.updateSubscribers .forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType)); } catch (IllegalStateException e) { - logger.info("Flag {} (class '{}') could not be added to the container because the " + logger.info("[P2] Flag {} (class '{}') could not be added to the container because the " + "flag name exceeded the allowed limit of 64 characters. Please tell the developer " + "of the flag to fix this.", flag.getName(), flag.getClass().getName()); e.printStackTrace(); diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java index a2d4d4a94..dd5dd34af 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java @@ -134,7 +134,7 @@ public class BlockTypeWrapper { this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId); if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) { if (Settings.DEBUG) { - logger.info("- Block category #{} does not exist", this.blockCategoryId); + logger.info("[P2] - Block category #{} does not exist", this.blockCategoryId); } this.blockCategory = new NullBlockCategory(this.blockCategoryId); } diff --git a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java index f72dc9aef..e5d431935 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java +++ b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java @@ -42,7 +42,7 @@ public class PlotMessage { try { reset(ChatManager.manager); } catch (Throwable e) { - logger.error("{} doesn't support fancy chat for {}", PlotSquared.imp().getPluginName(), PlotSquared.get().IMP.getServerVersion()); + logger.error("[P2] {} doesn't support fancy chat for {}", PlotSquared.imp().getPluginName(), PlotSquared.get().IMP.getServerVersion()); ChatManager.manager = new PlainChatManager(); reset(ChatManager.manager); } diff --git a/Core/src/main/java/com/plotsquared/core/util/Expression.java b/Core/src/main/java/com/plotsquared/core/util/Expression.java index 40b3d1c78..94d1aefc8 100644 --- a/Core/src/main/java/com/plotsquared/core/util/Expression.java +++ b/Core/src/main/java/com/plotsquared/core/util/Expression.java @@ -72,7 +72,7 @@ public abstract class Expression { return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg)); } catch (ScriptException e) { if (Settings.DEBUG) { - logger.info("Invalid expression: {}", expression); + logger.info("[P2] Invalid expression: {}", expression); } e.printStackTrace(); } diff --git a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java index 5c5799c78..df0e253d6 100644 --- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java +++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java @@ -521,7 +521,7 @@ public class MainUtil { if (arg == null) { if (player == null) { if (message) { - logger.info("No plot area string was supplied"); + logger.info("[P2] No plot area string was supplied"); } return null; } diff --git a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java index eae87a02b..c0162b0d5 100644 --- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java @@ -145,7 +145,7 @@ public abstract class RegionManager { world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca"; File file = new File(PlotSquared.get().IMP.getWorldContainer(), directory); - logger.info("- Deleting file: {} (max 1024 chunks)", file.getName()); + logger.info("[P2] - Deleting file: {} (max 1024 chunks)", file.getName()); if (file.exists()) { file.delete(); } diff --git a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java index c79e680a8..0784ca825 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java +++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java @@ -156,7 +156,7 @@ public abstract class SchematicHandler { boolean result = SchematicHandler.manager .save(value, directory + File.separator + name + ".schem"); if (!result) { - logger.error("Failed to save {}", plot.getId()); + logger.error("[P2] Failed to save {}", plot.getId()); } TaskManager.runTask(THIS); }); diff --git a/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java b/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java index 8c8359865..e37744590 100644 --- a/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java +++ b/Core/src/main/java/com/plotsquared/core/util/net/IncendoPaster.java @@ -161,7 +161,7 @@ public final class IncendoPaster { if (!httpURLConnection.getResponseMessage().contains("OK")) { if (httpURLConnection.getResponseCode() == 413) { final long size = content.length; - logger.error("Paste too big > size: {}MB", size / 1_000_000); + logger.error("[P2] Paste too big > size: {}MB", size / 1_000_000); } throw new IllegalStateException(String .format("Server returned status: %d %s", httpURLConnection.getResponseCode(), diff --git a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java index 8d1e38337..7520b66a6 100644 --- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java +++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java @@ -168,7 +168,7 @@ public class UUIDPipeline { } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (TimeoutException ignored) { - logger.warn("(UUID) Request for {} timed out", username); + logger.warn("[P2] (UUID) Request for {} timed out", username); // This is completely valid, we just don't care anymore } return null; @@ -191,7 +191,7 @@ public class UUIDPipeline { } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (TimeoutException ignored) { - logger.warn("(UUID) Request for {} timed out", uuid); + logger.warn("[P2] (UUID) Request for {} timed out", uuid); // This is completely valid, we just don't care anymore } return null; @@ -325,7 +325,7 @@ public class UUIDPipeline { this.consume(mappings); return mappings; } else if (Settings.DEBUG) { - logger.info("(UUID) Failed to find all usernames"); + logger.info("[P2] (UUID) Failed to find all usernames"); } if (Settings.UUID.UNKNOWN_AS_DEFAULT) { @@ -388,7 +388,7 @@ public class UUIDPipeline { this.consume(mappings); return mappings; } else if (Settings.DEBUG) { - logger.info("(UUID) Failed to find all UUIDs"); + logger.info("[P2] (UUID) Failed to find all UUIDs"); } throw new ServiceError("End of pipeline");