replace remaining debug calls

This commit is contained in:
Alexander Söderberg 2020-07-12 21:49:05 +02:00
parent 298e65a394
commit 0fa5a16cd0
25 changed files with 95 additions and 118 deletions

View File

@ -25,7 +25,6 @@
*/
package com.plotsquared.bukkit.entity;
import com.plotsquared.core.PlotSquared;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -55,11 +54,15 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper {
private static final Logger logger = LoggerFactory.getLogger(ReplicatingEntityWrapper.class);
private final short depth;
private final int hash;
private final EntityBaseStats base = new EntityBaseStats();
@ -331,7 +334,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return;
// END LIVING //
default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
logger.debug("Could not identify entity: {}", entity.getType());
}
}
@ -387,7 +390,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
try {
entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) {
PlotSquared.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
logger.error("Failed to restore inventory", e);
}
}
@ -730,7 +733,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
restoreLiving((LivingEntity) entity);
return entity;
default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
logger.debug("Could not identify entity: {}", entity.getType());
return entity;
// END LIVING
}

View File

@ -51,6 +51,8 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.HashSet;
@ -60,6 +62,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused")
public class ChunkListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger(ChunkListener.class);
private RefMethod methodGetHandleChunk;
private RefField mustSave;
private Chunk lastChunk;
@ -73,9 +77,6 @@ public class ChunkListener implements Listener {
this.mustSave = classChunk.getField("mustSave");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) {
PlotSquared.debug(PlotSquared.get().IMP.getPluginName()
+ "/Server not compatible for chunk processor trim/gc");
Settings.Chunk_Processor.AUTO_TRIM = false;
}
}
@ -251,7 +252,6 @@ public class ChunkListener implements Listener {
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -259,7 +259,6 @@ public class ChunkListener implements Listener {
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -269,7 +268,6 @@ public class ChunkListener implements Listener {
if (i >= tiles.length - Settings.Chunk_Processor.MAX_TILES) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -297,15 +295,11 @@ public class ChunkListener implements Listener {
}
}
PlotSquared.debug(
"PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
logger.debug("PlotSquared detected chunk and processed it: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
}
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
PlotSquared.debug(
"PlotSquared detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
logger.debug("PlotSquared detected chunk: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
cleanChunk(chunk);
return true;
}

View File

@ -987,7 +987,8 @@ public class PlayerEvents extends PlotListener implements Listener {
player.sendMessage(spyMessage);
}
}
PlotSquared.debug(full);
// TODO: Re-implement
// PlotSquared.debug(full);
}
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
@ -2435,7 +2436,6 @@ public class PlayerEvents extends PlotListener implements Listener {
}
Player p = event.getPlayer();
if (p == null) {
PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players.");
event.setCancelled(true);
return;
}

View File

@ -27,11 +27,9 @@ package com.plotsquared.bukkit.queue;
import com.plotsquared.bukkit.schematic.StateWrapper;
import com.plotsquared.bukkit.util.BukkitBlockUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.queue.BasicLocalBlockQueue;
import com.plotsquared.core.util.BlockUtil;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@ -85,8 +83,6 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj != null) {
worldObj.refreshChunk(x, z);
} else {
PlotSquared.debug("Error Refreshing Chunk");
}
}
@ -109,8 +105,6 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
world.regenerate(region, editSession);
}
}
} else {
PlotSquared.debug("Error Regenerating Chunk");
}
}

View File

@ -26,7 +26,6 @@
package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
@ -55,6 +54,8 @@ import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -75,6 +76,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
public class BukkitRegionManager extends RegionManager {
private static final Logger logger = LoggerFactory.getLogger(BukkitRegionManager.class);
public static boolean isIn(CuboidRegion region, int x, int z) {
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
&& z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ();
@ -90,7 +93,7 @@ public class BukkitRegionManager extends RegionManager {
} else {
final Semaphore semaphore = new Semaphore(1);
try {
PlotSquared.debug("Attempting to make an asynchronous call to getLoadedChunks."
logger.debug("Attempting to make an asynchronous call to getLoadedChunks."
+ " Will halt the calling thread until completed.");
semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> {

View File

@ -468,7 +468,6 @@ public class BukkitUtil extends WorldUtil {
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
}
if (!(block.getBlockData() instanceof WallSign)) {
PlotSquared.debug(block.getBlockData().getAsString());
throw new RuntimeException("Something went wrong generating a sign");
}
final Directional sign = (Directional) block.getBlockData();

View File

@ -27,7 +27,6 @@ package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.entity.EntityWrapper;
import com.plotsquared.bukkit.entity.ReplicatingEntityWrapper;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
import com.sk89q.worldedit.bukkit.BukkitWorld;
@ -38,6 +37,8 @@ import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.HashSet;
@ -46,6 +47,8 @@ import java.util.Set;
public class ContentMap {
private static final Logger logger = LoggerFactory.getLogger(ContentMap.class);
final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks;
@ -123,8 +126,7 @@ public class ContentMap {
try {
entity.spawn(world, xOffset, zOffset);
} catch (Exception e) {
PlotSquared.debug("Failed to restore entity (e): " + e.toString());
e.printStackTrace();
logger.error("Failed to restore entity", e);
}
}
this.entities.clear();

View File

@ -383,35 +383,6 @@ public class PlotSquared {
throw new IllegalStateException("Plot main implementation is missing");
}
/**
* Log a message to the IPlotMain logger.
*
* @param message Message to log
* @see IPlotMain#log(String)
* @deprecated Use slf4j
*/
@Deprecated public static void log(Object message) {
if (message == null || (message instanceof Caption ?
((Caption) message).getTranslated().isEmpty() :
message.toString().isEmpty())) {
return;
}
logger.info(StringMan.getString(message));
}
/**
* Log a message to the IPlotMain logger.
*
* @param message Message to log
* @see IPlotMain#log(String)
* @deprecated Use sl4j
*/
@Deprecated public static void debug(@Nullable Object message) {
if (Settings.DEBUG) {
logger.debug(StringMan.getString(message));
}
}
private void startExpiryTasks() {
if (Settings.Enabled_Components.PLOT_EXPIRY) {
ExpireManager.IMP = new ExpireManager();
@ -540,8 +511,8 @@ public class PlotSquared {
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);
PlotSquared.debug(" Regions: " + regions.size());
PlotSquared.debug(" Chunks: " + chunks.size());
logger.debug(" Regions: {}", regions.size());
logger.debug(" Chunks: {}", chunks.size());
HybridUtils.UPDATE = true;
HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks);
} catch (IOException | ClassNotFoundException e) {
@ -1108,7 +1079,7 @@ public class PlotSquared {
}
if (type == PlotAreaType.NORMAL) {
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
debug("World possibly already loaded: " + world);
logger.debug("Would possibly already loaded: {}", world);
return;
}
IndependentPlotGenerator plotGenerator;

View File

@ -167,7 +167,8 @@ import java.util.UUID;
* @see MainUtil#sendConsoleMessage(Captions, String...)
*/
public void sendConsoleMessage(String message) {
PlotSquared.log(message);
// TODO: Re-implement
// PlotSquared.log(message);
}
/**

View File

@ -44,6 +44,8 @@ import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@CommandDeclaration(command = "claim",
aliases = "c",
@ -54,6 +56,8 @@ import com.plotsquared.core.util.task.TaskManager;
usage = "/plot claim")
public class Claim extends SubCommand {
private static final Logger logger = LoggerFactory.getLogger(Claim.class);
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
String schematic = null;
if (args.length >= 1) {
@ -133,7 +137,7 @@ public class Claim extends SubCommand {
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) {
if (!plot.claim(player, true, finalSchematic, false)) {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
logger.info(Captions.PREFIX.getTranslated() + String
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
plot.setOwnerAbs(null);
@ -148,7 +152,7 @@ public class Claim extends SubCommand {
}
}
}), () -> {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() + String
logger.info(Captions.PREFIX.getTranslated() + String
.format("Failed to add plot %s to the database",
plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED);

View File

@ -452,7 +452,6 @@ public class DebugExec extends SubCommand {
}
init();
this.scope.put("PlotPlayer", player);
PlotSquared.debug("> " + script);
try {
if (async) {
final String toExec = script;

View File

@ -175,7 +175,6 @@ public class Purge extends SubCommand {
boolean finalClear = clear;
Runnable run = () -> {
logger.debug("Calculating plots to purge, please wait...");
PlotSquared.debug("Calculating plots to purge, please wait...");
HashSet<Integer> ids = new HashSet<>();
Iterator<Plot> iterator = toDelete.iterator();
AtomicBoolean cleared = new AtomicBoolean(true);

View File

@ -111,7 +111,6 @@ public class Trim extends SubCommand {
BlockVector2 loc = BlockVector2.at(x, z);
empty.add(loc);
} catch (NumberFormatException ignored) {
PlotSquared.debug("INVALID MCA: " + name);
}
}
});

View File

@ -25,7 +25,6 @@
*/
package com.plotsquared.core.configuration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan;
@ -44,7 +43,8 @@ public interface Caption {
default boolean send(PlotPlayer caller, Object... args) {
String msg = CaptionUtility.format(caller, this, args);
if (caller == null) {
PlotSquared.log(msg);
// TODO: Replace with adventure
System.out.println(msg);
} else {
caller.sendMessage(msg);
}

View File

@ -29,6 +29,8 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Configuration;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
@ -45,6 +47,9 @@ import java.util.Map;
* Note that this implementation is not synchronized.
*/
public class YamlConfiguration extends FileConfiguration {
private static final Logger logger = LoggerFactory.getLogger(YamlConfiguration.class);
private static final String COMMENT_PREFIX = "# ";
private static final String BLANK_CONFIG = "{}\n";
private final DumperOptions yamlOptions = new DumperOptions();
@ -76,11 +81,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
}
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
PlotSquared.debug("&dCould not read: &7" + file);
PlotSquared.debug("&dRenamed to: &7" + dest.getName());
PlotSquared.debug("&c============ Full stacktrace ============");
logger.debug("Could not read: {}", file);
logger.debug("Renamed to: {}", file);
logger.debug("============ Full stacktrace ============");
ex.printStackTrace();
PlotSquared.debug("&c=========================================");
logger.debug("=========================================");
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -626,9 +626,7 @@ public class SQLManager implements AbstractDB {
}
})))));
} catch (SQLException e) {
e.printStackTrace();
PlotSquared
.debug("&7[WARN] Failed to set all flags and member tiers for plots");
logger.error("Failed to set all flags and member tiers for plots", e);
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -2496,8 +2494,7 @@ public class SQLManager implements AbstractDB {
}
}
} catch (SQLException e) {
PlotSquared
.debug("&7[WARN] Failed to fetch rating for plot " + plot.getId().toString());
logger.error("Failed to fetch rating for plot {}", plot.getId().toString());
e.printStackTrace();
}
return map;

View File

@ -26,6 +26,8 @@
package com.plotsquared.core.database;
import com.plotsquared.core.PlotSquared;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@ -40,6 +42,8 @@ import java.sql.Statement;
*/
public class SQLite extends Database {
private static final Logger logger = LoggerFactory.getLogger(SQLite.class);
private final String dbLocation;
private Connection connection;
@ -64,7 +68,7 @@ public class SQLite extends Database {
try {
file.createNewFile();
} catch (IOException ignored) {
PlotSquared.debug("&cUnable to create database!");
logger.error("Unable to create database");
}
}
Class.forName("org.sqlite.JDBC");

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.location.Location;
@ -283,10 +282,10 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
}
PlotSquared.debug(Captions.PREFIX + "&3 - plot schematic: &7" + schematic3File.getPath());
logger.debug(" - plot schematic: {}", schematic3File.getPath());
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
PlotSquared.debug(Captions.PREFIX + "&3 - schematic: &7false");
logger.debug(" - schematic: false");
return;
}
this.ROAD_SCHEMATIC_ENABLED = true;

View File

@ -25,7 +25,6 @@
*/
package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
@ -34,8 +33,9 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.RegionManager;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Set;
@ -44,6 +44,8 @@ import java.util.Set;
*/
public abstract class SquarePlotManager extends GridPlotManager {
private static final Logger logger = LoggerFactory.getLogger(SquarePlotManager.class);
private final SquarePlotWorld squarePlotWorld;
public SquarePlotManager(SquarePlotWorld squarePlotWorld) {
@ -226,11 +228,9 @@ public abstract class SquarePlotManager extends GridPlotManager {
// northwest
return plot.getMerged(Direction.NORTHWEST) ? id : null;
}
PlotSquared.debug("invalid location: " + Arrays.toString(merged));
} catch (Exception ignored) {
PlotSquared.debug(
"Invalid plot / road width in settings.yml for world: " + squarePlotWorld
.getWorldName());
logger.debug( "Invalid plot / road width in settings.yml for world: {}", squarePlotWorld
.getWorldName());
}
return null;
}

View File

@ -25,13 +25,16 @@
*/
package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.plot.PlotId;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class SquarePlotWorld extends GridPlotWorld {
private static final Logger logger = LoggerFactory.getLogger(SquarePlotWorld.class);
public int PLOT_WIDTH = 42;
public int ROAD_WIDTH = 7;
public int ROAD_OFFSET_X = 0;
@ -44,7 +47,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override public void loadConfiguration(ConfigurationSection config) {
if (!config.contains("plot.height")) {
PlotSquared.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
logger.debug(" - Configuration is null? ({})", config.getCurrentPath());
}
this.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width");

View File

@ -29,9 +29,13 @@ import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.InventoryUtil;
import lombok.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlotInventory {
private static final Logger logger = LoggerFactory.getLogger(PlotInventory.class);
private static final String META_KEY = "inventory";
public final PlotPlayer<?> player;
public final int size;
@ -79,8 +83,8 @@ public class PlotInventory {
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()));
logger.debug("Failed to open plot inventory for {} because"
+ " the player already has an open plot inventory", player.getName());
} else {
this.open = true;
setPlotInventoryOpen(player, this);

View File

@ -47,6 +47,8 @@ import com.plotsquared.core.util.StringMan;
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 java.util.ArrayDeque;
import java.util.ArrayList;
@ -62,6 +64,8 @@ import java.util.concurrent.ConcurrentLinkedDeque;
public class ExpireManager {
private final Logger logger = LoggerFactory.getLogger(ExpireManager.class);
public static ExpireManager IMP;
private final ConcurrentHashMap<UUID, Long> dates_cache;
private final ConcurrentHashMap<UUID, Long> account_age_cache;
@ -79,7 +83,7 @@ public class ExpireManager {
}
public void addTask(ExpiryTask task) {
PlotSquared.debug("Adding new expiry task!");
logger.debug("Adding new expiry task!");
this.tasks.add(task);
}
@ -425,15 +429,13 @@ public class ExpireManager {
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());
logger.debug("Deleted expired plot: {} | User: {} | Delta: {}/{} | Connected: {}",
plot, plot.getOwner(), changes, modified, StringMan.getString(plots));
logger.debug(" - Area: {}", plot.getArea());
if (plot.hasOwner()) {
PlotSquared.debug("$4 - Owner: " + plot.getOwner());
logger.debug(" - Owner: {}", plot.getOwner());
} else {
PlotSquared.debug("$4 - Owner: Unowned");
logger.debug(" - Owner: Unowned");
}
}

View File

@ -156,7 +156,7 @@ public class MainUtil {
public static void upload(UUID uuid, String file, String extension,
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
if (writeTask == null) {
PlotSquared.debug("&cWrite task cannot be null");
logger.debug("Write task cannot be null");
TaskManager.runTask(whenDone);
return;
}
@ -218,7 +218,6 @@ public class MainUtil {
content = scanner.next().trim();
}
if (!content.startsWith("<")) {
PlotSquared.debug(content);
}
int responseCode = ((HttpURLConnection) con).getResponseCode();
if (responseCode == 200) {
@ -899,7 +898,7 @@ public class MainUtil {
if (file.isDirectory()) {
deleteDirectory(file);
} else {
PlotSquared.debug("Deleting file: " + file + " | " + file.delete());
logger.debug("Deleting file: {} | {}", file, file.delete());
}
}
}

View File

@ -61,6 +61,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@ -93,6 +95,8 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public abstract class SchematicHandler {
private static final Logger logger = LoggerFactory.getLogger(SchematicHandler.class);
public static SchematicHandler manager;
private boolean exportAll = false;
@ -187,7 +191,6 @@ public abstract class SchematicHandler {
whenDone.value = false;
}
if (schematic == null) {
PlotSquared.debug("Schematic == null :|");
TaskManager.runTask(whenDone);
return;
}
@ -203,12 +206,7 @@ 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)");
logger.debug("Schematic is too large");
TaskManager.runTask(whenDone);
return;
}
@ -405,8 +403,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;
@ -432,14 +428,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<URL> whenDone) {
if (tag == null) {
PlotSquared.debug("&cCannot save empty tag");
TaskManager.runTask(whenDone);
return;
}
@ -464,7 +458,6 @@ public abstract class SchematicHandler {
*/
public boolean save(CompoundTag tag, String path) {
if (tag == null) {
PlotSquared.debug("&cCannot save empty tag");
return false;
}
try {

View File

@ -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(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.debug("Paste too big > size: {}MB", size / 1_000_000);
}
throw new IllegalStateException(String
.format("Server returned status: %d %s", httpURLConnection.getResponseCode(),