{
}
@Override public void sendMessage(String message) {
- PlotSquared.log(message);
+ logger.info(message);
}
@Override public void teleport(Location location, TeleportCause cause) {
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 9ce053985..7b4c8f530 100644
--- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
+++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
@@ -56,6 +56,8 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.item.ItemType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.Collection;
@@ -74,6 +76,8 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotPlayer.class.getSimpleName());
+
public static final String META_LAST_PLOT = "lastplot";
public static final String META_LOCATION = "location";
@@ -87,11 +91,11 @@ public abstract class PlotPlayer
implements CommandCaller, OfflinePlotPlayer
*/
private ConcurrentHashMap meta;
private int hash;
-
+
private final PlotAreaManager plotAreaManager;
private final EventDispatcher eventDispatcher;
private final EconHandler econHandler;
-
+
public PlotPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) {
this.plotAreaManager = plotAreaManager;
this.eventDispatcher = eventDispatcher;
@@ -591,9 +595,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
for (Plot owned : getPlots()) {
owned.deletePlot(null);
- PlotSquared.debug(String
- .format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned",
- plot.getId(), getName()));
+ if (Settings.DEBUG) {
+ logger.info("[P2] Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
+ }
}
}
if (ExpireManager.IMP != null) {
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 885078f06..70f39aa08 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java
@@ -77,6 +77,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import lombok.Getter;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
@@ -121,6 +123,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
*/
public class Plot {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
+
public static final int MAX_HEIGHT = 256;
private static Set connected_cache;
@@ -1735,9 +1739,6 @@ public class Plot {
public boolean claim(@Nonnull final PlotPlayer player, boolean teleport, String schematic) {
if (!canClaim(player)) {
- PlotSquared.debug(Captions.PREFIX.getTranslated() + String
- .format("Player %s attempted to claim plot %s, but was not allowed",
- player.getName(), this.getId().toCommaSeparatedString()));
return false;
}
return claim(player, teleport, schematic, true);
@@ -1748,9 +1749,8 @@ public class Plot {
if (updateDB) {
if (!create(player.getUUID(), true)) {
- PlotSquared.debug(Captions.PREFIX.getTranslated() + String.format(
- "Player %s attempted to claim plot %s, but the database failed to update",
- player.getName(), this.getId().toCommaSeparatedString()));
+ logger.error("[P2] Player {} attempted to claim plot {}, but the database failed to update",
+ player.getName(), this.getId().toCommaSeparatedString());
return false;
}
} else {
@@ -1838,9 +1838,8 @@ public class Plot {
});
return true;
}
- PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
- .format("Failed to add plot %s to plot area %s", this.getId().toCommaSeparatedString(),
- this.area.toString()));
+ logger.info("[P2] Failed to add plot {} to plot area {}",
+ this.getId().toCommaSeparatedString(), this.area.toString());
return false;
}
@@ -1934,12 +1933,10 @@ public class Plot {
*/
public boolean moveData(Plot plot, Runnable whenDone) {
if (!this.hasOwner()) {
- PlotSquared.debug(plot + " is unowned (single)");
TaskManager.runTask(whenDone);
return false;
}
if (plot.hasOwner()) {
- PlotSquared.debug(plot + " is unowned (multi)");
TaskManager.runTask(whenDone);
return false;
}
@@ -2645,7 +2642,6 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
if (!tmp.getMerged(Direction.SOUTH)) {
// invalid merge
- PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
tmp.getSettings().setMerged(Direction.SOUTH, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@@ -2662,7 +2658,6 @@ public class Plot {
assert tmp != null;
if (!tmp.getMerged(Direction.WEST)) {
// invalid merge
- PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
tmp.getSettings().setMerged(Direction.WEST, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@@ -2679,7 +2674,6 @@ public class Plot {
assert tmp != null;
if (!tmp.getMerged(Direction.NORTH)) {
// invalid merge
- PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
tmp.getSettings().setMerged(Direction.NORTH, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@@ -2695,7 +2689,6 @@ public class Plot {
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST));
if (!tmp.getMerged(Direction.EAST)) {
// invalid merge
- PlotSquared.debug("Fixing invalid merge: " + this);
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
tmp.getSettings().setMerged(Direction.EAST, true);
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
@@ -2710,10 +2703,6 @@ public class Plot {
Plot current;
while ((current = frontier.poll()) != null) {
if (!current.hasOwner() || current.settings == null) {
- // Invalid plot
- // merged onto unclaimed plot
- PlotSquared.debug(
- "Ignoring invalid merged plot: " + current + " | " + current.getOwnerAbs());
continue;
}
tmpSet.add(current);
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 86bb07791..9ad26c0aa 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
@@ -68,6 +68,8 @@ import lombok.Getter;
import lombok.Setter;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
@@ -87,6 +89,8 @@ import java.util.function.Consumer;
*/
public abstract class PlotArea {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotArea.class.getSimpleName());
+
protected final ConcurrentHashMap plots = new ConcurrentHashMap<>();
@Getter @Nonnull private final String worldName;
@Getter private final String id;
@@ -381,7 +385,6 @@ public abstract class PlotArea {
}
}
- PlotSquared.log(Captions.PREFIX + "&3 - default flags: &7" + flagBuilder.toString());
this.spawnEggs = config.getBoolean("event.spawn.egg");
this.spawnCustom = config.getBoolean("event.spawn.custom");
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
@@ -417,7 +420,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);
}
@@ -1113,10 +1117,12 @@ public abstract class PlotArea {
try {
flags.add(flagInstance.parse(split[1]));
} catch (final FlagParseException e) {
- PlotSquared.log(Captions.PREFIX.getTranslated() + String.format(
- "§cFailed to parse default flag with key §6'%s'§c and value: §6'%s'§c."
- + " Reason: %s. This flag will not be added as a default flag.",
- e.getFlag().getName(), e.getValue(), e.getErrorMessage()));
+ 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(),
+ e.getErrorMessage());
+ e.printStackTrace();
}
}
}
diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java b/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java
index df6155b4e..a810093b0 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java
@@ -25,14 +25,17 @@
*/
package com.plotsquared.core.plot;
-import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.InventoryUtil;
import javax.annotation.Nonnull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PlotInventory {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotInventory.class.getSimpleName());
+
private static final String META_KEY = "inventory";
public final PlotPlayer> player;
public final int size;
@@ -40,7 +43,7 @@ public class PlotInventory {
private String title;
private boolean open = false;
private final InventoryUtil inventoryUtil;
-
+
public PlotInventory(@Nonnull final InventoryUtil inventoryUtil,
PlotPlayer> player, int size, String name) {
this.size = size;
@@ -75,10 +78,7 @@ public class PlotInventory {
if (this.title == null) {
return;
}
- if (hasPlotInventoryOpen(player)) {
- PlotSquared.debug(String.format("Failed to open plot inventory for %s "
- + "because the player already has an open plot inventory", player.getName()));
- } else {
+ if (!hasPlotInventoryOpen(player)) {
this.open = true;
setPlotInventoryOpen(player, this);
this.inventoryUtil.open(this);
diff --git a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
index 6448a1b6c..e805ff87a 100644
--- a/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
+++ b/Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
@@ -48,6 +48,8 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.util.ArrayDeque;
@@ -57,20 +59,21 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
-import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
public class ExpireManager {
+ private final Logger logger = LoggerFactory.getLogger("P2/" + ExpireManager.class);
+
public static ExpireManager IMP;
private final ConcurrentHashMap dates_cache;
private final ConcurrentHashMap account_age_cache;
private final EventDispatcher eventDispatcher;
private volatile HashSet plotsToDelete;
private ArrayDeque tasks;
-
+
/**
* 0 = stopped, 1 = stopping, 2 = running
*/
@@ -84,7 +87,6 @@ public class ExpireManager {
}
public void addTask(ExpiryTask task) {
- PlotSquared.debug("Adding new expiry task!");
this.tasks.add(task);
}
@@ -425,21 +427,7 @@ public class ExpireManager {
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
}
}
- Set plots = plot.getConnectedPlots();
plot.deletePlot(whenDone);
- PlotAnalysis changed = plot.getComplexity(null);
- int changes = changed == null ? 0 : changed.changes_sd;
- int modified = changed == null ? 0 : changed.changes;
- PlotSquared.debug(
- "$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.getOwner()
- + " Delta:" + changes + "/" + modified + " Connected: " + StringMan
- .getString(plots));
- PlotSquared.debug("$4 - Area: " + plot.getArea());
- if (plot.hasOwner()) {
- PlotSquared.debug("$4 - Owner: " + plot.getOwner());
- } else {
- PlotSquared.debug("$4 - Owner: Unowned");
- }
}
public long getAge(UUID uuid) {
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 9ef1ff446..49a202fcb 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
@@ -34,6 +34,8 @@ import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
@@ -44,6 +46,9 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class PlotAnalysis {
+
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotAnalysis.class.getSimpleName());
+
public static boolean running = false;
public int changes;
public int faces;
@@ -92,22 +97,26 @@ public class PlotAnalysis {
*/
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) {
- PlotSquared.debug("Calibration task already in progress!");
+ if (Settings.DEBUG) {
+ logger.info("[P2] Calibration task already in progress!");
+ }
return;
}
if (threshold <= 0 || threshold >= 1) {
- PlotSquared.debug(
- "Invalid threshold provided! (Cannot be 0 or 100 as then there's no point calibrating)");
+ if (Settings.DEBUG) {
+ logger.info(
+ "Invalid threshold provided! (Cannot be 0 or 100 as then there's no point in calibrating)");
+ }
return;
}
running = true;
- PlotSquared.debug(" - Fetching all plots");
final List plots = PlotQuery.newQuery().allPlots().asList();
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
Iterator iterator = plots.iterator();
- PlotSquared.debug(
- " - $1Reducing " + plots.size() + " plots to those with sufficient data");
+ if (Settings.DEBUG) {
+ logger.info("[P2] - Reducing {} plots to those with sufficient data", plots.size());
+ }
while (iterator.hasNext()) {
Plot plot = iterator.next();
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
@@ -117,11 +126,12 @@ public class PlotAnalysis {
plot.addRunning();
}
}
- PlotSquared.debug(" - | Reduced to " + plots.size() + " plots");
if (plots.size() < 3) {
- PlotSquared.debug(
- "Calibration cancelled due to insufficient comparison data, please try again later");
+ if (Settings.DEBUG) {
+ logger.info(
+ "Calibration cancelled due to insufficient comparison data, please try again later");
+ }
running = false;
for (Plot plot : plots) {
plot.removeRunning();
@@ -129,7 +139,9 @@ public class PlotAnalysis {
return;
}
- PlotSquared.debug(" - $1Analyzing plot contents (this may take a while)");
+ if (Settings.DEBUG) {
+ logger.info("[P2] - Analyzing plot contents (this may take a while)");
+ }
int[] changes = new int[plots.size()];
int[] faces = new int[plots.size()];
@@ -155,7 +167,9 @@ public class PlotAnalysis {
ratings[i] = (int) (
(plot.getAverageRating() + plot.getSettings().getRatings().size())
* 100);
- PlotSquared.debug(" | " + plot + " (rating) " + ratings[i]);
+ if (Settings.DEBUG) {
+ logger.info("[P2] | {} (rating) {}", plot, ratings[i]);
+ }
}
}
});
@@ -167,7 +181,9 @@ public class PlotAnalysis {
if (queuePlot == null) {
break;
}
- PlotSquared.debug(" | " + queuePlot);
+ if (Settings.DEBUG) {
+ logger.info("[P2] | {}", queuePlot);
+ }
final Object lock = new Object();
TaskManager.runTask(new Runnable() {
@Override public void run() {
@@ -197,20 +213,25 @@ public class PlotAnalysis {
}
}
- PlotSquared.debug(
- " - $1Waiting on plot rating thread: " + mi.intValue() * 100 / plots.size()
- + "%");
+ if (Settings.DEBUG) {
+ logger.info("[P2] - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
+ }
+
try {
ratingAnalysis.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
- PlotSquared
- .debug(" - $1Processing and grouping single plot analysis for bulk processing");
+ if (Settings.DEBUG) {
+ logger.info(
+ " - Processing and grouping single plot analysis for bulk processing");
+ }
for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i);
- PlotSquared.debug(" | " + plot);
+ if (Settings.DEBUG) {
+ logger.info("[P2] | {}", plot);
+ }
PlotAnalysis analysis = plot.getComplexity(null);
changes[i] = analysis.changes;
@@ -226,18 +247,22 @@ public class PlotAnalysis {
variety_sd[i] = analysis.variety_sd;
}
- PlotSquared.debug(" - $1Calculating rankings");
+ if (Settings.DEBUG) {
+ logger.info("[P2] - Calculating rankings");
+ }
int[] rankRatings = rank(ratings);
int n = rankRatings.length;
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
- PlotSquared.debug(" - $1Calculating rank correlation: ");
- PlotSquared.debug(
- " - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
- PlotSquared.debug(
- " - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
+ if (Settings.DEBUG) {
+ 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(
+ " - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
+ }
Settings.Auto_Clear settings = new Settings.Auto_Clear();
@@ -249,7 +274,10 @@ public class PlotAnalysis {
settings.CALIBRATION.CHANGES = factorChanges == 1 ?
0 :
(int) (factorChanges * 1000 / MathMan.getMean(changes));
- PlotSquared.debug(" - | changes " + factorChanges);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | changes {}", factorChanges);
+ }
int[] rankFaces = rank(faces);
int[] sdFaces = getSD(rankFaces, rankRatings);
@@ -258,7 +286,10 @@ public class PlotAnalysis {
double factorFaces = getCC(n, sumFaces);
settings.CALIBRATION.FACES =
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
- PlotSquared.debug(" - | faces " + factorFaces);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | faces {}", factorFaces);
+ }
int[] rankData = rank(data);
int[] sdData = getSD(rankData, rankRatings);
@@ -267,7 +298,10 @@ public class PlotAnalysis {
double factor_data = getCC(n, sum_data);
settings.CALIBRATION.DATA =
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
- PlotSquared.debug(" - | data " + factor_data);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | data {}", factor_data);
+ }
int[] rank_air = rank(air);
int[] sd_air = getSD(rank_air, rankRatings);
@@ -276,7 +310,10 @@ public class PlotAnalysis {
double factor_air = getCC(n, sum_air);
settings.CALIBRATION.AIR =
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
- PlotSquared.debug(" - | air " + factor_air);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | air {}", factor_air);
+ }
int[] rank_variety = rank(variety);
int[] sd_variety = getSD(rank_variety, rankRatings);
@@ -286,7 +323,10 @@ public class PlotAnalysis {
settings.CALIBRATION.VARIETY = factor_variety == 1 ?
0 :
(int) (factor_variety * 1000 / MathMan.getMean(variety));
- PlotSquared.debug(" - | variety " + factor_variety);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | variety {}", factor_variety);
+ }
int[] rank_changes_sd = rank(changes_sd);
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
@@ -296,7 +336,10 @@ public class PlotAnalysis {
settings.CALIBRATION.CHANGES_SD = factor_changes_sd == 1 ?
0 :
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
- PlotSquared.debug(" - | changes_sd " + factor_changes_sd);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | changed_sd {}", factor_changes_sd);
+ }
int[] rank_faces_sd = rank(faces_sd);
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
@@ -306,7 +349,10 @@ public class PlotAnalysis {
settings.CALIBRATION.FACES_SD = factor_faces_sd == 1 ?
0 :
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
- PlotSquared.debug(" - | faces_sd " + factor_faces_sd);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | faced_sd {}", factor_faces_sd);
+ }
int[] rank_data_sd = rank(data_sd);
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
@@ -316,7 +362,10 @@ public class PlotAnalysis {
settings.CALIBRATION.DATA_SD = factor_data_sd == 1 ?
0 :
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
- PlotSquared.debug(" - | data_sd " + factor_data_sd);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | data_sd {}", factor_data_sd);
+ }
int[] rank_air_sd = rank(air_sd);
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
@@ -325,7 +374,10 @@ public class PlotAnalysis {
double factor_air_sd = getCC(n, sum_air_sd);
settings.CALIBRATION.AIR_SD =
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
- PlotSquared.debug(" - | air_sd " + factor_air_sd);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | air_sd {}", factor_air_sd);
+ }
int[] rank_variety_sd = rank(variety_sd);
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
@@ -335,11 +387,17 @@ public class PlotAnalysis {
settings.CALIBRATION.VARIETY_SD = factor_variety_sd == 1 ?
0 :
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
- PlotSquared.debug(" - | variety_sd " + factor_variety_sd);
+
+ if (Settings.DEBUG) {
+ logger.info("[P2] - | variety_sd {}", factor_variety_sd);
+ }
int[] complexity = new int[n];
- PlotSquared.debug(" $1Calculating threshold");
+ if (Settings.DEBUG) {
+ logger.info("[P2] Calculating threshold");
+ }
+
int max = 0;
int min = 0;
for (int i = 0; i < n; i++) {
@@ -368,9 +426,10 @@ public class PlotAnalysis {
logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
if (optimalComplexity == Integer.MAX_VALUE) {
- PlotSquared.debug(
- "Insufficient data to determine correlation! " + optimalIndex + " | "
- + n);
+ if (Settings.DEBUG) {
+ logger.info("[P2] Insufficient data to determine correlation! {} | {}",
+ optimalIndex, n);
+ }
running = false;
for (Plot plot : plots) {
plot.removeRunning();
@@ -388,21 +447,27 @@ public class PlotAnalysis {
}
// Save calibration
- PlotSquared.debug(" $1Saving calibration");
+ if (Settings.DEBUG) {
+ logger.info("[P2] Saving calibration");
+ }
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
Settings.save(PlotSquared.get().getWorldsFile());
- PlotSquared.debug("$1Done!");
running = false;
for (Plot plot : plots) {
plot.removeRunning();
}
+ if (Settings.DEBUG) {
+ logger.info("[P2] Done!");
+ }
whenDone.run();
}
});
}
public static void logln(Object obj) {
- PlotSquared.debug(log(obj));
+ if (Settings.DEBUG) {
+ logger.info("[P2] " + log(obj));
+ }
}
public static String log(Object 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 5c11a258b..016ec4af8 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
@@ -27,9 +27,12 @@ package com.plotsquared.core.plot.flag;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
-import com.plotsquared.core.PlotSquared;
import lombok.EqualsAndHashCode;
import lombok.Setter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -44,6 +47,8 @@ import java.util.Map;
*/
@EqualsAndHashCode(of = "flagMap") public class FlagContainer {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + FlagContainer.class.getSimpleName());
+
private final Map unknownFlags = new HashMap<>();
private final Map, PlotFlag, ?>> flagMap = new HashMap<>();
private final PlotFlagUpdateHandler plotFlagUpdateHandler;
@@ -145,11 +150,9 @@ import java.util.Map;
this.updateSubscribers
.forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType));
} catch (IllegalStateException e) {
- PlotSquared.log(String.format(
- "Flag '%s' (class: '%s') could not be added to the container"
- + " because the flag name exceeded the allowed limit of 64 characters."
- + " Please tell the developer of that flag to fix this.", flag.getName(),
- flag.getClass().getName()));
+ 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 4228ef7ad..11d31304f 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
@@ -27,13 +27,15 @@ package com.plotsquared.core.plot.flag.types;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
-import com.plotsquared.core.PlotSquared;
+import com.plotsquared.core.configuration.Settings;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import lombok.Getter;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
@@ -44,6 +46,8 @@ import java.util.Map;
*/
public class BlockTypeWrapper {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + BlockTypeWrapper.class.getSimpleName());
+
private static final Map blockTypes = new HashMap<>();
private static final Map blockCategories = new HashMap<>();
@Nullable @Getter private final BlockType blockType;
@@ -129,7 +133,9 @@ public class BlockTypeWrapper {
&& this.blockCategoryId != null) { // only if name is available
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
- PlotSquared.debug("- Block category #" + this.blockCategoryId + " does not exist");
+ if (Settings.DEBUG) {
+ 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 608974bc9..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
@@ -29,18 +29,20 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.ChatManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PlotMessage {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotMessage.class.getSimpleName());
+
private Object builder;
public PlotMessage() {
try {
reset(ChatManager.manager);
} catch (Throwable e) {
- PlotSquared.debug(
- PlotSquared.platform().getPluginName() + " doesn't support fancy chat for " + PlotSquared
- .platform().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/queue/LocationOffsetDelegateLocalBlockQueue.java b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java
index cea58a95d..eefae99d3 100644
--- a/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java
+++ b/Core/src/main/java/com/plotsquared/core/queue/LocationOffsetDelegateLocalBlockQueue.java
@@ -25,17 +25,20 @@
*/
package com.plotsquared.core.queue;
-import com.plotsquared.core.PlotSquared;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQueue {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + LocationOffsetDelegateLocalBlockQueue.class.getSimpleName());
+
private final boolean[][] canPlace;
private final int blockX;
private final int blockZ;
@@ -61,10 +64,6 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue
return super.setBlock(x, y, z, id);
}
} catch (final Exception e) {
- PlotSquared.debug(String.format(
- "Failed to set block at: %d;%d;%d (to = %s) with offset %d;%d."
- + " Translated to: %d;%d", x, y, z, id, blockX, blockZ, x - blockX,
- z - blockZ));
throw e;
}
return false;
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 86bdeea2d..94d1aefc8 100644
--- a/Core/src/main/java/com/plotsquared/core/util/Expression.java
+++ b/Core/src/main/java/com/plotsquared/core/util/Expression.java
@@ -25,13 +25,18 @@
*/
package com.plotsquared.core.util;
-import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.command.DebugExec;
import com.plotsquared.core.command.MainCommand;
+import com.plotsquared.core.configuration.Settings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.script.ScriptException;
public abstract class Expression {
+
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + Expression.class.getSimpleName());
+
public static Expression constant(final U value) {
return new Expression() {
@Override public U evaluate(U arg) {
@@ -66,7 +71,9 @@ public abstract class Expression {
try {
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
} catch (ScriptException e) {
- PlotSquared.debug("Invalid Expression: " + expression);
+ if (Settings.DEBUG) {
+ logger.info("[P2] Invalid expression: {}", expression);
+ }
e.printStackTrace();
}
return 0d;
diff --git a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
index fdff6c4a2..d940d49fe 100644
--- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
+++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
@@ -25,7 +25,6 @@
*/
package com.plotsquared.core.util;
-import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
@@ -33,6 +32,8 @@ import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.plot.BlockBucket;
import com.sk89q.worldedit.world.block.BlockState;
import javax.annotation.Nonnull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.HashMap;
@@ -45,6 +46,7 @@ import java.util.Map;
@SuppressWarnings("unused")
public final class LegacyConverter {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + LegacyConverter.class.getSimpleName());
public static final String CONFIGURATION_VERSION = "post_flattening";
private static final HashMap TYPE_MAP = new HashMap<>();
@@ -109,7 +111,7 @@ public final class LegacyConverter {
@Nonnull final String key, @Nonnull final String block) {
final BlockBucket bucket = this.blockToBucket(block);
this.setString(section, key, bucket);
- PlotSquared.log(CaptionUtility
+ logger.info(CaptionUtility
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(),
block, bucket.toString()));
}
@@ -119,7 +121,7 @@ public final class LegacyConverter {
final BlockState[] blocks = this.splitBlockList(blockList);
final BlockBucket bucket = this.blockListToBucket(blocks);
this.setString(section, key, bucket);
- PlotSquared.log(CaptionUtility
+ logger.info(CaptionUtility
.format(ConsolePlayer.getConsole(), Captions.LEGACY_CONFIG_REPLACED.getTranslated(),
plotBlockArrayString(blocks), bucket.toString()));
}
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 f8834a696..22e09bf9c 100644
--- a/Core/src/main/java/com/plotsquared/core/util/MainUtil.java
+++ b/Core/src/main/java/com/plotsquared/core/util/MainUtil.java
@@ -57,6 +57,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -98,6 +100,7 @@ import java.util.stream.IntStream;
*/
public class MainUtil {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + MainUtil.class.getSimpleName());
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
static {
@@ -154,7 +157,6 @@ public class MainUtil {
public static void upload(UUID uuid, String file, String extension,
final RunnableVal writeTask, final RunnableVal whenDone) {
if (writeTask == null) {
- PlotSquared.debug("&cWrite task cannot be null");
TaskManager.runTask(whenDone);
return;
}
@@ -216,7 +218,6 @@ public class MainUtil {
content = scanner.next().trim();
}
if (!content.startsWith("<")) {
- PlotSquared.debug(content);
}
int responseCode = ((HttpURLConnection) con).getResponseCode();
if (responseCode == 200) {
@@ -539,7 +540,7 @@ public class MainUtil {
if (arg == null) {
if (player == null) {
if (message) {
- PlotSquared.log(Captions.NOT_VALID_PLOT_WORLD);
+ logger.info("[P2] No plot area string was supplied");
}
return null;
}
@@ -662,7 +663,7 @@ public class MainUtil {
if (player == null) {
String message = CaptionUtility
.format(null, (prefix ? Captions.PREFIX.getTranslated() : "") + msg);
- PlotSquared.log(message);
+ logger.info(message);
} else {
player.sendMessage(CaptionUtility.format(player,
(prefix ? Captions.PREFIX.getTranslated() : "") + Captions.color(msg)));
@@ -697,7 +698,7 @@ public class MainUtil {
TaskManager.runTaskAsync(() -> {
String m = CaptionUtility.format(player, caption, args);
if (player == null) {
- PlotSquared.log(m);
+ logger.info(m);
} else {
player.sendMessage(m);
}
@@ -914,8 +915,6 @@ public class MainUtil {
for (File file : files) {
if (file.isDirectory()) {
deleteDirectory(file);
- } else {
- PlotSquared.debug("Deleting file: " + file + " | " + file.delete());
}
}
}
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 c7bbb3b5a..743395523 100644
--- a/Core/src/main/java/com/plotsquared/core/util/RegionManager.java
+++ b/Core/src/main/java/com/plotsquared/core/util/RegionManager.java
@@ -37,6 +37,8 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.io.File;
@@ -46,6 +48,10 @@ import java.util.Set;
public abstract class RegionManager {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + RegionManager.class.getSimpleName());
+
+ public static RegionManager manager = null;
+
public static BlockVector2 getRegion(Location location) {
int x = location.getX() >> 9;
int z = location.getZ() >> 9;
@@ -147,7 +153,7 @@ public abstract class RegionManager {
world + File.separator + "region" + File.separator + "r." + loc.getX() + "."
+ loc.getZ() + ".mca";
File file = new File(PlotSquared.platform().getWorldContainer(), directory);
- PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
+ 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 29f5d0013..7f933df24 100644
--- a/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
+++ b/Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
@@ -61,6 +61,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import javax.annotation.Nonnull;
import org.json.JSONArray;
import org.json.JSONException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@@ -94,6 +96,9 @@ import java.util.zip.GZIPOutputStream;
public abstract class SchematicHandler {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + SchematicHandler.class.getSimpleName());
+ public static SchematicHandler manager;
+
private boolean exportAll = false;
private final WorldUtil worldUtil;
@@ -151,17 +156,11 @@ public abstract class SchematicHandler {
final Runnable THIS = this;
getCompoundTag(plot, new RunnableVal() {
@Override public void run(final CompoundTag value) {
- if (value == null) {
- MainUtil.sendMessage(null, "&7 - Skipped plot &c" + plot.getId());
- } else {
+ if (value != null) {
TaskManager.runTaskAsync(() -> {
- MainUtil.sendMessage(null, "&6ID: " + plot.getId());
boolean result = save(value, directory + File.separator + name + ".schem");
if (!result) {
- MainUtil
- .sendMessage(null, "&7 - Failed to save &c" + plot.getId());
- } else {
- MainUtil.sendMessage(null, "&7 - &a success: " + plot.getId());
+ logger.error("[P2] Failed to save {}", plot.getId());
}
TaskManager.runTask(THIS);
});
@@ -190,7 +189,6 @@ public abstract class SchematicHandler {
whenDone.value = false;
}
if (schematic == null) {
- PlotSquared.debug("Schematic == null :|");
TaskManager.runTask(whenDone);
return;
}
@@ -206,12 +204,6 @@ public abstract class SchematicHandler {
+ 1) < WIDTH) || (
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset
+ 1) < LENGTH) || (HEIGHT > 256)) {
- PlotSquared.debug("Schematic is too large");
- PlotSquared.debug(
- "(" + WIDTH + ',' + LENGTH + ',' + HEIGHT + ") is bigger than (" + (
- region.getMaximumPoint().getX() - region.getMinimumPoint().getX()) + ','
- + (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ())
- + ",256)");
TaskManager.runTask(whenDone);
return;
}
@@ -409,8 +401,6 @@ public abstract class SchematicHandler {
return new Schematic(clip);
} catch (IOException e) {
e.printStackTrace();
- PlotSquared.debug(is.toString() + " | " + is.getClass().getCanonicalName()
- + " is not in GZIP format : " + e.getMessage());
}
}
return null;
@@ -436,14 +426,12 @@ public abstract class SchematicHandler {
return schematics;
} catch (JSONException | IOException e) {
e.printStackTrace();
- PlotSquared.debug("ERROR PARSING: " + rawJSON);
}
return null;
}
public void upload(final CompoundTag tag, UUID uuid, String file, RunnableVal whenDone) {
if (tag == null) {
- PlotSquared.debug("&cCannot save empty tag");
TaskManager.runTask(whenDone);
return;
}
@@ -468,7 +456,6 @@ public abstract class SchematicHandler {
*/
public boolean save(CompoundTag tag, String path) {
if (tag == null) {
- PlotSquared.debug("&cCannot save empty tag");
return false;
}
try {
diff --git a/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java b/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java
index 3f9b3d598..c5e145812 100644
--- a/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java
+++ b/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java
@@ -25,6 +25,6 @@
*/
package com.plotsquared.core.util.logger;
-public interface ILogger {
- void log(String message);
+@Deprecated public interface ILogger {
+ @Deprecated void log(String message);
}
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 46ae63f7d..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
@@ -26,7 +26,8 @@
package com.plotsquared.core.util.net;
import com.google.common.base.Charsets;
-import com.plotsquared.core.PlotSquared;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@@ -47,6 +48,8 @@ import java.util.Locale;
@SuppressWarnings({"unused", "WeakerAccess"})
public final class IncendoPaster {
+ private static Logger logger = LoggerFactory.getLogger("P2/" + IncendoPaster.class);
+
/**
* Upload service URL
*/
@@ -158,7 +161,7 @@ public final class IncendoPaster {
if (!httpURLConnection.getResponseMessage().contains("OK")) {
if (httpURLConnection.getResponseCode() == 413) {
final long size = content.length;
- PlotSquared.debug(String.format("Paste Too Big > Size: %dMB", 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 839de3e49..5e92691b1 100644
--- a/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
+++ b/Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
@@ -33,6 +33,8 @@ import com.plotsquared.core.util.ThreadUtils;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
@@ -62,6 +64,8 @@ import java.util.function.Function;
*/
public class UUIDPipeline {
+ private static final Logger logger = LoggerFactory.getLogger("P2/" + UUIDPipeline.class.getSimpleName());
+
private final Executor executor;
private final List serviceList;
private final List>> consumerList;
@@ -164,7 +168,7 @@ public class UUIDPipeline {
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException ignored) {
- PlotSquared.log(Captions.PREFIX + " (UUID) Request for " + username + " timed out");
+ logger.warn("[P2] (UUID) Request for {} timed out", username);
// This is completely valid, we just don't care anymore
}
return null;
@@ -187,7 +191,7 @@ public class UUIDPipeline {
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException ignored) {
- PlotSquared.log(Captions.PREFIX + " (UUID) Request for " + uuid + " timed out");
+ logger.warn("[P2] (UUID) Request for {} timed out", uuid);
// This is completely valid, we just don't care anymore
}
return null;
@@ -321,7 +325,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
- PlotSquared.log("Failed to find all usernames");
+ logger.info("[P2] (UUID) Failed to find all usernames");
}
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
@@ -384,7 +388,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
- PlotSquared.log("Failed to find all UUIDs");
+ logger.info("[P2] (UUID) Failed to find all UUIDs");
}
throw new ServiceError("End of pipeline");