- Ditch slf4j in favor of log4j. slf4j is (unfortunately) very much unmaintained at this time and future versions of MC (1.17+) will use log4j version 2.14.1 onwards over some ancient sfl4j version.
- Using log4j reduces our jar size as well, because we don't need to bridge it as the game provides it natively.
This commit is contained in:
NotMyFault 2021-06-03 12:40:27 +02:00
parent 1dc225362d
commit f4552e358d
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
44 changed files with 398 additions and 403 deletions

View File

@ -85,9 +85,6 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("org.bstats", "com.plotsquared.metrics")
relocate("com.sk89q.squirrelid", "com.plotsquared.squirrelid")
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
relocate("org.apache.logging.log4j", "com.plotsquared.logging.apache.log4j")
relocate("org.apache.logging.slf4j", "com.plotsquared.logging.apache.slf4j")
relocate("org.slf4j", "com.plotsquared.logging.slf4j")
relocate("com.google.inject", "com.plotsquared.google")
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
relocate("com.intellectualsites.services", "com.plotsquared.core.services")

View File

@ -140,8 +140,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.incendo.serverlib.ServerLib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.lang.reflect.Method;
@ -170,7 +170,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@Singleton
public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BukkitPlatform.class.getSimpleName());
private static final int BSTATS_ID = 1404;
static {
@ -276,12 +276,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
if (PremiumVerification.isPremium()) {
logger.info("PlotSquared version licensed to Spigot user {}", getUserID());
logger.info("https://www.spigotmc.org/resources/{}", getResourceID());
logger.info("Download ID: {}", getDownloadID());
logger.info("Thanks for supporting us :)");
LOGGER.info("PlotSquared version licensed to Spigot user {}", getUserID());
LOGGER.info("https://www.spigotmc.org/resources/{}", getResourceID());
LOGGER.info("Download ID: {}", getDownloadID());
LOGGER.info("Thanks for supporting us :)");
} else {
logger.info("Couldn't verify purchase :(");
LOGGER.info("Couldn't verify purchase :(");
}
// Database
@ -293,7 +293,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
// Perform upgrade
if (DBFunc.dbManager.convertFlags()) {
logger.info("Flags were converted successfully!");
LOGGER.info("Flags were converted successfully!");
// Update the config version
try {
plotSquared.setConfigurationVersion("v5");
@ -317,10 +317,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// WorldEdit
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
logger.info("{} hooked into WorldEdit", this.pluginName());
LOGGER.info("{} hooked into WorldEdit", this.pluginName());
WorldEdit.getInstance().getEventBus().register(this.injector().getInstance(WESubscriber.class));
} catch (Throwable e) {
logger.error(
LOGGER.error(
"Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
}
}
@ -368,7 +368,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
try {
injector().getInstance(ComponentPresetManager.class);
} catch (final Exception e) {
logger.error("Failed to initialize the preset system", e);
LOGGER.error("Failed to initialize the preset system", e);
}
}
@ -391,15 +391,18 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
continue;
}
if (!worldUtil.isWorld(world) && !world.equals("*")) {
logger.warn(
"`{}` was not properly loaded - {} will now try to load it properly",
world,
this.pluginName()
);
logger.warn(
" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
logger.warn(" - Your world management plugin may be faulty (or non existent)");
logger.warn(" This message may also be a false positive and could be ignored.");
if (Settings.DEBUG) {
LOGGER.warn(
"`{}` was not properly loaded - {} will now try to load it properly",
world,
this.pluginName()
);
LOGGER.warn(
"- Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
LOGGER.warn("- Your world management plugin may be faulty (or non existent)");
LOGGER.warn("- The named world is not a plot world");
LOGGER.warn("This message may also be a false positive and could be ignored.");
}
this.setGenerator(world);
}
}
@ -419,7 +422,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
this.impromptuPipeline.registerService(offlineModeUUIDService);
this.backgroundPipeline.registerService(offlineModeUUIDService);
logger.info("(UUID) Using the offline mode UUID service");
LOGGER.info("(UUID) Using the offline mode UUID service");
}
if (Settings.UUID.SERVICE_BUKKIT) {
@ -442,7 +445,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final LuckPermsUUIDService luckPermsUUIDService;
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
luckPermsUUIDService = new LuckPermsUUIDService();
logger.info("(UUID) Using LuckPerms as a complementary UUID service");
LOGGER.info("(UUID) Using LuckPerms as a complementary UUID service");
} else {
luckPermsUUIDService = null;
}
@ -450,7 +453,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final EssentialsUUIDService essentialsUUIDService;
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
essentialsUUIDService = new EssentialsUUIDService();
logger.info("(UUID) Using EssentialsX as a complementary UUID service");
LOGGER.info("(UUID) Using EssentialsX as a complementary UUID service");
} else {
essentialsUUIDService = null;
}
@ -461,7 +464,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final PaperUUIDService paperUUIDService = new PaperUUIDService();
this.impromptuPipeline.registerService(paperUUIDService);
this.backgroundPipeline.registerService(paperUUIDService);
logger.info("(UUID) Using Paper as a complementary UUID service");
LOGGER.info("(UUID) Using Paper as a complementary UUID service");
}
this.impromptuPipeline.registerService(sqLiteUUIDService);
@ -511,7 +514,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
ChatFormatter.formatters.add(injector().getInstance(PlaceholderFormatter.class));
}
logger.info("PlotSquared hooked into PlaceholderAPI");
LOGGER.info("PlotSquared hooked into PlaceholderAPI");
}
this.startMetrics();
@ -597,7 +600,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final Chunk[] chunks = world.getLoadedChunks();
if (chunks.length == 0) {
if (!Bukkit.unloadWorld(world, true)) {
logger.warn("Failed to unload {}", world.getName());
LOGGER.warn("Failed to unload {}", world.getName());
}
return;
} else {
@ -649,7 +652,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
});
logger.info("(UUID) {} UUIDs will be cached", uuidQueue.size());
LOGGER.info("(UUID) {} UUIDs will be cached", uuidQueue.size());
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
// Begin by reading all the SQLite cache at once
@ -657,7 +660,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Now fetch names for all known UUIDs
final int totalSize = uuidQueue.size();
int read = 0;
logger.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
LOGGER.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
// Used to indicate that the second retrieval has been attempted
@ -665,7 +668,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
if (!uuidList.isEmpty() && secondRun) {
logger.warn("(UUID) Giving up on last batch. Fetching new batch instead");
LOGGER.warn("(UUID) Giving up on last batch. Fetching new batch instead");
uuidList.clear();
}
if (uuidList.isEmpty()) {
@ -689,13 +692,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Print progress
final double percentage = ((double) read / (double) totalSize) * 100.0D;
if (Settings.DEBUG) {
logger.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
LOGGER.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
}
} catch (final InterruptedException | ExecutionException e) {
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
LOGGER.error("(UUID) Failed to retrieve last batch. Will try again", e);
}
}
logger.info("(UUID) PlotSquared has cached all UUIDs");
LOGGER.info("(UUID) PlotSquared has cached all UUIDs");
}, 10, TimeUnit.SECONDS);
}
@ -1092,7 +1095,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
}
} catch (final Exception e) {
logger.error("Failed to reload world: {} | {}", world, e.getMessage());
LOGGER.error("Failed to reload world: {} | {}", world, e.getMessage());
Bukkit.getServer().unloadWorld(world, false);
return;
}
@ -1195,7 +1198,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
for (final String language : languages) {
if (!new File(new File(this.getDataFolder(), "lang"), String.format("messages_%s.json", language)).exists()) {
this.saveResource(String.format("lang/messages_%s.json", language), false);
logger.info("Copied language file 'messages_{}.json'", language);
LOGGER.info("Copied language file 'messages_{}.json'", language);
}
}
}

View File

@ -55,14 +55,14 @@ 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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ReplicatingEntityWrapper.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ReplicatingEntityWrapper.class.getSimpleName());
private final short depth;
private final int hash;
@ -393,7 +393,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
try {
entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) {
logger.error("Failed to restore inventory", e);
LOGGER.error("Failed to restore inventory", e);
}
}
@ -746,7 +746,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return entity;
default:
if (Settings.DEBUG) {
logger.info("Could not identify entity: {}", entity.getType());
LOGGER.info("Could not identify entity: {}", entity.getType());
}
return entity;
// END LIVING

View File

@ -33,12 +33,12 @@ import com.plotsquared.core.backup.NullBackupManager;
import com.plotsquared.core.backup.PlayerBackupProfile;
import com.plotsquared.core.backup.SimpleBackupManager;
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class BackupModule extends AbstractModule {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BackupModule.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BackupModule.class.getSimpleName());
@Override
protected void configure() {
@ -47,8 +47,8 @@ public class BackupModule extends AbstractModule {
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
bind(BackupManager.class).to(SimpleBackupManager.class);
} catch (final Exception e) {
logger.error("Failed to initialize backup manager", e);
logger.error("Backup features will be disabled");
LOGGER.error("Failed to initialize backup manager", e);
LOGGER.error("Backup features will be disabled");
bind(BackupManager.class).to(NullBackupManager.class);
}
}

View File

@ -55,8 +55,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Method;
import java.util.HashSet;
@ -67,7 +67,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused")
public class ChunkListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ChunkListener.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ChunkListener.class.getSimpleName());
private final PlotAreaManager plotAreaManager;

View File

@ -98,8 +98,8 @@ import org.bukkit.entity.WaterMob;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collection;
import java.util.HashSet;
@ -117,7 +117,7 @@ public class BukkitUtil extends WorldUtil {
public static final BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacySection();
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BukkitUtil.class.getSimpleName());
private final Collection<BlockType> tileEntityTypes = new HashSet<>();
/**
@ -388,7 +388,7 @@ public class BukkitUtil extends WorldUtil {
) {
final World world = getWorld(worldName);
if (world == null) {
logger.warn("An error occurred while setting the biome because the world was null", new RuntimeException());
LOGGER.warn("An error occurred while setting the biome because the world was null", new RuntimeException());
return;
}
final Biome biome = BukkitAdapter.adapt(biomeType);
@ -487,7 +487,7 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(Firework.class);
}
case "player" -> allowedInterfaces.add(Player.class);
default -> logger.error("Unknown entity category requested: {}", category);
default -> LOGGER.error("Unknown entity category requested: {}", category);
}
final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>();
outer:

View File

@ -37,8 +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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashMap;
import java.util.HashSet;
@ -47,7 +47,7 @@ import java.util.Set;
public class ContentMap {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ContentMap.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ContentMap.class.getSimpleName());
final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks;
@ -128,7 +128,7 @@ public class ContentMap {
try {
entity.spawn(world, xOffset, zOffset);
} catch (Exception e) {
logger.error("Failed to restore entity", e);
LOGGER.error("Failed to restore entity", e);
}
}
this.entities.clear();

View File

@ -36,8 +36,8 @@ import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
@ -46,7 +46,7 @@ import java.net.URL;
public class UpdateUtility implements Listener {
private static final Logger logger = LoggerFactory.getLogger("P2/" + UpdateUtility.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + UpdateUtility.class.getSimpleName());
public static PlotVersion internalVersion;
public static String spigotVersion;
@ -73,23 +73,23 @@ public class UpdateUtility implements Listener {
.getAsJsonObject();
spigotVersion = result.get("current_version").getAsString();
} catch (IOException e) {
logger.error("Unable to check for updates. Error: {}", e.getMessage());
LOGGER.error("Unable to check for updates. Error: {}", e.getMessage());
return;
}
if (internalVersion.isLaterVersion(spigotVersion)) {
logger.info("There appears to be a PlotSquared update available!");
logger.info("You are running version {}, the latest version is {}",
LOGGER.info("There appears to be a PlotSquared update available!");
LOGGER.info("You are running version {}, the latest version is {}",
internalVersion.versionString(), spigotVersion
);
logger.info("https://www.spigotmc.org/resources/77506/updates");
LOGGER.info("https://www.spigotmc.org/resources/77506/updates");
hasUpdate = true;
if (Settings.UpdateChecker.NOTIFY_ONCE) {
cancelTask();
}
} else if (notify) {
notify = false;
logger.info("Congratulations! You are running the latest PlotSquared version");
LOGGER.info("Congratulations! You are running the latest PlotSquared version");
}
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
}

View File

@ -33,8 +33,8 @@ import com.sk89q.squirrelid.Profile;
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
import com.sk89q.squirrelid.resolver.ProfileService;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
@ -48,7 +48,7 @@ import java.util.UUID;
@SuppressWarnings("UnstableApiUsage")
public class SquirrelIdUUIDService implements UUIDService {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquirrelIdUUIDService.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SquirrelIdUUIDService.class.getSimpleName());
private final ProfileService profileService;
private final RateLimiter rateLimiter;
@ -83,7 +83,7 @@ public class SquirrelIdUUIDService implements UUIDService {
//
if (uuids.size() >= 2) {
if (Settings.DEBUG) {
logger.info("(UUID) Found invalid UUID in batch. Will try each UUID individually.");
LOGGER.info("(UUID) Found invalid UUID in batch. Will try each UUID individually.");
}
for (final UUID uuid : uuids) {
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
@ -93,7 +93,7 @@ public class SquirrelIdUUIDService implements UUIDService {
results.add(result.get(0));
}
} else if (uuids.size() == 1 && Settings.DEBUG) {
logger.info("(UUID) Found invalid UUID: {}", uuids.get(0));
LOGGER.info("(UUID) Found invalid UUID: {}", uuids.get(0));
}
}
} catch (IOException | InterruptedException e) {

View File

@ -39,9 +39,7 @@ dependencies {
testImplementation(libs.worldeditCore)
// Logging
api(libs.slf4j)
runtimeOnly(libs.log4j) {
exclude(group = "org.slf4j")
compileOnlyApi(libs.log4j) {
because("Minecraft uses 2.8.1")
}

View File

@ -76,8 +76,8 @@ import com.sk89q.worldedit.math.BlockVector2;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.File;
@ -121,7 +121,7 @@ import java.util.zip.ZipInputStream;
@SuppressWarnings({"WeakerAccess"})
public class PlotSquared {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotSquared.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotSquared.class.getSimpleName());
private static @MonotonicNonNull PlotSquared instance;
// Implementation
@ -192,7 +192,7 @@ public class PlotSquared {
try {
this.loadCaptionMap();
} catch (final Exception e) {
logger.error("Failed to load caption map", e);
LOGGER.error("Failed to load caption map", e);
}
// Setup the global flag container
@ -269,7 +269,7 @@ public class PlotSquared {
captionMap = this.captionLoader.loadSingle(this.platform.getDirectory().toPath().resolve("lang").resolve(fileName));
}
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
logger.info(
LOGGER.info(
"Loaded caption map for namespace 'plotsquared': {}",
this.captionMaps.get(TranslatableCaption.DEFAULT_NAMESPACE).getClass().getCanonicalName()
);
@ -405,20 +405,20 @@ public class PlotSquared {
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
int height = (int) list.get(2);
logger.info(
LOGGER.info(
"Incomplete road regeneration found. Restarting in world {} with height {}",
plotArea.getWorldName(),
height
);
logger.info(" - Regions: {}", regions.size());
logger.info(" - Chunks: {}", chunks.size());
LOGGER.info("- Regions: {}", regions.size());
LOGGER.info("- Chunks: {}", chunks.size());
HybridUtils.UPDATE = true;
PlotSquared.platform().hybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
} catch (IOException | ClassNotFoundException e) {
logger.error("Error restarting road regeneration", e);
LOGGER.error("Error restarting road regeneration", e);
} finally {
if (!file.delete()) {
logger.error("Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
LOGGER.error("Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
}
}
});
@ -830,10 +830,10 @@ public class PlotSquared {
// Conventional plot generator
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
PlotManager plotManager = plotArea.getPlotManager();
logger.info("Detected world load for '{}'", world);
logger.info(" - generator: {}>{}", baseGenerator, plotGenerator);
logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName());
logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
LOGGER.info("Detected world load for '{}'", world);
LOGGER.info("- generator: {}>{}", baseGenerator, plotGenerator);
LOGGER.info("- plot world: {}", plotArea.getClass().getCanonicalName());
LOGGER.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
if (!this.worldConfiguration.contains(path)) {
this.worldConfiguration.createSection(path);
worldSection = this.worldConfiguration.getConfigurationSection(path);
@ -857,7 +857,7 @@ public class PlotSquared {
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
return;
}
logger.info("Detected world load for '{}'", world);
LOGGER.info("Detected world load for '{}'", world);
String gen_string = worldSection.getString("generator.plugin", platform.pluginName());
if (type == PlotAreaType.PARTIAL) {
Set<PlotCluster> clusters =
@ -873,7 +873,7 @@ public class PlotSquared {
String fullId = name + "-" + pos1 + "-" + pos2;
worldSection.createSection("areas." + fullId);
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
logger.info(" - {}-{}-{}", name, pos1, pos2);
LOGGER.info("- {}-{}-{}", name, pos1, pos2);
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -887,10 +887,10 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
logger.info(" | plot world: {}", pa);
logger.info(" | manager: {}", pa);
logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
LOGGER.info("| plot world: {}", pa);
LOGGER.info("| manager: {}", pa);
LOGGER.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
toLoad.add(pa);
@ -912,9 +912,9 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info(" - generator: {}>{}", baseGenerator, areaGen);
logger.info(" - plot world: {}", pa);
logger.info(" - plot area manager: {}", pa.getPlotManager());
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
LOGGER.info("- plot world: {}", pa);
LOGGER.info("- plot area manager: {}", pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -926,7 +926,7 @@ public class PlotSquared {
+ PlotAreaType.AUGMENTED + "`");
}
for (String areaId : areasSection.getKeys(false)) {
logger.info(" - {}", areaId);
LOGGER.info("- {}", areaId);
String[] split = areaId.split("(?<=[^;-])-");
if (split.length != 3) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
@ -988,10 +988,10 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info("Detected area load for '{}'", world);
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
logger.info(" | plot world: {}", pa);
logger.info(" | manager: {}", pa.getPlotManager());
LOGGER.info("Detected area load for '{}'", world);
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
LOGGER.info("| plot world: {}", pa);
LOGGER.info("| manager: {}", pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1069,7 +1069,7 @@ public class PlotSquared {
for (String element : split) {
String[] pair = element.split("=");
if (pair.length != 2) {
logger.error("No value provided for '{}'", element);
LOGGER.error("No value provided for '{}'", element);
return false;
}
String key = pair[0].toLowerCase();
@ -1116,12 +1116,12 @@ public class PlotSquared {
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
);
default -> {
logger.error("Key not found: {}", element);
LOGGER.error("Key not found: {}", element);
return false;
}
}
} catch (Exception e) {
logger.error("Invalid value '{}' for arg '{}'", value, element);
LOGGER.error("Invalid value '{}' for arg '{}'", value, element);
e.printStackTrace();
return false;
}
@ -1192,7 +1192,7 @@ public class PlotSquared {
}
}
} catch (IOException e) {
logger.error("Could not save {}", file);
LOGGER.error("Could not save {}", file);
e.printStackTrace();
}
}
@ -1215,7 +1215,7 @@ public class PlotSquared {
// Close the connection
DBFunc.close();
} catch (NullPointerException throwable) {
logger.error("Could not close database connection", throwable);
LOGGER.error("Could not close database connection", throwable);
throwable.printStackTrace();
}
}
@ -1228,9 +1228,9 @@ public class PlotSquared {
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
return;
}
logger.info("Road regeneration incomplete. Saving incomplete regions to disk");
logger.info(" - regions: {}", HybridUtils.regions.size());
logger.info(" - chunks: {}", HybridUtils.chunks.size());
LOGGER.info("Road regeneration incomplete. Saving incomplete regions to disk");
LOGGER.info("- regions: {}", HybridUtils.regions.size());
LOGGER.info("- chunks: {}", HybridUtils.chunks.size());
ArrayList<int[]> regions = new ArrayList<>();
ArrayList<int[]> chunks = new ArrayList<>();
for (BlockVector2 r : HybridUtils.regions) {
@ -1247,14 +1247,14 @@ public class PlotSquared {
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
.getId() + "_" + HybridUtils.area.getWorldName());
if (file.exists() && !file.delete()) {
logger.error("persistent_regene_data file already exists and could not be deleted");
LOGGER.error("persistent_regene_data file already exists and could not be deleted");
return;
}
try (ObjectOutputStream oos = new ObjectOutputStream(
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
oos.writeObject(list);
} catch (IOException e) {
logger.error("Error creating persistent_region_data file", e);
LOGGER.error("Error creating persistent_region_data file", e);
}
}
@ -1275,7 +1275,7 @@ public class PlotSquared {
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
database = new SQLite(file);
} else {
logger.error("No storage type is set. Disabling PlotSquared");
LOGGER.error("No storage type is set. Disabling PlotSquared");
this.platform.shutdown(); //shutdown used instead of disable because no database is set
return;
}
@ -1299,14 +1299,14 @@ public class PlotSquared {
}
this.clustersTmp = DBFunc.getClusters();
} catch (ClassNotFoundException | SQLException e) {
logger.error(
LOGGER.error(
"Failed to open database connection ({}). Disabling PlotSquared",
Storage.MySQL.USE ? "MySQL" : "SQLite"
);
logger.error("==== Here is an ugly stacktrace, if you are interested in those things ===");
LOGGER.error("==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace();
logger.error("==== End of stacktrace ====");
logger.error(
LOGGER.error("==== End of stacktrace ====");
LOGGER.error(
"Please go to the {} 'storage.yml' and configure the database correctly",
platform.pluginName()
);
@ -1332,7 +1332,7 @@ public class PlotSquared {
try {
worldConfiguration.save(worldsFile);
} catch (IOException e) {
logger.error("Failed to save worlds.yml", e);
LOGGER.error("Failed to save worlds.yml", e);
e.printStackTrace();
}
}
@ -1365,12 +1365,12 @@ public class PlotSquared {
public boolean setupConfigs() {
File folder = new File(this.platform.getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) {
logger.error("Failed to create the {} config folder. Please create it manually", this.platform.getDirectory());
LOGGER.error("Failed to create the {} config folder. Please create it manually", this.platform.getDirectory());
}
try {
this.worldsFile = new File(folder, "worlds.yml");
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
logger.error("Could not create the worlds file. Please create 'worlds.yml' manually");
LOGGER.error("Could not create the worlds file. Please create 'worlds.yml' manually");
}
this.worldConfiguration = YamlConfiguration.loadConfiguration(this.worldsFile);
@ -1380,21 +1380,21 @@ public class PlotSquared {
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
.getString("configuration_version").equalsIgnoreCase("v5"))) {
// Conversion needed
logger.info("A legacy configuration file was detected. Conversion will be attempted.");
LOGGER.info("A legacy configuration file was detected. Conversion will be attempted.");
try {
com.google.common.io.Files
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
logger.info("A copy of worlds.yml has been saved in the file worlds.yml.old");
LOGGER.info("A copy of worlds.yml has been saved in the file worlds.yml.old");
final ConfigurationSection worlds =
this.worldConfiguration.getConfigurationSection("worlds");
final LegacyConverter converter = new LegacyConverter(worlds);
converter.convert();
this.worldConfiguration.set("worlds", worlds);
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
logger.info(
LOGGER.info(
"The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
} catch (final Exception e) {
logger.error("Failed to convert the legacy configuration file. See stack trace for information.", e);
LOGGER.error("Failed to convert the legacy configuration file. See stack trace for information.", e);
}
// Disable plugin
this.platform.shutdown();
@ -1404,27 +1404,27 @@ public class PlotSquared {
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
}
} catch (IOException ignored) {
logger.error("Failed to save worlds.yml");
LOGGER.error("Failed to save worlds.yml");
}
try {
this.configFile = new File(folder, "settings.yml");
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
logger.error("Could not create the settings file. Please create 'settings.yml' manually");
LOGGER.error("Could not create the settings file. Please create 'settings.yml' manually");
}
this.config = YamlConfiguration.loadConfiguration(this.configFile);
setupConfig();
} catch (IOException ignored) {
logger.error("Failed to save settings.yml");
LOGGER.error("Failed to save settings.yml");
}
try {
this.storageFile = new File(folder, "storage.yml");
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
logger.error("Could not create the storage settings file. Please create 'storage.yml' manually");
LOGGER.error("Could not create the storage settings file. Please create 'storage.yml' manually");
}
YamlConfiguration.loadConfiguration(this.storageFile);
setupStorage();
} catch (IOException ignored) {
logger.error("Failed to save storage.yml");
LOGGER.error("Failed to save storage.yml");
}
return true;
}
@ -1455,7 +1455,7 @@ public class PlotSquared {
if (Settings.DEBUG) {
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
for (Entry<String, Object> component : components.entrySet()) {
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
LOGGER.info("Key: {} | Value: {}", component.getKey(), component.getValue());
}
}
}

View File

@ -47,8 +47,8 @@ import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@CommandDeclaration(
command = "claim",
@ -58,8 +58,7 @@ import org.slf4j.LoggerFactory;
usage = "/plot claim")
public class Claim extends SubCommand {
private static final Logger logger =
LoggerFactory.getLogger("P2/" + Claim.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Claim.class.getSimpleName());
private final EventDispatcher eventDispatcher;
private final EconHandler econHandler;
@ -195,7 +194,7 @@ public class Claim extends SubCommand {
try {
TaskManager.getPlatformImplementation().sync(() -> {
if (!plot.claim(player, true, finalSchematic, false)) {
logger.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
LOGGER.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
plot.setOwnerAbs(null);
} else if (area.isAutoMerge()) {
@ -222,7 +221,7 @@ public class Claim extends SubCommand {
e.printStackTrace();
}
}, () -> {
logger.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
LOGGER.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
plot.setOwnerAbs(null);
});

View File

@ -43,8 +43,8 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Arrays;
import java.util.LinkedList;
@ -58,7 +58,7 @@ import java.util.concurrent.CompletableFuture;
aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
public class MainCommand extends Command {
private static final Logger logger = LoggerFactory.getLogger("P2/" + MainCommand.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + MainCommand.class.getSimpleName());
private static MainCommand instance;
public Help help;
@ -78,7 +78,7 @@ public class MainCommand extends Command {
commands.add(Caps.class);
commands.add(Buy.class);
if (Settings.Web.LEGACY_WEBINTERFACE) {
logger.warn("Legacy webinterface is used. Please note that it will be removed in future.");
LOGGER.warn("Legacy webinterface is used. Please note that it will be removed in future.");
commands.add(Save.class);
}
commands.add(Load.class);
@ -154,7 +154,7 @@ public class MainCommand extends Command {
try {
injector.getInstance(command);
} catch (final Exception e) {
logger.error("Failed to register command {}", command.getCanonicalName());
LOGGER.error("Failed to register command {}", command.getCanonicalName());
e.printStackTrace();
}
}

View File

@ -41,8 +41,8 @@ import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashMap;
import java.util.HashSet;
@ -59,7 +59,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
confirmation = true)
public class Purge extends SubCommand {
private static final Logger logger = LoggerFactory.getLogger("P2/" + Purge.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Purge.class.getSimpleName());
private final PlotAreaManager plotAreaManager;
private final PlotListener plotListener;
@ -205,7 +205,7 @@ public class Purge extends SubCommand {
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
boolean finalClear = clear;
Runnable run = () -> {
logger.info("Calculating plots to purge, please wait...");
LOGGER.info("Calculating plots to purge, please wait...");
HashSet<Integer> ids = new HashSet<>();
Iterator<Plot> iterator = toDelete.iterator();
AtomicBoolean cleared = new AtomicBoolean(true);
@ -220,7 +220,7 @@ public class Purge extends SubCommand {
ids.add(plot.temp);
if (finalClear) {
plot.getPlotModificationManager().clear(false, true, player, () -> {
logger.info("Plot {} cleared by purge", plot.getId());
LOGGER.info("Plot {} cleared by purge", plot.getId());
});
} else {
plot.getPlotModificationManager().removeSign();
@ -230,7 +230,7 @@ public class Purge extends SubCommand {
Purge.this.plotListener.plotEntry(pp, plot);
}
} catch (NullPointerException e) {
logger.error("NullPointer during purge detected. This is likely"
LOGGER.error("NullPointer during purge detected. This is likely"
+ " because you are deleting a world that has been removed", e);
}
}

View File

@ -47,8 +47,8 @@ import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashSet;
import java.util.Iterator;
@ -62,7 +62,7 @@ import java.util.Set;
category = CommandCategory.ADMINISTRATION)
public class Trim extends SubCommand {
private static final Logger logger = LoggerFactory.getLogger("P2/" + Trim.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Trim.class.getSimpleName());
private static volatile boolean TASK = false;
private final PlotAreaManager plotAreaManager;
@ -152,16 +152,16 @@ public class Trim extends SubCommand {
public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
Runnable regenTask;
if (regen) {
logger.info("Starting regen task");
logger.info(" - This is a VERY slow command");
logger.info(" - It will say 'Trim done!' when complete");
LOGGER.info("Starting regen task");
LOGGER.info(" - This is a VERY slow command");
LOGGER.info(" - It will say 'Trim done!' when complete");
regenTask = new Runnable() {
@Override
public void run() {
if (nonViable.isEmpty()) {
Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("Trim done!");
LOGGER.info("Trim done!");
return;
}
Iterator<BlockVector2> iterator = nonViable.iterator();
@ -212,7 +212,7 @@ public class Trim extends SubCommand {
regenTask = () -> {
Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("Trim done!");
LOGGER.info("Trim done!");
};
}
regionManager.deleteRegionFiles(world, viable, regenTask);

View File

@ -49,8 +49,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
@ -68,7 +68,7 @@ import java.util.stream.Collectors;
public class ComponentPresetManager {
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private static final Logger logger = LoggerFactory.getLogger("P2/" + ComponentPresetManager.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ComponentPresetManager.class.getSimpleName());
private final List<ComponentPreset> presets;
private final String guiName;
@ -84,7 +84,7 @@ public class ComponentPresetManager {
final File oldLocation = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "components.yml");
final File folder = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) {
logger.error("Failed to create the /plugins/PlotSquared/config folder. Please create it manually");
LOGGER.error("Failed to create the /plugins/PlotSquared/config folder. Please create it manually");
}
if (oldLocation.exists()) {
Path oldLoc = Paths.get(PlotSquared.platform().getDirectory() + "/components.yml");
@ -94,7 +94,7 @@ public class ComponentPresetManager {
try {
this.componentsFile = new File(folder, "components.yml");
if (!this.componentsFile.exists() && !this.componentsFile.createNewFile()) {
logger.error("Could not create the components.yml file. Please create 'components.yml' manually.");
LOGGER.error("Could not create the components.yml file. Please create 'components.yml' manually.");
}
} catch (IOException e) {
e.printStackTrace();
@ -109,7 +109,7 @@ public class ComponentPresetManager {
try {
yamlConfiguration.save(this.componentsFile);
} catch (IOException e) {
logger.error("Failed to save default values to components.yml", e);
LOGGER.error("Failed to save default values to components.yml", e);
}
}
this.guiName = yamlConfiguration.getString("title", "&6Plot Components");
@ -135,7 +135,7 @@ public class ComponentPresetManager {
try {
yamlConfiguration.save(this.componentsFile);
} catch (final IOException e) {
logger.error("Failed to save default values to components.yml", e);
LOGGER.error("Failed to save default values to components.yml", e);
}
this.presets = defaultPreset;
}

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.configuration;
import com.plotsquared.core.configuration.Settings.Enabled_Components;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.util.StringMan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.PrintWriter;
@ -47,7 +47,7 @@ import java.util.Map;
public class Config {
private static final Logger logger = LoggerFactory.getLogger("P2/" + Config.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Config.class.getSimpleName());
/**
* Get the value for a node<br>
@ -98,12 +98,12 @@ public class Config {
field.set(instance, value);
return;
} catch (final Throwable e) {
logger.error("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
LOGGER.error("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
e.printStackTrace();
}
}
}
logger.error("Failed to set config option '{}: {}' | {}", key, value, instance);
LOGGER.error("Failed to set config option '{}: {}' | {}", key, value, instance);
}
public static boolean load(File file, Class<? extends Config> root) {
@ -287,7 +287,7 @@ public class Config {
setAccessible(field);
return field;
} catch (final Throwable e) {
logger.error("Invalid config field: {} for {}. It's likely you are in the process of updating from an older major " +
LOGGER.error("Invalid config field: {} for {}. It's likely you are in the process of updating from an older major " +
"release of PlotSquared. The entries named can be removed safely from the settings.yml. They are " +
"likely no longer in use, moved to a different location or have been merged with other " +
"configuration options. Check the changelog for more information.",

View File

@ -33,8 +33,8 @@ import com.plotsquared.core.configuration.caption.LocalizedCaptionMap;
import com.plotsquared.core.configuration.caption.PerUserLocaleCaptionMap;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@ -61,7 +61,7 @@ import java.util.stream.Stream;
*/
public final class CaptionLoader {
private static final Logger logger = LoggerFactory.getLogger("P2/" + CaptionLoader.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + CaptionLoader.class.getSimpleName());
private static final Gson GSON;
@ -89,7 +89,7 @@ public final class CaptionLoader {
try {
temp = this.captionProvider.loadDefaults(internalLocale);
} catch (Exception e) {
logger.error("Failed to load default messages", e);
LOGGER.error("Failed to load default messages", e);
temp = Collections.emptyMap();
}
this.defaultMessages = temp;
@ -159,9 +159,9 @@ public final class CaptionLoader {
private static void save(final Path file, final Map<String, String> content) {
try (final BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
GSON.toJson(content, writer);
logger.info("Saved {} with new content", file.getFileName());
LOGGER.info("Saved {} with new content", file.getFileName());
} catch (final IOException e) {
logger.error("Failed to save caption file '{}'", file.getFileName().toString(), e);
LOGGER.error("Failed to save caption file '{}'", file.getFileName().toString(), e);
}
}
@ -183,10 +183,10 @@ public final class CaptionLoader {
final CaptionMap localeMap = loadSingle(file);
localeMaps.put(localeMap.getLocale(), localeMap);
} catch (Exception e) {
logger.error("Failed to load language file '{}'", file.getFileName().toString(), e);
LOGGER.error("Failed to load language file '{}'", file.getFileName().toString(), e);
}
}
logger.info("Loaded {} message files. Loaded Languages: {}", localeMaps.size(), localeMaps.keySet());
LOGGER.info("Loaded {} message files. Loaded Languages: {}", localeMaps.size(), localeMaps.keySet());
return new PerUserLocaleCaptionMap(localeMaps);
}
}

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.configuration.caption.load;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.IOException;
@ -42,7 +42,7 @@ import static com.plotsquared.core.configuration.caption.load.CaptionLoader.load
final class ClassLoaderCaptionProvider implements DefaultCaptionProvider {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ClassLoaderCaptionProvider.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ClassLoaderCaptionProvider.class.getSimpleName());
private final ClassLoader classLoader;
private final Function<@NonNull Locale, @NonNull String> urlProvider;
@ -60,14 +60,14 @@ final class ClassLoaderCaptionProvider implements DefaultCaptionProvider {
try {
final InputStream stream = this.classLoader.getResourceAsStream(url);
if (stream == null) {
logger.warn("No resource for locale '{}' found", locale);
LOGGER.warn("No resource for locale '{}' found", locale);
return null;
}
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
return loadFromReader(reader);
}
} catch (final IOException e) {
logger.error("Unable to load language resource", e);
LOGGER.error("Unable to load language resource", e);
return null;
}
}

View File

@ -28,8 +28,8 @@ package com.plotsquared.core.configuration.file;
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.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
@ -47,7 +47,7 @@ import java.util.Map;
*/
public class YamlConfiguration extends FileConfiguration {
private static final Logger logger = LoggerFactory.getLogger("P2/" + YamlConfiguration.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + YamlConfiguration.class.getSimpleName());
private static final String COMMENT_PREFIX = "# ";
private static final String BLANK_CONFIG = "{}\n";
@ -80,11 +80,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
}
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
logger.error("Could not read: {}", file);
logger.error("Renamed to: {}", file);
logger.error("============ Full stacktrace ============");
LOGGER.error("Could not read: {}", file);
LOGGER.error("Renamed to: {}", file);
LOGGER.error("============ Full stacktrace ============");
ex.printStackTrace();
logger.error("=========================================");
LOGGER.error("=========================================");
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -51,8 +51,8 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@ -84,7 +84,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("SqlDialectInspection")
public class SQLManager implements AbstractDB {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SQLManager.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SQLManager.class.getSimpleName());
// Public final
public final String SET_OWNER;
@ -381,12 +381,12 @@ public class SQLManager implements AbstractDB {
try {
task.run();
} catch (Throwable e) {
logger.error("============ DATABASE ERROR ============");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("There was an error updating the database.");
LOGGER.error(" - It will be corrected on shutdown");
e.printStackTrace();
logger.error("========================================");
LOGGER.error("========================================");
}
}
commit();
@ -436,12 +436,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("There was an error updating the database.");
LOGGER.error(" - It will be corrected on shutdown");
LOGGER.error("========================================");
e.printStackTrace();
logger.error("========================================");
LOGGER.error("========================================");
}
}
if (statement != null && task != null) {
@ -481,12 +481,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("There was an error updating the database.");
LOGGER.error(" - It will be corrected on shutdown");
LOGGER.error("========================================");
e.printStackTrace();
logger.error("========================================");
LOGGER.error("========================================");
}
}
if (statement != null && task != null) {
@ -527,12 +527,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("There was an error updating the database.");
LOGGER.error(" - It will be corrected on shutdown");
LOGGER.error("========================================");
e.printStackTrace();
logger.error("========================================");
LOGGER.error("========================================");
}
}
if (statement != null && task != null) {
@ -556,12 +556,12 @@ public class SQLManager implements AbstractDB {
this.plotTasks.clear();
}
} catch (Throwable e) {
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
LOGGER.error("============ DATABASE ERROR ============");
LOGGER.error("There was an error updating the database.");
LOGGER.error(" - It will be corrected on shutdown");
LOGGER.error("========================================");
e.printStackTrace();
logger.error("========================================");
LOGGER.error("========================================");
}
return false;
}
@ -657,7 +657,7 @@ public class SQLManager implements AbstractDB {
)
));
} catch (SQLException e) {
logger.warn("Failed to set all flags and member tiers for plots", e);
LOGGER.warn("Failed to set all flags and member tiers for plots", e);
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -666,7 +666,7 @@ public class SQLManager implements AbstractDB {
}
});
} catch (Exception e) {
logger.warn("Warning! Failed to set all helper for plots", e);
LOGGER.warn("Warning! Failed to set all helper for plots", e);
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -743,19 +743,19 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("Failed to store flag values for plot with entry ID: {}", plot);
LOGGER.error("Failed to store flag values for plot with entry ID: {}", plot);
e.printStackTrace();
continue;
}
logger.info(
LOGGER.info(
"- Finished converting flag values for plot with entry ID: {}",
plot.getId()
);
}
} catch (final Exception e) {
logger.error("Failed to store flag values", e);
LOGGER.error("Failed to store flag values", e);
}
logger.info("Finished converting flags ({} plots processed)", plots.size());
LOGGER.info("Finished converting flags ({} plots processed)", plots.size());
whenDone.run();
}
@ -879,7 +879,7 @@ public class SQLManager implements AbstractDB {
return;
} catch (SQLException e) {
if (this.mySQL) {
logger.error("1: | {}", objList.get(0).getClass().getCanonicalName());
LOGGER.error("1: | {}", objList.get(0).getClass().getCanonicalName());
e.printStackTrace();
}
}
@ -917,8 +917,8 @@ public class SQLManager implements AbstractDB {
preparedStmt.close();
} catch (SQLException e) {
e.printStackTrace();
logger.error("2: | {}", objList.get(0).getClass().getCanonicalName());
logger.error("Could not bulk save!");
LOGGER.error("2: | {}", objList.get(0).getClass().getCanonicalName());
LOGGER.error("Could not bulk save!");
try (PreparedStatement preparedStmt = this.connection
.prepareStatement(mod.getCreateSQL())) {
for (T obj : objList) {
@ -927,7 +927,7 @@ public class SQLManager implements AbstractDB {
}
preparedStmt.executeBatch();
} catch (SQLException e3) {
logger.error("Failed to save all", e);
LOGGER.error("Failed to save all", e);
e3.printStackTrace();
}
}
@ -979,7 +979,7 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("Failed to store settings for plot with entry ID: {}", legacySettings.id);
LOGGER.error("Failed to store settings for plot with entry ID: {}", legacySettings.id);
e.printStackTrace();
continue;
}
@ -991,13 +991,13 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("Failed to store settings", e);
LOGGER.error("Failed to store settings", e);
}
}
} catch (final Exception e) {
logger.error("Failed to store settings", e);
LOGGER.error("Failed to store settings", e);
}
logger.info("Finished converting settings ({} plots processed)", myList.size());
LOGGER.info("Finished converting settings ({} plots processed)", myList.size());
whenDone.run();
}
@ -1736,11 +1736,11 @@ public class SQLManager implements AbstractDB {
}
}
} catch (final Exception e) {
logger.error("Failed to load old flag values", e);
LOGGER.error("Failed to load old flag values", e);
return false;
}
logger.info("Loaded {} plot flag collections...", flagMap.size());
logger.info("Attempting to store these flags in the new table...");
LOGGER.info("Loaded {} plot flag collections...", flagMap.size());
LOGGER.info("Attempting to store these flags in the new table...");
try (final PreparedStatement preparedStatement = this.connection.prepareStatement(
"INSERT INTO `" + SQLManager.this.prefix
+ "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) {
@ -1768,7 +1768,7 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey());
LOGGER.error("Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey());
e.printStackTrace();
continue;
}
@ -1776,18 +1776,18 @@ public class SQLManager implements AbstractDB {
if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap
.size()) {
timeStarted = System.currentTimeMillis();
logger.info(
LOGGER.info(
"... Flag conversion in progress. {}% done",
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100)
);
}
logger.info(
LOGGER.info(
"- Finished converting flags for plot with entry ID: {}",
plotFlagEntry.getKey()
);
}
} catch (final Exception e) {
logger.error("Failed to store flag values", e);
LOGGER.error("Failed to store flag values", e);
return false;
}
return true;
@ -1881,7 +1881,7 @@ public class SQLManager implements AbstractDB {
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
.getTime();
} catch (ParseException e) {
logger.error("Could not parse date for plot: #{}({};{}) ({})",
LOGGER.error("Could not parse date for plot: #{}({};{}) ({})",
id, areaID, plot_id, parsable
);
time = System.currentTimeMillis() + id;
@ -1898,7 +1898,7 @@ public class SQLManager implements AbstractDB {
if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(last.temp);
} else {
logger.info(
LOGGER.info(
"Plot #{}({}) in `{}plot` is a duplicate."
+ " Delete this plot or set `database-purger: true` in the settings.yml",
id,
@ -1935,7 +1935,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_rating` does not exist."
LOGGER.info("Entry #{}({}) in `plot_rating` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -1963,7 +1963,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_helpers` does not exist."
LOGGER.info("Entry #{}({}) in `plot_helpers` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -1990,7 +1990,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_trusted` does not exist."
LOGGER.info("Entry #{}({}) in `plot_trusted` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -2017,7 +2017,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_denied` does not exist."
LOGGER.info("Entry #{}({}) in `plot_denied` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -2045,8 +2045,8 @@ public class SQLManager implements AbstractDB {
plot.getFlagContainer().addFlag(plotFlag.parse(value));
} catch (final FlagParseException e) {
e.printStackTrace();
logger.error("Plot with ID {} has an invalid value:", id);
logger.error("Failed to parse flag '{}', value '{}': {}",
LOGGER.error("Plot with ID {} has an invalid value:", id);
LOGGER.error("Failed to parse flag '{}', value '{}': {}",
plotFlag.getName(), e.getValue(), e.getErrorMessage()
);
if (!invalidFlags.containsKey(plot)) {
@ -2058,7 +2058,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_flags` does not exist."
LOGGER.info("Entry #{}({}) in `plot_flags` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -2068,7 +2068,7 @@ public class SQLManager implements AbstractDB {
for (final Map.Entry<Plot, Collection<PlotFlag<?, ?>>> plotFlagEntry : invalidFlags
.entrySet()) {
for (final PlotFlag<?, ?> flag : plotFlagEntry.getValue()) {
logger.info(
LOGGER.info(
"Plot {} has an invalid flag ({}). A fix has been attempted",
plotFlagEntry.getKey(), flag.getName()
);
@ -2113,7 +2113,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else {
logger.info("Entry #{}({}) in `plot_settings` does not exist."
LOGGER.info("Entry #{}({}) in `plot_settings` does not exist."
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
}
}
@ -2131,16 +2131,16 @@ public class SQLManager implements AbstractDB {
String worldName = entry.getKey();
invalidPlot = true;
if (Settings.DEBUG) {
logger.info("Warning! Found {} plots in DB for non existent world: '{}'",
LOGGER.info("Warning! Found {} plots in DB for non existent world: '{}'",
entry.getValue().intValue(), worldName
);
}
}
if (invalidPlot && Settings.DEBUG) {
logger.info("Warning! Please create the world(s) or remove the plots using the purge command");
LOGGER.info("Warning! Please create the world(s) or remove the plots using the purge command");
}
} catch (SQLException e) {
logger.error("Failed to load plots", e);
LOGGER.error("Failed to load plots", e);
}
return newPlots;
}
@ -2185,7 +2185,7 @@ public class SQLManager implements AbstractDB {
preparedStatement.setInt(3, id2);
preparedStatement.execute();
} catch (final Exception e) {
logger.error("Failed to persist wap of {} and {}", plot1, plot2);
LOGGER.error("Failed to persist wap of {} and {}", plot1, plot2);
e.printStackTrace();
future.complete(false);
return;
@ -2340,11 +2340,11 @@ public class SQLManager implements AbstractDB {
commit();
}
} catch (SQLException e) {
logger.error("Failed to purge plots", e);
LOGGER.error("Failed to purge plots", e);
return;
}
}
logger.info("Successfully purged {} plots", uniqueIds.size());
LOGGER.info("Successfully purged {} plots", uniqueIds.size());
});
}
@ -2367,7 +2367,7 @@ public class SQLManager implements AbstractDB {
}
purgeIds(ids);
} catch (SQLException e) {
logger.error("Failed to purge area '{}'", area);
LOGGER.error("Failed to purge area '{}'", area);
e.printStackTrace();
}
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
@ -2661,7 +2661,7 @@ public class SQLManager implements AbstractDB {
}
}
} catch (SQLException e) {
logger.error("Failed to fetch rating for plot {}", plot.getId().toString());
LOGGER.error("Failed to fetch rating for plot {}", plot.getId().toString());
e.printStackTrace();
}
return map;
@ -2905,7 +2905,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.helpers.add(user);
} else {
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
LOGGER.warn("Cluster #{}({}) in cluster_helpers does not exist."
+ " Please create the cluster or remove this entry", id, cluster);
}
}
@ -2924,7 +2924,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.invited.add(user);
} else {
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
LOGGER.warn("Cluster #{}({}) in cluster_helpers does not exist."
+ " Please create the cluster or remove this entry", id, cluster);
}
}
@ -2959,7 +2959,7 @@ public class SQLManager implements AbstractDB {
}
cluster.settings.setMerged(merged);
} else {
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
LOGGER.warn("Cluster #{}({}) in cluster_helpers does not exist."
+ " Please create the cluster or remove this entry", id, cluster);
}
}
@ -2969,13 +2969,13 @@ public class SQLManager implements AbstractDB {
for (Entry<String, Integer> entry : noExist.entrySet()) {
String a = entry.getKey();
invalidPlot = true;
logger.warn("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
LOGGER.warn("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
}
if (invalidPlot) {
logger.warn("Warning! Please create the world(s) or remove the clusters using the purge command");
LOGGER.warn("Warning! Please create the world(s) or remove the clusters using the purge command");
}
} catch (SQLException e) {
logger.error("Failed to load clusters", e);
LOGGER.error("Failed to load clusters", e);
}
return newClusters;
}
@ -3201,7 +3201,7 @@ public class SQLManager implements AbstractDB {
if (!isValid()) {
reconnect();
}
logger.info(
LOGGER.info(
"All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
commit();
while (true) {
@ -3223,13 +3223,13 @@ public class SQLManager implements AbstractDB {
continue;
}
if (plot.getArea() == null) {
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
logger.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
LOGGER.error("CRITICAL ERROR IN VALIDATION TASK!");
LOGGER.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
continue;
}
if (database == null) {
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
logger.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
LOGGER.error("CRITICAL ERROR IN VALIDATION TASK!");
LOGGER.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
break;
}
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());

View File

@ -26,8 +26,8 @@
package com.plotsquared.core.database;
import com.plotsquared.core.PlotSquared;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
@ -42,7 +42,7 @@ import java.sql.Statement;
*/
public class SQLite extends Database {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SQLite.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SQLite.class.getSimpleName());
private final String dbLocation;
private Connection connection;
@ -69,7 +69,7 @@ public class SQLite extends Database {
try {
file.createNewFile();
} catch (IOException ignored) {
logger.error("Unable to create database");
LOGGER.error("Unable to create database");
}
}
Class.forName("org.sqlite.JDBC");

View File

@ -59,8 +59,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.lang.reflect.Field;
@ -69,7 +69,7 @@ import java.util.Locale;
public class HybridPlotWorld extends ClassicPlotWorld {
private static final Logger logger = LoggerFactory.getLogger("P2/" + HybridPlotWorld.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridPlotWorld.class.getSimpleName());
private static final AffineTransform transform = new AffineTransform().rotateY(90);
public boolean ROAD_SCHEMATIC_ENABLED;
public boolean PLOT_SCHEMATIC = false;
@ -190,7 +190,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
// Dump world settings
if (Settings.DEBUG) {
logger.info("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
LOGGER.info("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
final Field[] fields = this.getClass().getFields();
for (final Field field : fields) {
final String name = field.getName().toLowerCase(Locale.ENGLISH);
@ -206,7 +206,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} catch (final IllegalAccessException e) {
value = String.format("Failed to parse: %s", e.getMessage());
}
logger.info("-- {} = {}", name, value);
LOGGER.info("-- {} = {}", name, value);
}
}
}
@ -323,12 +323,12 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
if (Settings.DEBUG) {
logger.info(" - plot schematic: {}", schematic3File.getPath());
LOGGER.info("- plot schematic: {}", schematic3File.getPath());
}
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
if (Settings.DEBUG) {
logger.info(" - schematic: false");
LOGGER.info("- schematic: false");
}
return;
}
@ -411,7 +411,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
int pair = MathMan.pair(x, z);
BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
if (y >= height) {
logger.error("Error adding overlay block. `y > height`");
LOGGER.error("Error adding overlay block. `y > height`");
return;
}
existing[y] = id;

View File

@ -62,8 +62,8 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.ArrayDeque;
@ -79,7 +79,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class HybridUtils {
private static final Logger logger = LoggerFactory.getLogger("P2/" + HybridUtils.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
public static HybridUtils manager;
public static Set<BlockVector2> regions;
@ -431,21 +431,21 @@ public class HybridUtils {
iter.remove();
boolean regenedRoad = regenerateRoad(area, chunk, extend);
if (!regenedRoad) {
logger.info("Failed to regenerate roads");
LOGGER.info("Failed to regenerate roads");
}
}
logger.info("Cancelled road task");
LOGGER.info("Cancelled road task");
return;
}
count.incrementAndGet();
if (count.intValue() % 20 == 0) {
logger.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
LOGGER.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
}
if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) {
regeneratePlotWalls(area);
HybridUtils.UPDATE = false;
logger.info("Finished road conversion");
LOGGER.info("Finished road conversion");
// CANCEL TASK
} else {
final Runnable task = this;
@ -456,8 +456,8 @@ public class HybridUtils {
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
BlockVector2 loc = iterator.next();
iterator.remove();
logger.info("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
logger.info("- Remaining: {}", HybridUtils.regions.size());
LOGGER.info("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
LOGGER.info("- Remaining: {}", HybridUtils.regions.size());
chunks.addAll(getChunks(loc));
System.gc();
}
@ -471,7 +471,7 @@ public class HybridUtils {
iterator.remove();
boolean regenedRoads = regenerateRoad(area, chunk, extend);
if (!regenedRoads) {
logger.info("Failed to regenerate road");
LOGGER.info("Failed to regenerate road");
}
}
return null;
@ -482,7 +482,7 @@ public class HybridUtils {
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
BlockVector2 loc = iterator.next();
iterator.remove();
logger.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
LOGGER.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
area.getWorldHash(),
loc.getX(),
loc.getZ()

View File

@ -37,8 +37,8 @@ import com.plotsquared.core.util.RegionManager;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Iterator;
import java.util.Set;
@ -48,7 +48,7 @@ import java.util.Set;
*/
public abstract class SquarePlotManager extends GridPlotManager {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquarePlotManager.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SquarePlotManager.class.getSimpleName());
private final SquarePlotWorld squarePlotWorld;
private final RegionManager regionManager;
@ -244,7 +244,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
return plot.isMerged(Direction.NORTHWEST) ? id : null;
}
} catch (Exception ignored) {
logger.error("Invalid plot / road width in settings.yml for world: {}", squarePlotWorld.getWorldName());
LOGGER.error("Invalid plot / road width in settings.yml for world: {}", squarePlotWorld.getWorldName());
}
return null;
}

View File

@ -33,12 +33,12 @@ import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.queue.GlobalBlockQueue;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public abstract class SquarePlotWorld extends GridPlotWorld {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquarePlotWorld.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SquarePlotWorld.class.getSimpleName());
public int PLOT_WIDTH = 42;
public int ROAD_WIDTH = 7;
@ -61,7 +61,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
public void loadConfiguration(ConfigurationSection config) {
if (!config.contains("plot.height")) {
if (Settings.DEBUG) {
logger.info(" - Configuration is null? ({})", config.getCurrentPath());
LOGGER.info("- Configuration is null? ({})", config.getCurrentPath());
}
}

View File

@ -43,8 +43,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Field;
import java.util.HashMap;
@ -53,7 +53,7 @@ import java.util.Set;
public class ProcessedWEExtent extends AbstractDelegateExtent {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ProcessedWEExtent.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ProcessedWEExtent.class.getSimpleName());
private final Set<CuboidRegion> mask;
private final String world;

View File

@ -68,10 +68,10 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.title.Title;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.time.Duration;
@ -95,7 +95,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
private static final String NON_EXISTENT_CAPTION = "<red>PlotSquared does not recognize the caption: ";
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotPlayer.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotPlayer.class.getSimpleName());
// Used to track debug mode
private static final Set<PlotPlayer<?>> debugModeEnabled =
@ -586,7 +586,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
for (Plot owned : getPlots()) {
owned.getPlotModificationManager().deletePlot(null, null);
logger.info("Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
LOGGER.info("Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
}
}
if (ExpireManager.IMP != null) {

View File

@ -82,8 +82,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
@ -124,7 +124,7 @@ public class Plot {
public static final int MAX_HEIGHT = 256;
private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Plot.class.getSimpleName());
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
@ -328,7 +328,7 @@ public class Plot {
if (arg == null) {
if (player == null) {
if (message) {
logger.info("No plot area string was supplied");
LOGGER.info("No plot area string was supplied");
}
return null;
}
@ -1668,7 +1668,7 @@ public class Plot {
if (updateDB) {
if (!this.getPlotModificationManager().create(player.getUUID(), true)) {
logger.error("Player {} attempted to claim plot {}, but the database failed to update", player.getName(),
LOGGER.error("Player {} attempted to claim plot {}, but the database failed to update", player.getName(),
this.getId().toCommaSeparatedString()
);
return false;

View File

@ -72,8 +72,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -95,7 +95,7 @@ import java.util.function.Consumer;
*/
public abstract class PlotArea {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotArea.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotArea.class.getSimpleName());
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
@ -199,7 +199,7 @@ public abstract class PlotArea {
try {
flags.add(flagInstance.parse(split[1]));
} catch (final FlagParseException e) {
logger.warn(
LOGGER.warn(
"Failed to parse default flag with key '{}' and value '{}'. "
+ "Reason: {}. This flag will not be added as a default flag.",
e.getFlag().getName(),

View File

@ -54,8 +54,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -75,7 +75,7 @@ import static com.plotsquared.core.plot.Plot.MAX_HEIGHT;
*/
public final class PlotModificationManager {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotModificationManager.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotModificationManager.class.getSimpleName());
private final Plot plot;
private final ProgressSubscriberFactory subscriberFactory;
@ -504,7 +504,7 @@ public final class PlotModificationManager {
});
return true;
}
logger.info(
LOGGER.info(
"Failed to add plot {} to plot area {}",
this.plot.getId().toCommaSeparatedString(),
this.plot.getArea().toString()

View File

@ -34,8 +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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class PlotAnalysis {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotAnalysis.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotAnalysis.class.getSimpleName());
public static boolean running = false;
public int changes;
@ -97,11 +97,11 @@ public class PlotAnalysis {
*/
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) {
logger.info("Calibration task already in progress!");
LOGGER.info("Calibration task already in progress!");
return;
}
if (threshold <= 0 || threshold >= 1) {
logger.info("Invalid threshold provided! (Cannot be 0 or 100 as then there's no point in calibrating)");
LOGGER.info("Invalid threshold provided! (Cannot be 0 or 100 as then there's no point in calibrating)");
return;
}
running = true;
@ -110,7 +110,7 @@ public class PlotAnalysis {
@Override
public void run() {
Iterator<Plot> iterator = plots.iterator();
logger.info("- Reducing {} plots to those with sufficient data", plots.size());
LOGGER.info("- Reducing {} plots to those with sufficient data", plots.size());
while (iterator.hasNext()) {
Plot plot = iterator.next();
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
@ -122,14 +122,14 @@ public class PlotAnalysis {
}
if (plots.size() < 3) {
logger.info("Calibration cancelled due to insufficient comparison data, please try again later");
LOGGER.info("Calibration cancelled due to insufficient comparison data, please try again later");
running = false;
for (Plot plot : plots) {
plot.removeRunning();
}
return;
}
logger.info("- Analyzing plot contents (this may take a while)");
LOGGER.info("- Analyzing plot contents (this may take a while)");
int[] changes = new int[plots.size()];
int[] faces = new int[plots.size()];
@ -154,7 +154,7 @@ public class PlotAnalysis {
ratings[i] = (int) (
(plot.getAverageRating() + plot.getSettings().getRatings().size())
* 100);
logger.info(" | {} (rating) {}", plot, ratings[i]);
LOGGER.info(" | {} (rating) {}", plot, ratings[i]);
}
});
@ -166,7 +166,7 @@ public class PlotAnalysis {
if (queuePlot == null) {
break;
}
logger.info(" | {}", queuePlot);
LOGGER.info(" | {}", queuePlot);
final Object lock = new Object();
TaskManager.runTask(new Runnable() {
@ -199,7 +199,7 @@ public class PlotAnalysis {
}
}
logger.info(" - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
LOGGER.info("- Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
try {
ratingAnalysis.join();
@ -207,11 +207,11 @@ public class PlotAnalysis {
e.printStackTrace();
}
logger.info(" - Processing and grouping single plot analysis for bulk processing");
LOGGER.info("- Processing and grouping single plot analysis for bulk processing");
for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i);
logger.info(" | {}", plot);
LOGGER.info("| {}", plot);
PlotAnalysis analysis = plot.getComplexity(null);
@ -228,16 +228,16 @@ public class PlotAnalysis {
variety_sd[i] = analysis.variety_sd;
}
logger.info(" - Calculating rankings");
LOGGER.info("- Calculating rankings");
int[] rankRatings = rank(ratings);
int n = rankRatings.length;
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
logger.info(" - 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");
LOGGER.info("- 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();
@ -250,7 +250,7 @@ public class PlotAnalysis {
0 :
(int) (factorChanges * 1000 / MathMan.getMean(changes));
logger.info(" - | changes {}", factorChanges);
LOGGER.info("- | changes {}", factorChanges);
int[] rankFaces = rank(faces);
int[] sdFaces = getSD(rankFaces, rankRatings);
@ -260,7 +260,7 @@ public class PlotAnalysis {
settings.CALIBRATION.FACES =
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
logger.info(" - | faces {}", factorFaces);
LOGGER.info("- | faces {}", factorFaces);
int[] rankData = rank(data);
int[] sdData = getSD(rankData, rankRatings);
@ -270,7 +270,7 @@ public class PlotAnalysis {
settings.CALIBRATION.DATA =
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
logger.info(" - | data {}", factor_data);
LOGGER.info("- | data {}", factor_data);
int[] rank_air = rank(air);
int[] sd_air = getSD(rank_air, rankRatings);
@ -280,7 +280,7 @@ public class PlotAnalysis {
settings.CALIBRATION.AIR =
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
logger.info("- | air {}", factor_air);
LOGGER.info("- | air {}", factor_air);
int[] rank_variety = rank(variety);
@ -292,7 +292,7 @@ public class PlotAnalysis {
0 :
(int) (factor_variety * 1000 / MathMan.getMean(variety));
logger.info("- | variety {}", factor_variety);
LOGGER.info("- | variety {}", factor_variety);
int[] rank_changes_sd = rank(changes_sd);
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
@ -303,7 +303,7 @@ public class PlotAnalysis {
0 :
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
logger.info(" - | changed_sd {}", factor_changes_sd);
LOGGER.info("- | changed_sd {}", factor_changes_sd);
int[] rank_faces_sd = rank(faces_sd);
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
@ -314,7 +314,7 @@ public class PlotAnalysis {
0 :
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
logger.info(" - | faced_sd {}", factor_faces_sd);
LOGGER.info("- | faced_sd {}", factor_faces_sd);
int[] rank_data_sd = rank(data_sd);
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
@ -325,7 +325,7 @@ public class PlotAnalysis {
0 :
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
logger.info(" - | data_sd {}", factor_data_sd);
LOGGER.info("- | data_sd {}", factor_data_sd);
int[] rank_air_sd = rank(air_sd);
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
@ -335,7 +335,7 @@ public class PlotAnalysis {
settings.CALIBRATION.AIR_SD =
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
logger.info(" - | air_sd {}", factor_air_sd);
LOGGER.info("- | air_sd {}", factor_air_sd);
int[] rank_variety_sd = rank(variety_sd);
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
@ -346,11 +346,11 @@ public class PlotAnalysis {
0 :
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
logger.info(" - | variety_sd {}", factor_variety_sd);
LOGGER.info("- | variety_sd {}", factor_variety_sd);
int[] complexity = new int[n];
logger.info("Calculating threshold");
LOGGER.info("Calculating threshold");
int max = 0;
int min = 0;
@ -380,7 +380,7 @@ public class PlotAnalysis {
logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
if (optimalComplexity == Integer.MAX_VALUE) {
logger.info("Insufficient data to determine correlation! {} | {}",
LOGGER.info("Insufficient data to determine correlation! {} | {}",
optimalIndex, n
);
running = false;
@ -399,21 +399,21 @@ public class PlotAnalysis {
}
// Save calibration
logger.info(" Saving calibration");
LOGGER.info("Saving calibration");
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
Settings.save(PlotSquared.get().getWorldsFile());
running = false;
for (Plot plot : plots) {
plot.removeRunning();
}
logger.info(" Done!");
LOGGER.info("Done!");
whenDone.run();
}
});
}
public static void logln(Object obj) {
logger.info("" + log(obj));
LOGGER.info("" + log(obj));
}
public static String log(Object obj) {

View File

@ -29,8 +29,8 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
@ -44,7 +44,7 @@ import java.util.Objects;
*/
public class FlagContainer {
private static final Logger logger = LoggerFactory.getLogger("P2/" + FlagContainer.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + FlagContainer.class.getSimpleName());
private final Map<String, String> unknownFlags = new HashMap<>();
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
@ -160,7 +160,7 @@ public class FlagContainer {
this.updateSubscribers
.forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType));
} catch (IllegalStateException e) {
logger.info("Flag {} (class '{}') could not be added to the container because the "
LOGGER.info("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();

View File

@ -33,8 +33,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashMap;
import java.util.Map;
@ -45,7 +45,7 @@ import java.util.Map;
*/
public class BlockTypeWrapper {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BlockTypeWrapper.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BlockTypeWrapper.class.getSimpleName());
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
private static final Map<String, BlockTypeWrapper> blockCategories = new HashMap<>();
@ -145,7 +145,7 @@ public class BlockTypeWrapper {
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
if (Settings.DEBUG) {
logger.info("- Block category #{} does not exist", this.blockCategoryId);
LOGGER.info("- Block category #{} does not exist", this.blockCategoryId);
}
this.blockCategory = new NullBlockCategory(this.blockCategoryId);
}

View File

@ -28,12 +28,12 @@ package com.plotsquared.core.queue;
import com.plotsquared.core.PlotSquared;
import com.sk89q.worldedit.world.World;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public abstract class QueueProvider {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotSquared.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotSquared.class.getSimpleName());
public static QueueProvider of(final @NonNull Class<? extends QueueCoordinator> primary) {
return new QueueProvider() {
@ -43,9 +43,9 @@ public abstract class QueueProvider {
try {
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
} catch (Throwable e) {
logger.error("Error creating Queue: {} - Does it have the correct constructor(s)?", primary.getName());
LOGGER.error("Error creating Queue: {} - Does it have the correct constructor(s)?", primary.getName());
if (!primary.getName().contains("com.plotsquared")) {
logger.error(
LOGGER.error(
"It looks like {} is a custom queue. Please look for a plugin in its classpath and report to them.",
primary.getSimpleName()
);

View File

@ -33,8 +33,8 @@ import com.plotsquared.core.plot.BlockBucket;
import com.sk89q.worldedit.world.block.BlockState;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collection;
import java.util.HashMap;
@ -48,7 +48,7 @@ import java.util.Map;
public final class LegacyConverter {
public static final String CONFIGURATION_VERSION = "post_flattening";
private static final Logger logger = LoggerFactory.getLogger("P2/" + LegacyConverter.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + LegacyConverter.class.getSimpleName());
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
static {

View File

@ -35,8 +35,8 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.NBTOutputStream;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.io.OutputStream;
@ -52,7 +52,7 @@ import java.util.zip.GZIPOutputStream;
*/
public class PlotUploader {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotUploader.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotUploader.class.getSimpleName());
private static final Path TEMP_DIR = Paths.get(PlotSquared.platform().getDirectory().getPath());
private final SchematicHandler schematicHandler;
private final Arkitektonika arkitektonika;
@ -104,13 +104,13 @@ public class PlotUploader {
final CompletableFuture<SchematicKeys> upload = this.arkitektonika.upload(file.toFile());
return upload.join();
} catch (CompletionException e) {
logger.error("Failed to upload schematic", e);
LOGGER.error("Failed to upload schematic", e);
return null;
} finally {
try {
Files.delete(file);
} catch (IOException e) {
logger.error("Failed to delete temporary file {}", file, e);
LOGGER.error("Failed to delete temporary file {}", file, e);
}
}
}

View File

@ -49,8 +49,8 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.Collection;
@ -58,7 +58,7 @@ import java.util.Set;
public abstract class RegionManager {
private static final Logger logger = LoggerFactory.getLogger("P2/" + RegionManager.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + RegionManager.class.getSimpleName());
public static RegionManager manager = null;
private final WorldUtil worldUtil;
@ -100,7 +100,7 @@ public abstract class RegionManager {
for (BlockVector2 loc : chunks) {
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
File file = new File(PlotSquared.platform().worldContainer(), directory);
logger.info("- Deleting file: {} (max 1024 chunks)", file.getName());
LOGGER.info("- Deleting file: {} (max 1024 chunks)", file.getName());
if (file.exists()) {
file.delete();
}

View File

@ -73,8 +73,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@ -114,7 +114,7 @@ import java.util.zip.GZIPOutputStream;
public abstract class SchematicHandler {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SchematicHandler.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + SchematicHandler.class.getSimpleName());
private static final Gson GSON = new Gson();
public static SchematicHandler manager;
private final WorldUtil worldUtil;
@ -260,7 +260,7 @@ public abstract class SchematicHandler {
TaskManager.runTaskAsync(() -> {
boolean result = save(compoundTag, directory + File.separator + name + ".schem");
if (!result) {
logger.error("Failed to save {}", plot.getId());
LOGGER.error("Failed to save {}", plot.getId());
}
TaskManager.runTask(THIS);
});

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
@ -66,7 +66,7 @@ import java.util.function.Function;
*/
public class UUIDPipeline {
private static final Logger logger = LoggerFactory.getLogger("P2/" + UUIDPipeline.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + UUIDPipeline.class.getSimpleName());
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private final Executor executor;
@ -176,7 +176,7 @@ public class UUIDPipeline {
} catch (TimeoutException ignored) {
// This is completely valid, we just don't care anymore
if (Settings.DEBUG) {
logger.warn("(UUID) Request for {} timed out. Rate limit.", username);
LOGGER.warn("(UUID) Request for {} timed out. Rate limit.", username);
}
}
return null;
@ -201,7 +201,7 @@ public class UUIDPipeline {
} catch (TimeoutException ignored) {
// This is completely valid, we just don't care anymore
if (Settings.DEBUG) {
logger.warn("(UUID) Request for {} timed out. Rate limit.", uuid);
LOGGER.warn("(UUID) Request for {} timed out. Rate limit.", uuid);
}
}
return null;
@ -345,7 +345,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
logger.info("(UUID) Failed to find all usernames");
LOGGER.info("(UUID) Failed to find all usernames");
}
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
@ -414,7 +414,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
logger.info("(UUID) Failed to find all UUIDs");
LOGGER.info("(UUID) Failed to find all UUIDs");
}
throw new ServiceError("End of pipeline");

View File

@ -600,8 +600,8 @@
"flags.flag_error_invalid_block": "The provided value is not a valid block or block category.",
"flags.flag_error_double": "Flag value must be a decimal number.",
"flags.flag_error_music": "Flag value must be a valid music disc ID.",
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
"flags.area_flags": "<prefix><gray>Area flags:</gray><dark_aqua><flags></dark_aqua>",
"flags.road_flags": "<prefix><gray>Road flags:</gray><dark_aqua><flags></dark_aqua>",
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
"commands.description.alias": "<gray>Set the plot alias.</gray>",
"commands.description.area": "<gray>Create a new plot area.</gray>",

View File

@ -32,14 +32,14 @@ import com.plotsquared.core.plot.flag.implementations.UseFlag;
import com.sk89q.worldedit.world.item.ItemType;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import static org.junit.Assert.assertEquals;
public class FlagTest {
private static final Logger logger = LoggerFactory.getLogger("P2/" + FlagTest.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + FlagTest.class.getSimpleName());
private ItemType testBlock;
@ -55,11 +55,11 @@ public class FlagTest {
// //plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile
// Optional<? extends Collection> flag = plot.getFlag(use);
// if (flag.isPresent()) {
// logger.info(Flags.USE.valueToString(flag.get()));
// LOGGER.info(Flags.USE.valueToString(flag.get()));
// testBlock = ItemTypes.BONE_BLOCK;
// flag.get().add(testBlock);
// }
// flag.ifPresent(collection -> logger.info(Flags.USE.valueToString(collection)));
// flag.ifPresent(collection -> LOGGER.info(Flags.USE.valueToString(collection)));
// Optional<Set<BlockType>> flag2 = plot.getFlag(Flags.USE);
// if (flag2.isPresent()) {
// // assertThat(flag2.get(), (Matcher<? super Set<BlockType>>) IsCollectionContaining.hasItem(testBlock));

View File

@ -27,18 +27,18 @@ package com.plotsquared.core.plot;
import com.plotsquared.core.PlotVersion;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class PlotVersionTest {
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotVersionTest.class.getSimpleName());
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + PlotVersionTest.class.getSimpleName());
@Test
public void tryParse() {
//These are all random values chosen to form the test class.
PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05");
logger.info(version.versionString);
LOGGER.info(version.versionString);
}

View File

@ -20,8 +20,7 @@ luckperms = "5.3"
essentialsx = "2.18.2"
hyperverse = "0.6.0-SNAPSHOT"
slf4j-api = "1.7.30"
log4j-slf4j-impl = "2.8.1"
log4j-api = "2.8.1"
prtree = "1.7.0-SNAPSHOT"
aopalliance = "1.0"
@ -71,8 +70,7 @@ essentialsx = { group = "net.ess3", name = "EssentialsX", version.ref = "essenti
hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" }
# Logging
slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
log4j = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j-slf4j-impl" }
log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j-api" }
# Other libraries
prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" }