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; package com.plotsquared.bukkit.entity;
import com.plotsquared.core.PlotSquared;
import org.bukkit.Art; import org.bukkit.Art;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -55,11 +54,15 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle; import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper { public final class ReplicatingEntityWrapper extends EntityWrapper {
private static final Logger logger = LoggerFactory.getLogger(ReplicatingEntityWrapper.class);
private final short depth; private final short depth;
private final int hash; private final int hash;
private final EntityBaseStats base = new EntityBaseStats(); private final EntityBaseStats base = new EntityBaseStats();
@ -331,7 +334,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return; return;
// END LIVING // // END LIVING //
default: 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 { try {
entity.getInventory().setContents(this.inventory); entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) { } 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); restoreLiving((LivingEntity) entity);
return entity; return entity;
default: default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); logger.debug("Could not identify entity: {}", entity.getType());
return entity; return entity;
// END LIVING // END LIVING
} }

View File

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

View File

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

View File

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

View File

@ -26,7 +26,6 @@
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.location.PlotLoc;
@ -55,6 +54,8 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
@ -75,6 +76,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
public class BukkitRegionManager extends RegionManager { public class BukkitRegionManager extends RegionManager {
private static final Logger logger = LoggerFactory.getLogger(BukkitRegionManager.class);
public static boolean isIn(CuboidRegion region, int x, int z) { public static boolean isIn(CuboidRegion region, int x, int z) {
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
&& z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ(); && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ();
@ -90,7 +93,7 @@ public class BukkitRegionManager extends RegionManager {
} else { } else {
final Semaphore semaphore = new Semaphore(1); final Semaphore semaphore = new Semaphore(1);
try { 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."); + " Will halt the calling thread until completed.");
semaphore.acquire(); semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> { 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); block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
} }
if (!(block.getBlockData() instanceof WallSign)) { if (!(block.getBlockData() instanceof WallSign)) {
PlotSquared.debug(block.getBlockData().getAsString());
throw new RuntimeException("Something went wrong generating a sign"); throw new RuntimeException("Something went wrong generating a sign");
} }
final Directional sign = (Directional) block.getBlockData(); 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.EntityWrapper;
import com.plotsquared.bukkit.entity.ReplicatingEntityWrapper; import com.plotsquared.bukkit.entity.ReplicatingEntityWrapper;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc; import com.plotsquared.core.location.PlotLoc;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
@ -38,6 +37,8 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -46,6 +47,8 @@ import java.util.Set;
public class ContentMap { public class ContentMap {
private static final Logger logger = LoggerFactory.getLogger(ContentMap.class);
final Set<EntityWrapper> entities; final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks; final Map<PlotLoc, BaseBlock[]> allBlocks;
@ -123,8 +126,7 @@ public class ContentMap {
try { try {
entity.spawn(world, xOffset, zOffset); entity.spawn(world, xOffset, zOffset);
} catch (Exception e) { } catch (Exception e) {
PlotSquared.debug("Failed to restore entity (e): " + e.toString()); logger.error("Failed to restore entity", e);
e.printStackTrace();
} }
} }
this.entities.clear(); this.entities.clear();

View File

@ -383,35 +383,6 @@ public class PlotSquared {
throw new IllegalStateException("Plot main implementation is missing"); 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() { private void startExpiryTasks() {
if (Settings.Enabled_Components.PLOT_EXPIRY) { if (Settings.Enabled_Components.PLOT_EXPIRY) {
ExpireManager.IMP = new ExpireManager(); ExpireManager.IMP = new ExpireManager();
@ -540,8 +511,8 @@ public class PlotSquared {
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1]))); chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
int height = (int) list.get(2); int height = (int) list.get(2);
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height); logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
PlotSquared.debug(" Regions: " + regions.size()); logger.debug(" Regions: {}", regions.size());
PlotSquared.debug(" Chunks: " + chunks.size()); logger.debug(" Chunks: {}", chunks.size());
HybridUtils.UPDATE = true; HybridUtils.UPDATE = true;
HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks); HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks);
} catch (IOException | ClassNotFoundException e) { } catch (IOException | ClassNotFoundException e) {
@ -1108,7 +1079,7 @@ public class PlotSquared {
} }
if (type == PlotAreaType.NORMAL) { if (type == PlotAreaType.NORMAL) {
if (plotAreaManager.getPlotAreas(world, null).length != 0) { if (plotAreaManager.getPlotAreas(world, null).length != 0) {
debug("World possibly already loaded: " + world); logger.debug("Would possibly already loaded: {}", world);
return; return;
} }
IndependentPlotGenerator plotGenerator; IndependentPlotGenerator plotGenerator;

View File

@ -167,7 +167,8 @@ import java.util.UUID;
* @see MainUtil#sendConsoleMessage(Captions, String...) * @see MainUtil#sendConsoleMessage(Captions, String...)
*/ */
public void sendConsoleMessage(String message) { 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.Permissions;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@CommandDeclaration(command = "claim", @CommandDeclaration(command = "claim",
aliases = "c", aliases = "c",
@ -54,6 +56,8 @@ import com.plotsquared.core.util.task.TaskManager;
usage = "/plot claim") usage = "/plot claim")
public class Claim extends SubCommand { public class Claim extends SubCommand {
private static final Logger logger = LoggerFactory.getLogger(Claim.class);
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) { @Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
String schematic = null; String schematic = null;
if (args.length >= 1) { if (args.length >= 1) {
@ -133,7 +137,7 @@ public class Claim extends SubCommand {
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() { DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) { @Override public void run(Object value) {
if (!plot.claim(player, true, finalSchematic, false)) { 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())); .format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED); sendMessage(player, Captions.PLOT_NOT_CLAIMED);
plot.setOwnerAbs(null); 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", .format("Failed to add plot %s to the database",
plot.getId().toCommaSeparatedString())); plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED); sendMessage(player, Captions.PLOT_NOT_CLAIMED);

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@
*/ */
package com.plotsquared.core.configuration; package com.plotsquared.core.configuration;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
@ -44,7 +43,8 @@ public interface Caption {
default boolean send(PlotPlayer caller, Object... args) { default boolean send(PlotPlayer caller, Object... args) {
String msg = CaptionUtility.format(caller, this, args); String msg = CaptionUtility.format(caller, this, args);
if (caller == null) { if (caller == null) {
PlotSquared.log(msg); // TODO: Replace with adventure
System.out.println(msg);
} else { } else {
caller.sendMessage(msg); 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.Configuration;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.InvalidConfigurationException; import com.plotsquared.core.configuration.InvalidConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.error.YAMLException;
@ -45,6 +47,9 @@ import java.util.Map;
* Note that this implementation is not synchronized. * Note that this implementation is not synchronized.
*/ */
public class YamlConfiguration extends FileConfiguration { public class YamlConfiguration extends FileConfiguration {
private static final Logger logger = LoggerFactory.getLogger(YamlConfiguration.class);
private static final String COMMENT_PREFIX = "# "; private static final String COMMENT_PREFIX = "# ";
private static final String BLANK_CONFIG = "{}\n"; private static final String BLANK_CONFIG = "{}\n";
private final DumperOptions yamlOptions = new DumperOptions(); private final DumperOptions yamlOptions = new DumperOptions();
@ -76,11 +81,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++); dest = new File(file.getAbsolutePath() + "_broken_" + i++);
} }
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
PlotSquared.debug("&dCould not read: &7" + file); logger.debug("Could not read: {}", file);
PlotSquared.debug("&dRenamed to: &7" + dest.getName()); logger.debug("Renamed to: {}", file);
PlotSquared.debug("&c============ Full stacktrace ============"); logger.debug("============ Full stacktrace ============");
ex.printStackTrace(); ex.printStackTrace();
PlotSquared.debug("&c========================================="); logger.debug("=========================================");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

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

View File

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

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.generator; package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.location.Location; 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) { if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
PlotSquared.debug(Captions.PREFIX + "&3 - schematic: &7false"); logger.debug(" - schematic: false");
return; return;
} }
this.ROAD_SCHEMATIC_ENABLED = true; this.ROAD_SCHEMATIC_ENABLED = true;

View File

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

View File

@ -25,13 +25,16 @@
*/ */
package com.plotsquared.core.generator; package com.plotsquared.core.generator;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class SquarePlotWorld extends GridPlotWorld { public abstract class SquarePlotWorld extends GridPlotWorld {
private static final Logger logger = LoggerFactory.getLogger(SquarePlotWorld.class);
public int PLOT_WIDTH = 42; public int PLOT_WIDTH = 42;
public int ROAD_WIDTH = 7; public int ROAD_WIDTH = 7;
public int ROAD_OFFSET_X = 0; public int ROAD_OFFSET_X = 0;
@ -44,7 +47,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override public void loadConfiguration(ConfigurationSection config) { @Override public void loadConfiguration(ConfigurationSection config) {
if (!config.contains("plot.height")) { 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.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width"); 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.player.PlotPlayer;
import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.InventoryUtil;
import lombok.NonNull; import lombok.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlotInventory { public class PlotInventory {
private static final Logger logger = LoggerFactory.getLogger(PlotInventory.class);
private static final String META_KEY = "inventory"; private static final String META_KEY = "inventory";
public final PlotPlayer<?> player; public final PlotPlayer<?> player;
public final int size; public final int size;
@ -79,8 +83,8 @@ public class PlotInventory {
return; return;
} }
if (hasPlotInventoryOpen(player)) { if (hasPlotInventoryOpen(player)) {
PlotSquared.debug(String.format("Failed to open plot inventory for %s " logger.debug("Failed to open plot inventory for {} because"
+ "because the player already has an open plot inventory", player.getName())); + " the player already has an open plot inventory", player.getName());
} else { } else {
this.open = true; this.open = true;
setPlotInventoryOpen(player, this); 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.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,6 +64,8 @@ import java.util.concurrent.ConcurrentLinkedDeque;
public class ExpireManager { public class ExpireManager {
private final Logger logger = LoggerFactory.getLogger(ExpireManager.class);
public static ExpireManager IMP; public static ExpireManager IMP;
private final ConcurrentHashMap<UUID, Long> dates_cache; private final ConcurrentHashMap<UUID, Long> dates_cache;
private final ConcurrentHashMap<UUID, Long> account_age_cache; private final ConcurrentHashMap<UUID, Long> account_age_cache;
@ -79,7 +83,7 @@ public class ExpireManager {
} }
public void addTask(ExpiryTask task) { public void addTask(ExpiryTask task) {
PlotSquared.debug("Adding new expiry task!"); logger.debug("Adding new expiry task!");
this.tasks.add(task); this.tasks.add(task);
} }
@ -425,15 +429,13 @@ public class ExpireManager {
PlotAnalysis changed = plot.getComplexity(null); PlotAnalysis changed = plot.getComplexity(null);
int changes = changed == null ? 0 : changed.changes_sd; int changes = changed == null ? 0 : changed.changes_sd;
int modified = changed == null ? 0 : changed.changes; int modified = changed == null ? 0 : changed.changes;
PlotSquared.debug( logger.debug("Deleted expired plot: {} | User: {} | Delta: {}/{} | Connected: {}",
"$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.getOwner() plot, plot.getOwner(), changes, modified, StringMan.getString(plots));
+ " Delta:" + changes + "/" + modified + " Connected: " + StringMan logger.debug(" - Area: {}", plot.getArea());
.getString(plots));
PlotSquared.debug("$4 - Area: " + plot.getArea());
if (plot.hasOwner()) { if (plot.hasOwner()) {
PlotSquared.debug("$4 - Owner: " + plot.getOwner()); logger.debug(" - Owner: {}", plot.getOwner());
} else { } 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, public static void upload(UUID uuid, String file, String extension,
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) { final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
if (writeTask == null) { if (writeTask == null) {
PlotSquared.debug("&cWrite task cannot be null"); logger.debug("Write task cannot be null");
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
return; return;
} }
@ -218,7 +218,6 @@ public class MainUtil {
content = scanner.next().trim(); content = scanner.next().trim();
} }
if (!content.startsWith("<")) { if (!content.startsWith("<")) {
PlotSquared.debug(content);
} }
int responseCode = ((HttpURLConnection) con).getResponseCode(); int responseCode = ((HttpURLConnection) con).getResponseCode();
if (responseCode == 200) { if (responseCode == 200) {
@ -899,7 +898,7 @@ public class MainUtil {
if (file.isDirectory()) { if (file.isDirectory()) {
deleteDirectory(file); deleteDirectory(file);
} else { } 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.jetbrains.annotations.NotNull;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -93,6 +95,8 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
public abstract class SchematicHandler { public abstract class SchematicHandler {
private static final Logger logger = LoggerFactory.getLogger(SchematicHandler.class);
public static SchematicHandler manager; public static SchematicHandler manager;
private boolean exportAll = false; private boolean exportAll = false;
@ -187,7 +191,6 @@ public abstract class SchematicHandler {
whenDone.value = false; whenDone.value = false;
} }
if (schematic == null) { if (schematic == null) {
PlotSquared.debug("Schematic == null :|");
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
return; return;
} }
@ -203,12 +206,7 @@ public abstract class SchematicHandler {
+ 1) < WIDTH) || ( + 1) < WIDTH) || (
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset (region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset
+ 1) < LENGTH) || (HEIGHT > 256)) { + 1) < LENGTH) || (HEIGHT > 256)) {
PlotSquared.debug("Schematic is too large"); logger.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); TaskManager.runTask(whenDone);
return; return;
} }
@ -405,8 +403,6 @@ public abstract class SchematicHandler {
return new Schematic(clip); return new Schematic(clip);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.debug(is.toString() + " | " + is.getClass().getCanonicalName()
+ " is not in GZIP format : " + e.getMessage());
} }
} }
return null; return null;
@ -432,14 +428,12 @@ public abstract class SchematicHandler {
return schematics; return schematics;
} catch (JSONException | IOException e) { } catch (JSONException | IOException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.debug("ERROR PARSING: " + rawJSON);
} }
return null; return null;
} }
public void upload(final CompoundTag tag, UUID uuid, String file, RunnableVal<URL> whenDone) { public void upload(final CompoundTag tag, UUID uuid, String file, RunnableVal<URL> whenDone) {
if (tag == null) { if (tag == null) {
PlotSquared.debug("&cCannot save empty tag");
TaskManager.runTask(whenDone); TaskManager.runTask(whenDone);
return; return;
} }
@ -464,7 +458,6 @@ public abstract class SchematicHandler {
*/ */
public boolean save(CompoundTag tag, String path) { public boolean save(CompoundTag tag, String path) {
if (tag == null) { if (tag == null) {
PlotSquared.debug("&cCannot save empty tag");
return false; return false;
} }
try { try {

View File

@ -26,7 +26,8 @@
package com.plotsquared.core.util.net; package com.plotsquared.core.util.net;
import com.google.common.base.Charsets; 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.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -47,6 +48,8 @@ import java.util.Locale;
@SuppressWarnings({"unused", "WeakerAccess"}) @SuppressWarnings({"unused", "WeakerAccess"})
public final class IncendoPaster { public final class IncendoPaster {
private static Logger logger = LoggerFactory.getLogger(IncendoPaster.class);
/** /**
* Upload service URL * Upload service URL
*/ */
@ -158,7 +161,7 @@ public final class IncendoPaster {
if (!httpURLConnection.getResponseMessage().contains("OK")) { if (!httpURLConnection.getResponseMessage().contains("OK")) {
if (httpURLConnection.getResponseCode() == 413) { if (httpURLConnection.getResponseCode() == 413) {
final long size = content.length; 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 throw new IllegalStateException(String
.format("Server returned status: %d %s", httpURLConnection.getResponseCode(), .format("Server returned status: %d %s", httpURLConnection.getResponseCode(),