mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
Fixes #3027
- 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:
parent
1dc225362d
commit
f4552e358d
@ -85,9 +85,6 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
relocate("org.bstats", "com.plotsquared.metrics")
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
relocate("com.sk89q.squirrelid", "com.plotsquared.squirrelid")
|
relocate("com.sk89q.squirrelid", "com.plotsquared.squirrelid")
|
||||||
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
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("com.google.inject", "com.plotsquared.google")
|
||||||
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
||||||
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
|
relocate("com.intellectualsites.services", "com.plotsquared.core.services")
|
||||||
|
@ -140,8 +140,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.incendo.serverlib.ServerLib;
|
import org.incendo.serverlib.ServerLib;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -170,7 +170,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
|
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;
|
private static final int BSTATS_ID = 1404;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -276,12 +276,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PremiumVerification.isPremium()) {
|
if (PremiumVerification.isPremium()) {
|
||||||
logger.info("PlotSquared version licensed to Spigot user {}", getUserID());
|
LOGGER.info("PlotSquared version licensed to Spigot user {}", getUserID());
|
||||||
logger.info("https://www.spigotmc.org/resources/{}", getResourceID());
|
LOGGER.info("https://www.spigotmc.org/resources/{}", getResourceID());
|
||||||
logger.info("Download ID: {}", getDownloadID());
|
LOGGER.info("Download ID: {}", getDownloadID());
|
||||||
logger.info("Thanks for supporting us :)");
|
LOGGER.info("Thanks for supporting us :)");
|
||||||
} else {
|
} else {
|
||||||
logger.info("Couldn't verify purchase :(");
|
LOGGER.info("Couldn't verify purchase :(");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
@ -293,7 +293,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
|
||||||
// Perform upgrade
|
// Perform upgrade
|
||||||
if (DBFunc.dbManager.convertFlags()) {
|
if (DBFunc.dbManager.convertFlags()) {
|
||||||
logger.info("Flags were converted successfully!");
|
LOGGER.info("Flags were converted successfully!");
|
||||||
// Update the config version
|
// Update the config version
|
||||||
try {
|
try {
|
||||||
plotSquared.setConfigurationVersion("v5");
|
plotSquared.setConfigurationVersion("v5");
|
||||||
@ -317,10 +317,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// WorldEdit
|
// WorldEdit
|
||||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||||
try {
|
try {
|
||||||
logger.info("{} hooked into WorldEdit", this.pluginName());
|
LOGGER.info("{} hooked into WorldEdit", this.pluginName());
|
||||||
WorldEdit.getInstance().getEventBus().register(this.injector().getInstance(WESubscriber.class));
|
WorldEdit.getInstance().getEventBus().register(this.injector().getInstance(WESubscriber.class));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(
|
LOGGER.error(
|
||||||
"Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
|
"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 {
|
try {
|
||||||
injector().getInstance(ComponentPresetManager.class);
|
injector().getInstance(ComponentPresetManager.class);
|
||||||
} catch (final Exception e) {
|
} 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;
|
continue;
|
||||||
}
|
}
|
||||||
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
if (!worldUtil.isWorld(world) && !world.equals("*")) {
|
||||||
logger.warn(
|
if (Settings.DEBUG) {
|
||||||
|
LOGGER.warn(
|
||||||
"`{}` was not properly loaded - {} will now try to load it properly",
|
"`{}` was not properly loaded - {} will now try to load it properly",
|
||||||
world,
|
world,
|
||||||
this.pluginName()
|
this.pluginName()
|
||||||
);
|
);
|
||||||
logger.warn(
|
LOGGER.warn(
|
||||||
"- Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
"- 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("- Your world management plugin may be faulty (or non existent)");
|
||||||
logger.warn(" This message may also be a false positive and could be ignored.");
|
LOGGER.warn("- 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);
|
this.setGenerator(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,7 +422,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
|
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
|
||||||
this.impromptuPipeline.registerService(offlineModeUUIDService);
|
this.impromptuPipeline.registerService(offlineModeUUIDService);
|
||||||
this.backgroundPipeline.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) {
|
if (Settings.UUID.SERVICE_BUKKIT) {
|
||||||
@ -442,7 +445,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final LuckPermsUUIDService luckPermsUUIDService;
|
final LuckPermsUUIDService luckPermsUUIDService;
|
||||||
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
|
||||||
luckPermsUUIDService = new LuckPermsUUIDService();
|
luckPermsUUIDService = new LuckPermsUUIDService();
|
||||||
logger.info("(UUID) Using LuckPerms as a complementary UUID service");
|
LOGGER.info("(UUID) Using LuckPerms as a complementary UUID service");
|
||||||
} else {
|
} else {
|
||||||
luckPermsUUIDService = null;
|
luckPermsUUIDService = null;
|
||||||
}
|
}
|
||||||
@ -450,7 +453,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final EssentialsUUIDService essentialsUUIDService;
|
final EssentialsUUIDService essentialsUUIDService;
|
||||||
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
|
||||||
essentialsUUIDService = new EssentialsUUIDService();
|
essentialsUUIDService = new EssentialsUUIDService();
|
||||||
logger.info("(UUID) Using EssentialsX as a complementary UUID service");
|
LOGGER.info("(UUID) Using EssentialsX as a complementary UUID service");
|
||||||
} else {
|
} else {
|
||||||
essentialsUUIDService = null;
|
essentialsUUIDService = null;
|
||||||
}
|
}
|
||||||
@ -461,7 +464,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final PaperUUIDService paperUUIDService = new PaperUUIDService();
|
final PaperUUIDService paperUUIDService = new PaperUUIDService();
|
||||||
this.impromptuPipeline.registerService(paperUUIDService);
|
this.impromptuPipeline.registerService(paperUUIDService);
|
||||||
this.backgroundPipeline.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);
|
this.impromptuPipeline.registerService(sqLiteUUIDService);
|
||||||
@ -511,7 +514,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
|
||||||
ChatFormatter.formatters.add(injector().getInstance(PlaceholderFormatter.class));
|
ChatFormatter.formatters.add(injector().getInstance(PlaceholderFormatter.class));
|
||||||
}
|
}
|
||||||
logger.info("PlotSquared hooked into PlaceholderAPI");
|
LOGGER.info("PlotSquared hooked into PlaceholderAPI");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.startMetrics();
|
this.startMetrics();
|
||||||
@ -597,7 +600,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
final Chunk[] chunks = world.getLoadedChunks();
|
final Chunk[] chunks = world.getLoadedChunks();
|
||||||
if (chunks.length == 0) {
|
if (chunks.length == 0) {
|
||||||
if (!Bukkit.unloadWorld(world, true)) {
|
if (!Bukkit.unloadWorld(world, true)) {
|
||||||
logger.warn("Failed to unload {}", world.getName());
|
LOGGER.warn("Failed to unload {}", world.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} 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(() -> {
|
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
|
||||||
// Begin by reading all the SQLite cache at once
|
// 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
|
// Now fetch names for all known UUIDs
|
||||||
final int totalSize = uuidQueue.size();
|
final int totalSize = uuidQueue.size();
|
||||||
int read = 0;
|
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);
|
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
|
||||||
|
|
||||||
// Used to indicate that the second retrieval has been attempted
|
// 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()) {
|
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
|
||||||
if (!uuidList.isEmpty() && secondRun) {
|
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();
|
uuidList.clear();
|
||||||
}
|
}
|
||||||
if (uuidList.isEmpty()) {
|
if (uuidList.isEmpty()) {
|
||||||
@ -689,13 +692,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
// Print progress
|
// Print progress
|
||||||
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
||||||
if (Settings.DEBUG) {
|
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) {
|
} 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);
|
}, 10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,7 +1095,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} 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);
|
Bukkit.getServer().unloadWorld(world, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1195,7 +1198,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
for (final String language : languages) {
|
for (final String language : languages) {
|
||||||
if (!new File(new File(this.getDataFolder(), "lang"), String.format("messages_%s.json", language)).exists()) {
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,14 +55,14 @@ import org.bukkit.inventory.InventoryHolder;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class ReplicatingEntityWrapper extends EntityWrapper {
|
public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + ReplicatingEntityWrapper.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ReplicatingEntityWrapper.class.getSimpleName());
|
||||||
|
|
||||||
private final short depth;
|
private final short depth;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
@ -393,7 +393,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
try {
|
try {
|
||||||
entity.getInventory().setContents(this.inventory);
|
entity.getInventory().setContents(this.inventory);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
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;
|
return entity;
|
||||||
default:
|
default:
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info("Could not identify entity: {}", entity.getType());
|
LOGGER.info("Could not identify entity: {}", entity.getType());
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
// END LIVING
|
// END LIVING
|
||||||
|
@ -33,12 +33,12 @@ import com.plotsquared.core.backup.NullBackupManager;
|
|||||||
import com.plotsquared.core.backup.PlayerBackupProfile;
|
import com.plotsquared.core.backup.PlayerBackupProfile;
|
||||||
import com.plotsquared.core.backup.SimpleBackupManager;
|
import com.plotsquared.core.backup.SimpleBackupManager;
|
||||||
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
|
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class BackupModule extends AbstractModule {
|
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
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
@ -47,8 +47,8 @@ public class BackupModule extends AbstractModule {
|
|||||||
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
|
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
|
||||||
bind(BackupManager.class).to(SimpleBackupManager.class);
|
bind(BackupManager.class).to(SimpleBackupManager.class);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to initialize backup manager", e);
|
LOGGER.error("Failed to initialize backup manager", e);
|
||||||
logger.error("Backup features will be disabled");
|
LOGGER.error("Backup features will be disabled");
|
||||||
bind(BackupManager.class).to(NullBackupManager.class);
|
bind(BackupManager.class).to(NullBackupManager.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
|||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -67,7 +67,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ChunkListener implements Listener {
|
public class ChunkListener implements Listener {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + ChunkListener.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ChunkListener.class.getSimpleName());
|
||||||
|
|
||||||
private final PlotAreaManager plotAreaManager;
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ import org.bukkit.entity.WaterMob;
|
|||||||
import org.checkerframework.checker.index.qual.NonNegative;
|
import org.checkerframework.checker.index.qual.NonNegative;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
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 BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
|
||||||
public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacySection();
|
public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacySection();
|
||||||
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
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<>();
|
private final Collection<BlockType> tileEntityTypes = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -388,7 +388,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
) {
|
) {
|
||||||
final World world = getWorld(worldName);
|
final World world = getWorld(worldName);
|
||||||
if (world == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
final Biome biome = BukkitAdapter.adapt(biomeType);
|
final Biome biome = BukkitAdapter.adapt(biomeType);
|
||||||
@ -487,7 +487,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
allowedInterfaces.add(Firework.class);
|
allowedInterfaces.add(Firework.class);
|
||||||
}
|
}
|
||||||
case "player" -> allowedInterfaces.add(Player.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<>();
|
final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>();
|
||||||
outer:
|
outer:
|
||||||
|
@ -37,8 +37,8 @@ import org.bukkit.Chunk;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -47,7 +47,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ContentMap {
|
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 Set<EntityWrapper> entities;
|
||||||
final Map<PlotLoc, BaseBlock[]> allBlocks;
|
final Map<PlotLoc, BaseBlock[]> allBlocks;
|
||||||
@ -128,7 +128,7 @@ public class ContentMap {
|
|||||||
try {
|
try {
|
||||||
entity.spawn(world, xOffset, zOffset);
|
entity.spawn(world, xOffset, zOffset);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to restore entity", e);
|
LOGGER.error("Failed to restore entity", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.entities.clear();
|
this.entities.clear();
|
||||||
|
@ -36,8 +36,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -46,7 +46,7 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class UpdateUtility implements Listener {
|
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 PlotVersion internalVersion;
|
||||||
public static String spigotVersion;
|
public static String spigotVersion;
|
||||||
@ -73,23 +73,23 @@ public class UpdateUtility implements Listener {
|
|||||||
.getAsJsonObject();
|
.getAsJsonObject();
|
||||||
spigotVersion = result.get("current_version").getAsString();
|
spigotVersion = result.get("current_version").getAsString();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Unable to check for updates. Error: {}", e.getMessage());
|
LOGGER.error("Unable to check for updates. Error: {}", e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalVersion.isLaterVersion(spigotVersion)) {
|
if (internalVersion.isLaterVersion(spigotVersion)) {
|
||||||
logger.info("There appears to be a PlotSquared update available!");
|
LOGGER.info("There appears to be a PlotSquared update available!");
|
||||||
logger.info("You are running version {}, the latest version is {}",
|
LOGGER.info("You are running version {}, the latest version is {}",
|
||||||
internalVersion.versionString(), spigotVersion
|
internalVersion.versionString(), spigotVersion
|
||||||
);
|
);
|
||||||
logger.info("https://www.spigotmc.org/resources/77506/updates");
|
LOGGER.info("https://www.spigotmc.org/resources/77506/updates");
|
||||||
hasUpdate = true;
|
hasUpdate = true;
|
||||||
if (Settings.UpdateChecker.NOTIFY_ONCE) {
|
if (Settings.UpdateChecker.NOTIFY_ONCE) {
|
||||||
cancelTask();
|
cancelTask();
|
||||||
}
|
}
|
||||||
} else if (notify) {
|
} else if (notify) {
|
||||||
notify = false;
|
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);
|
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ import com.sk89q.squirrelid.Profile;
|
|||||||
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
|
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
|
||||||
import com.sk89q.squirrelid.resolver.ProfileService;
|
import com.sk89q.squirrelid.resolver.ProfileService;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -48,7 +48,7 @@ import java.util.UUID;
|
|||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public class SquirrelIdUUIDService implements UUIDService {
|
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 ProfileService profileService;
|
||||||
private final RateLimiter rateLimiter;
|
private final RateLimiter rateLimiter;
|
||||||
@ -83,7 +83,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
|||||||
//
|
//
|
||||||
if (uuids.size() >= 2) {
|
if (uuids.size() >= 2) {
|
||||||
if (Settings.DEBUG) {
|
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) {
|
for (final UUID uuid : uuids) {
|
||||||
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
|
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
|
||||||
@ -93,7 +93,7 @@ public class SquirrelIdUUIDService implements UUIDService {
|
|||||||
results.add(result.get(0));
|
results.add(result.get(0));
|
||||||
}
|
}
|
||||||
} else if (uuids.size() == 1 && Settings.DEBUG) {
|
} 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) {
|
} catch (IOException | InterruptedException e) {
|
||||||
|
@ -39,9 +39,7 @@ dependencies {
|
|||||||
testImplementation(libs.worldeditCore)
|
testImplementation(libs.worldeditCore)
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
api(libs.slf4j)
|
compileOnlyApi(libs.log4j) {
|
||||||
runtimeOnly(libs.log4j) {
|
|
||||||
exclude(group = "org.slf4j")
|
|
||||||
because("Minecraft uses 2.8.1")
|
because("Minecraft uses 2.8.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -121,7 +121,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
@SuppressWarnings({"WeakerAccess"})
|
@SuppressWarnings({"WeakerAccess"})
|
||||||
public class PlotSquared {
|
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;
|
private static @MonotonicNonNull PlotSquared instance;
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
@ -192,7 +192,7 @@ public class PlotSquared {
|
|||||||
try {
|
try {
|
||||||
this.loadCaptionMap();
|
this.loadCaptionMap();
|
||||||
} catch (final Exception e) {
|
} 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
|
// Setup the global flag container
|
||||||
@ -269,7 +269,7 @@ public class PlotSquared {
|
|||||||
captionMap = this.captionLoader.loadSingle(this.platform.getDirectory().toPath().resolve("lang").resolve(fileName));
|
captionMap = this.captionLoader.loadSingle(this.platform.getDirectory().toPath().resolve("lang").resolve(fileName));
|
||||||
}
|
}
|
||||||
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"Loaded caption map for namespace 'plotsquared': {}",
|
"Loaded caption map for namespace 'plotsquared': {}",
|
||||||
this.captionMaps.get(TranslatableCaption.DEFAULT_NAMESPACE).getClass().getCanonicalName()
|
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])));
|
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
|
||||||
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
||||||
int height = (int) list.get(2);
|
int height = (int) list.get(2);
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"Incomplete road regeneration found. Restarting in world {} with height {}",
|
"Incomplete road regeneration found. Restarting in world {} with height {}",
|
||||||
plotArea.getWorldName(),
|
plotArea.getWorldName(),
|
||||||
height
|
height
|
||||||
);
|
);
|
||||||
logger.info(" - Regions: {}", regions.size());
|
LOGGER.info("- Regions: {}", regions.size());
|
||||||
logger.info(" - Chunks: {}", chunks.size());
|
LOGGER.info("- Chunks: {}", chunks.size());
|
||||||
HybridUtils.UPDATE = true;
|
HybridUtils.UPDATE = true;
|
||||||
PlotSquared.platform().hybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
PlotSquared.platform().hybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
logger.error("Error restarting road regeneration", e);
|
LOGGER.error("Error restarting road regeneration", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!file.delete()) {
|
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
|
// Conventional plot generator
|
||||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||||
PlotManager plotManager = plotArea.getPlotManager();
|
PlotManager plotManager = plotArea.getPlotManager();
|
||||||
logger.info("Detected world load for '{}'", world);
|
LOGGER.info("Detected world load for '{}'", world);
|
||||||
logger.info(" - generator: {}>{}", baseGenerator, plotGenerator);
|
LOGGER.info("- generator: {}>{}", baseGenerator, plotGenerator);
|
||||||
logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName());
|
LOGGER.info("- plot world: {}", plotArea.getClass().getCanonicalName());
|
||||||
logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
|
LOGGER.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
|
||||||
if (!this.worldConfiguration.contains(path)) {
|
if (!this.worldConfiguration.contains(path)) {
|
||||||
this.worldConfiguration.createSection(path);
|
this.worldConfiguration.createSection(path);
|
||||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
||||||
@ -857,7 +857,7 @@ public class PlotSquared {
|
|||||||
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Detected world load for '{}'", world);
|
LOGGER.info("Detected world load for '{}'", world);
|
||||||
String gen_string = worldSection.getString("generator.plugin", platform.pluginName());
|
String gen_string = worldSection.getString("generator.plugin", platform.pluginName());
|
||||||
if (type == PlotAreaType.PARTIAL) {
|
if (type == PlotAreaType.PARTIAL) {
|
||||||
Set<PlotCluster> clusters =
|
Set<PlotCluster> clusters =
|
||||||
@ -873,7 +873,7 @@ public class PlotSquared {
|
|||||||
String fullId = name + "-" + pos1 + "-" + pos2;
|
String fullId = name + "-" + pos1 + "-" + pos2;
|
||||||
worldSection.createSection("areas." + fullId);
|
worldSection.createSection("areas." + fullId);
|
||||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
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);
|
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
|
||||||
if (areaGen == null) {
|
if (areaGen == null) {
|
||||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||||
@ -887,10 +887,10 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info(" | plot world: {}", pa);
|
LOGGER.info("| plot world: {}", pa);
|
||||||
logger.info(" | manager: {}", pa);
|
LOGGER.info("| manager: {}", pa);
|
||||||
logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
LOGGER.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
toLoad.add(pa);
|
toLoad.add(pa);
|
||||||
@ -912,9 +912,9 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info(" - generator: {}>{}", baseGenerator, areaGen);
|
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info(" - plot world: {}", pa);
|
LOGGER.info("- plot world: {}", pa);
|
||||||
logger.info(" - plot area manager: {}", pa.getPlotManager());
|
LOGGER.info("- plot area manager: {}", pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -926,7 +926,7 @@ public class PlotSquared {
|
|||||||
+ PlotAreaType.AUGMENTED + "`");
|
+ PlotAreaType.AUGMENTED + "`");
|
||||||
}
|
}
|
||||||
for (String areaId : areasSection.getKeys(false)) {
|
for (String areaId : areasSection.getKeys(false)) {
|
||||||
logger.info(" - {}", areaId);
|
LOGGER.info("- {}", areaId);
|
||||||
String[] split = areaId.split("(?<=[^;-])-");
|
String[] split = areaId.split("(?<=[^;-])-");
|
||||||
if (split.length != 3) {
|
if (split.length != 3) {
|
||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||||
@ -988,10 +988,10 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
logger.info("Detected area load for '{}'", world);
|
LOGGER.info("Detected area load for '{}'", world);
|
||||||
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
|
||||||
logger.info(" | plot world: {}", pa);
|
LOGGER.info("| plot world: {}", pa);
|
||||||
logger.info(" | manager: {}", pa.getPlotManager());
|
LOGGER.info("| manager: {}", pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
@ -1069,7 +1069,7 @@ public class PlotSquared {
|
|||||||
for (String element : split) {
|
for (String element : split) {
|
||||||
String[] pair = element.split("=");
|
String[] pair = element.split("=");
|
||||||
if (pair.length != 2) {
|
if (pair.length != 2) {
|
||||||
logger.error("No value provided for '{}'", element);
|
LOGGER.error("No value provided for '{}'", element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String key = pair[0].toLowerCase();
|
String key = pair[0].toLowerCase();
|
||||||
@ -1116,12 +1116,12 @@ public class PlotSquared {
|
|||||||
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
|
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString()
|
||||||
);
|
);
|
||||||
default -> {
|
default -> {
|
||||||
logger.error("Key not found: {}", element);
|
LOGGER.error("Key not found: {}", element);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Invalid value '{}' for arg '{}'", value, element);
|
LOGGER.error("Invalid value '{}' for arg '{}'", value, element);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1192,7 +1192,7 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Could not save {}", file);
|
LOGGER.error("Could not save {}", file);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1215,7 +1215,7 @@ public class PlotSquared {
|
|||||||
// Close the connection
|
// Close the connection
|
||||||
DBFunc.close();
|
DBFunc.close();
|
||||||
} catch (NullPointerException throwable) {
|
} catch (NullPointerException throwable) {
|
||||||
logger.error("Could not close database connection", throwable);
|
LOGGER.error("Could not close database connection", throwable);
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,9 +1228,9 @@ public class PlotSquared {
|
|||||||
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
|
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Road regeneration incomplete. Saving incomplete regions to disk");
|
LOGGER.info("Road regeneration incomplete. Saving incomplete regions to disk");
|
||||||
logger.info(" - regions: {}", HybridUtils.regions.size());
|
LOGGER.info("- regions: {}", HybridUtils.regions.size());
|
||||||
logger.info(" - chunks: {}", HybridUtils.chunks.size());
|
LOGGER.info("- chunks: {}", HybridUtils.chunks.size());
|
||||||
ArrayList<int[]> regions = new ArrayList<>();
|
ArrayList<int[]> regions = new ArrayList<>();
|
||||||
ArrayList<int[]> chunks = new ArrayList<>();
|
ArrayList<int[]> chunks = new ArrayList<>();
|
||||||
for (BlockVector2 r : HybridUtils.regions) {
|
for (BlockVector2 r : HybridUtils.regions) {
|
||||||
@ -1247,14 +1247,14 @@ public class PlotSquared {
|
|||||||
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
|
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
|
||||||
.getId() + "_" + HybridUtils.area.getWorldName());
|
.getId() + "_" + HybridUtils.area.getWorldName());
|
||||||
if (file.exists() && !file.delete()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
try (ObjectOutputStream oos = new ObjectOutputStream(
|
try (ObjectOutputStream oos = new ObjectOutputStream(
|
||||||
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
|
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
|
||||||
oos.writeObject(list);
|
oos.writeObject(list);
|
||||||
} catch (IOException e) {
|
} 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");
|
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
|
||||||
database = new SQLite(file);
|
database = new SQLite(file);
|
||||||
} else {
|
} 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
|
this.platform.shutdown(); //shutdown used instead of disable because no database is set
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1299,14 +1299,14 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
this.clustersTmp = DBFunc.getClusters();
|
this.clustersTmp = DBFunc.getClusters();
|
||||||
} catch (ClassNotFoundException | SQLException e) {
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
logger.error(
|
LOGGER.error(
|
||||||
"Failed to open database connection ({}). Disabling PlotSquared",
|
"Failed to open database connection ({}). Disabling PlotSquared",
|
||||||
Storage.MySQL.USE ? "MySQL" : "SQLite"
|
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();
|
e.printStackTrace();
|
||||||
logger.error("==== End of stacktrace ====");
|
LOGGER.error("==== End of stacktrace ====");
|
||||||
logger.error(
|
LOGGER.error(
|
||||||
"Please go to the {} 'storage.yml' and configure the database correctly",
|
"Please go to the {} 'storage.yml' and configure the database correctly",
|
||||||
platform.pluginName()
|
platform.pluginName()
|
||||||
);
|
);
|
||||||
@ -1332,7 +1332,7 @@ public class PlotSquared {
|
|||||||
try {
|
try {
|
||||||
worldConfiguration.save(worldsFile);
|
worldConfiguration.save(worldsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Failed to save worlds.yml", e);
|
LOGGER.error("Failed to save worlds.yml", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1365,12 +1365,12 @@ public class PlotSquared {
|
|||||||
public boolean setupConfigs() {
|
public boolean setupConfigs() {
|
||||||
File folder = new File(this.platform.getDirectory(), "config");
|
File folder = new File(this.platform.getDirectory(), "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
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 {
|
try {
|
||||||
this.worldsFile = new File(folder, "worlds.yml");
|
this.worldsFile = new File(folder, "worlds.yml");
|
||||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
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);
|
this.worldConfiguration = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||||
|
|
||||||
@ -1380,21 +1380,21 @@ public class PlotSquared {
|
|||||||
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
|
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
|
||||||
.getString("configuration_version").equalsIgnoreCase("v5"))) {
|
.getString("configuration_version").equalsIgnoreCase("v5"))) {
|
||||||
// Conversion needed
|
// 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 {
|
try {
|
||||||
com.google.common.io.Files
|
com.google.common.io.Files
|
||||||
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
.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 =
|
final ConfigurationSection worlds =
|
||||||
this.worldConfiguration.getConfigurationSection("worlds");
|
this.worldConfiguration.getConfigurationSection("worlds");
|
||||||
final LegacyConverter converter = new LegacyConverter(worlds);
|
final LegacyConverter converter = new LegacyConverter(worlds);
|
||||||
converter.convert();
|
converter.convert();
|
||||||
this.worldConfiguration.set("worlds", worlds);
|
this.worldConfiguration.set("worlds", worlds);
|
||||||
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
|
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.");
|
"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) {
|
} 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
|
// Disable plugin
|
||||||
this.platform.shutdown();
|
this.platform.shutdown();
|
||||||
@ -1404,27 +1404,27 @@ public class PlotSquared {
|
|||||||
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("Failed to save worlds.yml");
|
LOGGER.error("Failed to save worlds.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.configFile = new File(folder, "settings.yml");
|
this.configFile = new File(folder, "settings.yml");
|
||||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
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);
|
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||||
setupConfig();
|
setupConfig();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("Failed to save settings.yml");
|
LOGGER.error("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.storageFile = new File(folder, "storage.yml");
|
this.storageFile = new File(folder, "storage.yml");
|
||||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
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);
|
YamlConfiguration.loadConfiguration(this.storageFile);
|
||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("Failed to save storage.yml");
|
LOGGER.error("Failed to save storage.yml");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1455,7 +1455,7 @@ public class PlotSquared {
|
|||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||||
for (Entry<String, Object> component : components.entrySet()) {
|
for (Entry<String, Object> component : components.entrySet()) {
|
||||||
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
|
LOGGER.info("Key: {} | Value: {}", component.getKey(), component.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ import com.plotsquared.core.util.PlotExpression;
|
|||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "claim",
|
command = "claim",
|
||||||
@ -58,8 +58,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
usage = "/plot claim")
|
usage = "/plot claim")
|
||||||
public class Claim extends SubCommand {
|
public class Claim extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger =
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Claim.class.getSimpleName());
|
||||||
LoggerFactory.getLogger("P2/" + Claim.class.getSimpleName());
|
|
||||||
|
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
private final EconHandler econHandler;
|
private final EconHandler econHandler;
|
||||||
@ -195,7 +194,7 @@ public class Claim extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
TaskManager.getPlatformImplementation().sync(() -> {
|
TaskManager.getPlatformImplementation().sync(() -> {
|
||||||
if (!plot.claim(player, true, finalSchematic, false)) {
|
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"));
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
} else if (area.isAutoMerge()) {
|
} else if (area.isAutoMerge()) {
|
||||||
@ -222,7 +221,7 @@ public class Claim extends SubCommand {
|
|||||||
e.printStackTrace();
|
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"));
|
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||||
plot.setOwnerAbs(null);
|
plot.setOwnerAbs(null);
|
||||||
});
|
});
|
||||||
|
@ -43,8 +43,8 @@ import com.plotsquared.core.util.Permissions;
|
|||||||
import com.plotsquared.core.util.PlotExpression;
|
import com.plotsquared.core.util.PlotExpression;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -58,7 +58,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
|
aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
|
||||||
public class MainCommand extends Command {
|
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;
|
private static MainCommand instance;
|
||||||
public Help help;
|
public Help help;
|
||||||
@ -78,7 +78,7 @@ public class MainCommand extends Command {
|
|||||||
commands.add(Caps.class);
|
commands.add(Caps.class);
|
||||||
commands.add(Buy.class);
|
commands.add(Buy.class);
|
||||||
if (Settings.Web.LEGACY_WEBINTERFACE) {
|
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(Save.class);
|
||||||
}
|
}
|
||||||
commands.add(Load.class);
|
commands.add(Load.class);
|
||||||
@ -154,7 +154,7 @@ public class MainCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
injector.getInstance(command);
|
injector.getInstance(command);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to register command {}", command.getCanonicalName());
|
LOGGER.error("Failed to register command {}", command.getCanonicalName());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ import com.plotsquared.core.util.task.TaskManager;
|
|||||||
import com.plotsquared.core.uuid.UUIDMapping;
|
import com.plotsquared.core.uuid.UUIDMapping;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -59,7 +59,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
confirmation = true)
|
confirmation = true)
|
||||||
public class Purge extends SubCommand {
|
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 PlotAreaManager plotAreaManager;
|
||||||
private final PlotListener plotListener;
|
private final PlotListener plotListener;
|
||||||
@ -205,7 +205,7 @@ public class Purge extends SubCommand {
|
|||||||
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
||||||
boolean finalClear = clear;
|
boolean finalClear = clear;
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
logger.info("Calculating plots to purge, please wait...");
|
LOGGER.info("Calculating plots to purge, please wait...");
|
||||||
HashSet<Integer> ids = new HashSet<>();
|
HashSet<Integer> ids = new HashSet<>();
|
||||||
Iterator<Plot> iterator = toDelete.iterator();
|
Iterator<Plot> iterator = toDelete.iterator();
|
||||||
AtomicBoolean cleared = new AtomicBoolean(true);
|
AtomicBoolean cleared = new AtomicBoolean(true);
|
||||||
@ -220,7 +220,7 @@ public class Purge extends SubCommand {
|
|||||||
ids.add(plot.temp);
|
ids.add(plot.temp);
|
||||||
if (finalClear) {
|
if (finalClear) {
|
||||||
plot.getPlotModificationManager().clear(false, true, player, () -> {
|
plot.getPlotModificationManager().clear(false, true, player, () -> {
|
||||||
logger.info("Plot {} cleared by purge", plot.getId());
|
LOGGER.info("Plot {} cleared by purge", plot.getId());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
plot.getPlotModificationManager().removeSign();
|
plot.getPlotModificationManager().removeSign();
|
||||||
@ -230,7 +230,7 @@ public class Purge extends SubCommand {
|
|||||||
Purge.this.plotListener.plotEntry(pp, plot);
|
Purge.this.plotListener.plotEntry(pp, plot);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} 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);
|
+ " because you are deleting a world that has been removed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ import com.plotsquared.core.util.task.TaskTime;
|
|||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -62,7 +62,7 @@ import java.util.Set;
|
|||||||
category = CommandCategory.ADMINISTRATION)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Trim extends SubCommand {
|
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 static volatile boolean TASK = false;
|
||||||
|
|
||||||
private final PlotAreaManager plotAreaManager;
|
private final PlotAreaManager plotAreaManager;
|
||||||
@ -152,16 +152,16 @@ public class Trim extends SubCommand {
|
|||||||
public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
|
public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
|
||||||
Runnable regenTask;
|
Runnable regenTask;
|
||||||
if (regen) {
|
if (regen) {
|
||||||
logger.info("Starting regen task");
|
LOGGER.info("Starting regen task");
|
||||||
logger.info(" - This is a VERY slow command");
|
LOGGER.info(" - This is a VERY slow command");
|
||||||
logger.info(" - It will say 'Trim done!' when complete");
|
LOGGER.info(" - It will say 'Trim done!' when complete");
|
||||||
regenTask = new Runnable() {
|
regenTask = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (nonViable.isEmpty()) {
|
if (nonViable.isEmpty()) {
|
||||||
Trim.TASK = false;
|
Trim.TASK = false;
|
||||||
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
||||||
logger.info("Trim done!");
|
LOGGER.info("Trim done!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Iterator<BlockVector2> iterator = nonViable.iterator();
|
Iterator<BlockVector2> iterator = nonViable.iterator();
|
||||||
@ -212,7 +212,7 @@ public class Trim extends SubCommand {
|
|||||||
regenTask = () -> {
|
regenTask = () -> {
|
||||||
Trim.TASK = false;
|
Trim.TASK = false;
|
||||||
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
||||||
logger.info("Trim done!");
|
LOGGER.info("Trim done!");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
regionManager.deleteRegionFiles(world, viable, regenTask);
|
regionManager.deleteRegionFiles(world, viable, regenTask);
|
||||||
|
@ -49,8 +49,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -68,7 +68,7 @@ import java.util.stream.Collectors;
|
|||||||
public class ComponentPresetManager {
|
public class ComponentPresetManager {
|
||||||
|
|
||||||
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
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 List<ComponentPreset> presets;
|
||||||
private final String guiName;
|
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 oldLocation = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "components.yml");
|
||||||
final File folder = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "config");
|
final File folder = new File(Objects.requireNonNull(PlotSquared.platform()).getDirectory(), "config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
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()) {
|
if (oldLocation.exists()) {
|
||||||
Path oldLoc = Paths.get(PlotSquared.platform().getDirectory() + "/components.yml");
|
Path oldLoc = Paths.get(PlotSquared.platform().getDirectory() + "/components.yml");
|
||||||
@ -94,7 +94,7 @@ public class ComponentPresetManager {
|
|||||||
try {
|
try {
|
||||||
this.componentsFile = new File(folder, "components.yml");
|
this.componentsFile = new File(folder, "components.yml");
|
||||||
if (!this.componentsFile.exists() && !this.componentsFile.createNewFile()) {
|
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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -109,7 +109,7 @@ public class ComponentPresetManager {
|
|||||||
try {
|
try {
|
||||||
yamlConfiguration.save(this.componentsFile);
|
yamlConfiguration.save(this.componentsFile);
|
||||||
} catch (IOException e) {
|
} 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");
|
this.guiName = yamlConfiguration.getString("title", "&6Plot Components");
|
||||||
@ -135,7 +135,7 @@ public class ComponentPresetManager {
|
|||||||
try {
|
try {
|
||||||
yamlConfiguration.save(this.componentsFile);
|
yamlConfiguration.save(this.componentsFile);
|
||||||
} catch (final IOException e) {
|
} 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;
|
this.presets = defaultPreset;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ package com.plotsquared.core.configuration;
|
|||||||
import com.plotsquared.core.configuration.Settings.Enabled_Components;
|
import com.plotsquared.core.configuration.Settings.Enabled_Components;
|
||||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||||
import com.plotsquared.core.util.StringMan;
|
import com.plotsquared.core.util.StringMan;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@ -47,7 +47,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Config {
|
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>
|
* Get the value for a node<br>
|
||||||
@ -98,12 +98,12 @@ public class Config {
|
|||||||
field.set(instance, value);
|
field.set(instance, value);
|
||||||
return;
|
return;
|
||||||
} catch (final Throwable e) {
|
} 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();
|
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) {
|
public static boolean load(File file, Class<? extends Config> root) {
|
||||||
@ -287,7 +287,7 @@ public class Config {
|
|||||||
setAccessible(field);
|
setAccessible(field);
|
||||||
return field;
|
return field;
|
||||||
} catch (final Throwable e) {
|
} 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 " +
|
"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 " +
|
"likely no longer in use, moved to a different location or have been merged with other " +
|
||||||
"configuration options. Check the changelog for more information.",
|
"configuration options. Check the changelog for more information.",
|
||||||
|
@ -33,8 +33,8 @@ import com.plotsquared.core.configuration.caption.LocalizedCaptionMap;
|
|||||||
import com.plotsquared.core.configuration.caption.PerUserLocaleCaptionMap;
|
import com.plotsquared.core.configuration.caption.PerUserLocaleCaptionMap;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
@ -61,7 +61,7 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
public final class CaptionLoader {
|
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;
|
private static final Gson GSON;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public final class CaptionLoader {
|
|||||||
try {
|
try {
|
||||||
temp = this.captionProvider.loadDefaults(internalLocale);
|
temp = this.captionProvider.loadDefaults(internalLocale);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to load default messages", e);
|
LOGGER.error("Failed to load default messages", e);
|
||||||
temp = Collections.emptyMap();
|
temp = Collections.emptyMap();
|
||||||
}
|
}
|
||||||
this.defaultMessages = temp;
|
this.defaultMessages = temp;
|
||||||
@ -159,9 +159,9 @@ public final class CaptionLoader {
|
|||||||
private static void save(final Path file, final Map<String, String> content) {
|
private static void save(final Path file, final Map<String, String> content) {
|
||||||
try (final BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
|
try (final BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
|
||||||
GSON.toJson(content, writer);
|
GSON.toJson(content, writer);
|
||||||
logger.info("Saved {} with new content", file.getFileName());
|
LOGGER.info("Saved {} with new content", file.getFileName());
|
||||||
} catch (final IOException e) {
|
} 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);
|
final CaptionMap localeMap = loadSingle(file);
|
||||||
localeMaps.put(localeMap.getLocale(), localeMap);
|
localeMaps.put(localeMap.getLocale(), localeMap);
|
||||||
} catch (Exception e) {
|
} 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);
|
return new PerUserLocaleCaptionMap(localeMaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ package com.plotsquared.core.configuration.caption.load;
|
|||||||
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -42,7 +42,7 @@ import static com.plotsquared.core.configuration.caption.load.CaptionLoader.load
|
|||||||
|
|
||||||
final class ClassLoaderCaptionProvider implements DefaultCaptionProvider {
|
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 ClassLoader classLoader;
|
||||||
private final Function<@NonNull Locale, @NonNull String> urlProvider;
|
private final Function<@NonNull Locale, @NonNull String> urlProvider;
|
||||||
|
|
||||||
@ -60,14 +60,14 @@ final class ClassLoaderCaptionProvider implements DefaultCaptionProvider {
|
|||||||
try {
|
try {
|
||||||
final InputStream stream = this.classLoader.getResourceAsStream(url);
|
final InputStream stream = this.classLoader.getResourceAsStream(url);
|
||||||
if (stream == null) {
|
if (stream == null) {
|
||||||
logger.warn("No resource for locale '{}' found", locale);
|
LOGGER.warn("No resource for locale '{}' found", locale);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
|
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
|
||||||
return loadFromReader(reader);
|
return loadFromReader(reader);
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
logger.error("Unable to load language resource", e);
|
LOGGER.error("Unable to load language resource", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ package com.plotsquared.core.configuration.file;
|
|||||||
import com.plotsquared.core.configuration.Configuration;
|
import com.plotsquared.core.configuration.Configuration;
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
import com.plotsquared.core.configuration.InvalidConfigurationException;
|
import com.plotsquared.core.configuration.InvalidConfigurationException;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
@ -47,7 +47,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class YamlConfiguration extends FileConfiguration {
|
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 COMMENT_PREFIX = "# ";
|
||||||
private static final String BLANK_CONFIG = "{}\n";
|
private static final String BLANK_CONFIG = "{}\n";
|
||||||
@ -80,11 +80,11 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
||||||
}
|
}
|
||||||
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
logger.error("Could not read: {}", file);
|
LOGGER.error("Could not read: {}", file);
|
||||||
logger.error("Renamed to: {}", file);
|
LOGGER.error("Renamed to: {}", file);
|
||||||
logger.error("============ Full stacktrace ============");
|
LOGGER.error("============ Full stacktrace ============");
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
logger.error("=========================================");
|
LOGGER.error("=========================================");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ import com.plotsquared.core.util.StringMan;
|
|||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
import java.sql.DatabaseMetaData;
|
||||||
@ -84,7 +84,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
@SuppressWarnings("SqlDialectInspection")
|
@SuppressWarnings("SqlDialectInspection")
|
||||||
public class SQLManager implements AbstractDB {
|
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
|
||||||
public final String SET_OWNER;
|
public final String SET_OWNER;
|
||||||
@ -381,12 +381,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
task.run();
|
task.run();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("There was an error updating the database.");
|
LOGGER.error("There was an error updating the database.");
|
||||||
logger.error(" - It will be corrected on shutdown");
|
LOGGER.error(" - It will be corrected on shutdown");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commit();
|
commit();
|
||||||
@ -436,12 +436,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("There was an error updating the database.");
|
LOGGER.error("There was an error updating the database.");
|
||||||
logger.error(" - It will be corrected on shutdown");
|
LOGGER.error(" - It will be corrected on shutdown");
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -481,12 +481,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("There was an error updating the database.");
|
LOGGER.error("There was an error updating the database.");
|
||||||
logger.error(" - It will be corrected on shutdown");
|
LOGGER.error(" - It will be corrected on shutdown");
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -527,12 +527,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("There was an error updating the database.");
|
LOGGER.error("There was an error updating the database.");
|
||||||
logger.error(" - It will be corrected on shutdown");
|
LOGGER.error(" - It will be corrected on shutdown");
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -556,12 +556,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
this.plotTasks.clear();
|
this.plotTasks.clear();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("============ DATABASE ERROR ============");
|
LOGGER.error("============ DATABASE ERROR ============");
|
||||||
logger.error("There was an error updating the database.");
|
LOGGER.error("There was an error updating the database.");
|
||||||
logger.error(" - It will be corrected on shutdown");
|
LOGGER.error(" - It will be corrected on shutdown");
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("========================================");
|
LOGGER.error("========================================");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
} catch (SQLException e) {
|
} 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 {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -666,7 +666,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} 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 {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -743,19 +743,19 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
preparedStatement.executeBatch();
|
preparedStatement.executeBatch();
|
||||||
} catch (final Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"- Finished converting flag values for plot with entry ID: {}",
|
"- Finished converting flag values for plot with entry ID: {}",
|
||||||
plot.getId()
|
plot.getId()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} 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();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,7 +879,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
return;
|
return;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
if (this.mySQL) {
|
if (this.mySQL) {
|
||||||
logger.error("1: | {}", objList.get(0).getClass().getCanonicalName());
|
LOGGER.error("1: | {}", objList.get(0).getClass().getCanonicalName());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -917,8 +917,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("2: | {}", objList.get(0).getClass().getCanonicalName());
|
LOGGER.error("2: | {}", objList.get(0).getClass().getCanonicalName());
|
||||||
logger.error("Could not bulk save!");
|
LOGGER.error("Could not bulk save!");
|
||||||
try (PreparedStatement preparedStmt = this.connection
|
try (PreparedStatement preparedStmt = this.connection
|
||||||
.prepareStatement(mod.getCreateSQL())) {
|
.prepareStatement(mod.getCreateSQL())) {
|
||||||
for (T obj : objList) {
|
for (T obj : objList) {
|
||||||
@ -927,7 +927,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
preparedStmt.executeBatch();
|
preparedStmt.executeBatch();
|
||||||
} catch (SQLException e3) {
|
} catch (SQLException e3) {
|
||||||
logger.error("Failed to save all", e);
|
LOGGER.error("Failed to save all", e);
|
||||||
e3.printStackTrace();
|
e3.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -979,7 +979,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
preparedStatement.executeBatch();
|
preparedStatement.executeBatch();
|
||||||
} catch (final Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -991,13 +991,13 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
preparedStatement.executeBatch();
|
preparedStatement.executeBatch();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to store settings", e);
|
LOGGER.error("Failed to store settings", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception 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();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1736,11 +1736,11 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to load old flag values", e);
|
LOGGER.error("Failed to load old flag values", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
logger.info("Loaded {} plot flag collections...", flagMap.size());
|
LOGGER.info("Loaded {} plot flag collections...", flagMap.size());
|
||||||
logger.info("Attempting to store these flags in the new table...");
|
LOGGER.info("Attempting to store these flags in the new table...");
|
||||||
try (final PreparedStatement preparedStatement = this.connection.prepareStatement(
|
try (final PreparedStatement preparedStatement = this.connection.prepareStatement(
|
||||||
"INSERT INTO `" + SQLManager.this.prefix
|
"INSERT INTO `" + SQLManager.this.prefix
|
||||||
+ "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) {
|
+ "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) {
|
||||||
@ -1768,7 +1768,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
preparedStatement.executeBatch();
|
preparedStatement.executeBatch();
|
||||||
} catch (final Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1776,18 +1776,18 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap
|
if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap
|
||||||
.size()) {
|
.size()) {
|
||||||
timeStarted = System.currentTimeMillis();
|
timeStarted = System.currentTimeMillis();
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"... Flag conversion in progress. {}% done",
|
"... Flag conversion in progress. {}% done",
|
||||||
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100)
|
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"- Finished converting flags for plot with entry ID: {}",
|
"- Finished converting flags for plot with entry ID: {}",
|
||||||
plotFlagEntry.getKey()
|
plotFlagEntry.getKey()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to store flag values", e);
|
LOGGER.error("Failed to store flag values", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1881,7 +1881,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
|
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
|
||||||
.getTime();
|
.getTime();
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
logger.error("Could not parse date for plot: #{}({};{}) ({})",
|
LOGGER.error("Could not parse date for plot: #{}({};{}) ({})",
|
||||||
id, areaID, plot_id, parsable
|
id, areaID, plot_id, parsable
|
||||||
);
|
);
|
||||||
time = System.currentTimeMillis() + id;
|
time = System.currentTimeMillis() + id;
|
||||||
@ -1898,7 +1898,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(last.temp);
|
toDelete.add(last.temp);
|
||||||
} else {
|
} else {
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"Plot #{}({}) in `{}plot` is a duplicate."
|
"Plot #{}({}) in `{}plot` is a duplicate."
|
||||||
+ " Delete this plot or set `database-purger: true` in the settings.yml",
|
+ " Delete this plot or set `database-purger: true` in the settings.yml",
|
||||||
id,
|
id,
|
||||||
@ -1935,7 +1935,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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));
|
plot.getFlagContainer().addFlag(plotFlag.parse(value));
|
||||||
} catch (final FlagParseException e) {
|
} catch (final FlagParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("Plot with ID {} has an invalid value:", id);
|
LOGGER.error("Plot with ID {} has an invalid value:", id);
|
||||||
logger.error("Failed to parse flag '{}', value '{}': {}",
|
LOGGER.error("Failed to parse flag '{}', value '{}': {}",
|
||||||
plotFlag.getName(), e.getValue(), e.getErrorMessage()
|
plotFlag.getName(), e.getValue(), e.getErrorMessage()
|
||||||
);
|
);
|
||||||
if (!invalidFlags.containsKey(plot)) {
|
if (!invalidFlags.containsKey(plot)) {
|
||||||
@ -2058,7 +2058,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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
|
for (final Map.Entry<Plot, Collection<PlotFlag<?, ?>>> plotFlagEntry : invalidFlags
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
for (final PlotFlag<?, ?> flag : plotFlagEntry.getValue()) {
|
for (final PlotFlag<?, ?> flag : plotFlagEntry.getValue()) {
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"Plot {} has an invalid flag ({}). A fix has been attempted",
|
"Plot {} has an invalid flag ({}). A fix has been attempted",
|
||||||
plotFlagEntry.getKey(), flag.getName()
|
plotFlagEntry.getKey(), flag.getName()
|
||||||
);
|
);
|
||||||
@ -2113,7 +2113,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} 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);
|
+ " 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();
|
String worldName = entry.getKey();
|
||||||
invalidPlot = true;
|
invalidPlot = true;
|
||||||
if (Settings.DEBUG) {
|
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
|
entry.getValue().intValue(), worldName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (invalidPlot && Settings.DEBUG) {
|
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) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to load plots", e);
|
LOGGER.error("Failed to load plots", e);
|
||||||
}
|
}
|
||||||
return newPlots;
|
return newPlots;
|
||||||
}
|
}
|
||||||
@ -2185,7 +2185,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
preparedStatement.setInt(3, id2);
|
preparedStatement.setInt(3, id2);
|
||||||
preparedStatement.execute();
|
preparedStatement.execute();
|
||||||
} catch (final Exception e) {
|
} 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();
|
e.printStackTrace();
|
||||||
future.complete(false);
|
future.complete(false);
|
||||||
return;
|
return;
|
||||||
@ -2340,11 +2340,11 @@ public class SQLManager implements AbstractDB {
|
|||||||
commit();
|
commit();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to purge plots", e);
|
LOGGER.error("Failed to purge plots", e);
|
||||||
return;
|
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);
|
purgeIds(ids);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to purge area '{}'", area);
|
LOGGER.error("Failed to purge area '{}'", area);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
|
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
|
||||||
@ -2661,7 +2661,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -2905,7 +2905,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.helpers.add(user);
|
cluster.helpers.add(user);
|
||||||
} else {
|
} 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);
|
+ " Please create the cluster or remove this entry", id, cluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2924,7 +2924,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.invited.add(user);
|
cluster.invited.add(user);
|
||||||
} else {
|
} 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);
|
+ " Please create the cluster or remove this entry", id, cluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2959,7 +2959,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
cluster.settings.setMerged(merged);
|
cluster.settings.setMerged(merged);
|
||||||
} else {
|
} 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);
|
+ " 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()) {
|
for (Entry<String, Integer> entry : noExist.entrySet()) {
|
||||||
String a = entry.getKey();
|
String a = entry.getKey();
|
||||||
invalidPlot = true;
|
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) {
|
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) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to load clusters", e);
|
LOGGER.error("Failed to load clusters", e);
|
||||||
}
|
}
|
||||||
return newClusters;
|
return newClusters;
|
||||||
}
|
}
|
||||||
@ -3201,7 +3201,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
reconnect();
|
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)");
|
"All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
|
||||||
commit();
|
commit();
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -3223,13 +3223,13 @@ public class SQLManager implements AbstractDB {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (plot.getArea() == null) {
|
if (plot.getArea() == null) {
|
||||||
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
|
LOGGER.error("CRITICAL ERROR IN VALIDATION TASK!");
|
||||||
logger.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
|
LOGGER.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (database == null) {
|
if (database == null) {
|
||||||
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
|
LOGGER.error("CRITICAL ERROR IN VALIDATION TASK!");
|
||||||
logger.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
|
LOGGER.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
package com.plotsquared.core.database;
|
package com.plotsquared.core.database;
|
||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -42,7 +42,7 @@ import java.sql.Statement;
|
|||||||
*/
|
*/
|
||||||
public class SQLite extends Database {
|
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 final String dbLocation;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
@ -69,7 +69,7 @@ public class SQLite extends Database {
|
|||||||
try {
|
try {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
logger.error("Unable to create database");
|
LOGGER.error("Unable to create database");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Class.forName("org.sqlite.JDBC");
|
Class.forName("org.sqlite.JDBC");
|
||||||
|
@ -59,8 +59,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -69,7 +69,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
public class HybridPlotWorld extends ClassicPlotWorld {
|
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);
|
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
||||||
public boolean ROAD_SCHEMATIC_ENABLED;
|
public boolean ROAD_SCHEMATIC_ENABLED;
|
||||||
public boolean PLOT_SCHEMATIC = false;
|
public boolean PLOT_SCHEMATIC = false;
|
||||||
@ -190,7 +190,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
|
|
||||||
// Dump world settings
|
// Dump world settings
|
||||||
if (Settings.DEBUG) {
|
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();
|
final Field[] fields = this.getClass().getFields();
|
||||||
for (final Field field : fields) {
|
for (final Field field : fields) {
|
||||||
final String name = field.getName().toLowerCase(Locale.ENGLISH);
|
final String name = field.getName().toLowerCase(Locale.ENGLISH);
|
||||||
@ -206,7 +206,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
} catch (final IllegalAccessException e) {
|
} catch (final IllegalAccessException e) {
|
||||||
value = String.format("Failed to parse: %s", e.getMessage());
|
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) {
|
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 (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info(" - schematic: false");
|
LOGGER.info("- schematic: false");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
int pair = MathMan.pair(x, z);
|
int pair = MathMan.pair(x, z);
|
||||||
BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
|
BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
|
||||||
if (y >= height) {
|
if (y >= height) {
|
||||||
logger.error("Error adding overlay block. `y > height`");
|
LOGGER.error("Error adding overlay block. `y > height`");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
existing[y] = id;
|
existing[y] = id;
|
||||||
|
@ -62,8 +62,8 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -79,7 +79,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class HybridUtils {
|
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 HybridUtils manager;
|
||||||
public static Set<BlockVector2> regions;
|
public static Set<BlockVector2> regions;
|
||||||
@ -431,21 +431,21 @@ public class HybridUtils {
|
|||||||
iter.remove();
|
iter.remove();
|
||||||
boolean regenedRoad = regenerateRoad(area, chunk, extend);
|
boolean regenedRoad = regenerateRoad(area, chunk, extend);
|
||||||
if (!regenedRoad) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
if (count.intValue() % 20 == 0) {
|
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()) {
|
if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) {
|
||||||
regeneratePlotWalls(area);
|
regeneratePlotWalls(area);
|
||||||
|
|
||||||
HybridUtils.UPDATE = false;
|
HybridUtils.UPDATE = false;
|
||||||
logger.info("Finished road conversion");
|
LOGGER.info("Finished road conversion");
|
||||||
// CANCEL TASK
|
// CANCEL TASK
|
||||||
} else {
|
} else {
|
||||||
final Runnable task = this;
|
final Runnable task = this;
|
||||||
@ -456,8 +456,8 @@ public class HybridUtils {
|
|||||||
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
||||||
BlockVector2 loc = iterator.next();
|
BlockVector2 loc = iterator.next();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
logger.info("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
|
LOGGER.info("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
|
||||||
logger.info("- Remaining: {}", HybridUtils.regions.size());
|
LOGGER.info("- Remaining: {}", HybridUtils.regions.size());
|
||||||
chunks.addAll(getChunks(loc));
|
chunks.addAll(getChunks(loc));
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ public class HybridUtils {
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
boolean regenedRoads = regenerateRoad(area, chunk, extend);
|
boolean regenedRoads = regenerateRoad(area, chunk, extend);
|
||||||
if (!regenedRoads) {
|
if (!regenedRoads) {
|
||||||
logger.info("Failed to regenerate road");
|
LOGGER.info("Failed to regenerate road");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -482,7 +482,7 @@ public class HybridUtils {
|
|||||||
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
||||||
BlockVector2 loc = iterator.next();
|
BlockVector2 loc = iterator.next();
|
||||||
iterator.remove();
|
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(),
|
area.getWorldHash(),
|
||||||
loc.getX(),
|
loc.getX(),
|
||||||
loc.getZ()
|
loc.getZ()
|
||||||
|
@ -37,8 +37,8 @@ import com.plotsquared.core.util.RegionManager;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -48,7 +48,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public abstract class SquarePlotManager extends GridPlotManager {
|
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 SquarePlotWorld squarePlotWorld;
|
||||||
private final RegionManager regionManager;
|
private final RegionManager regionManager;
|
||||||
@ -244,7 +244,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
return plot.isMerged(Direction.NORTHWEST) ? id : null;
|
return plot.isMerged(Direction.NORTHWEST) ? id : null;
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,12 @@ import com.plotsquared.core.plot.PlotId;
|
|||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public abstract class SquarePlotWorld extends GridPlotWorld {
|
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 PLOT_WIDTH = 42;
|
||||||
public int ROAD_WIDTH = 7;
|
public int ROAD_WIDTH = 7;
|
||||||
@ -61,7 +61,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
|||||||
public void loadConfiguration(ConfigurationSection config) {
|
public void loadConfiguration(ConfigurationSection config) {
|
||||||
if (!config.contains("plot.height")) {
|
if (!config.contains("plot.height")) {
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.info(" - Configuration is null? ({})", config.getCurrentPath());
|
LOGGER.info("- Configuration is null? ({})", config.getCurrentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -53,7 +53,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ProcessedWEExtent extends AbstractDelegateExtent {
|
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 Set<CuboidRegion> mask;
|
||||||
private final String world;
|
private final String world;
|
||||||
|
@ -68,10 +68,10 @@ import net.kyori.adventure.text.Component;
|
|||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import net.kyori.adventure.title.Title;
|
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.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.time.Duration;
|
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 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
|
// Used to track debug mode
|
||||||
private static final Set<PlotPlayer<?>> debugModeEnabled =
|
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()) {
|
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
||||||
for (Plot owned : getPlots()) {
|
for (Plot owned : getPlots()) {
|
||||||
owned.getPlotModificationManager().deletePlot(null, null);
|
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) {
|
if (ExpireManager.IMP != null) {
|
||||||
|
@ -82,8 +82,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -124,7 +124,7 @@ public class Plot {
|
|||||||
|
|
||||||
public static final int MAX_HEIGHT = 256;
|
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 DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
||||||
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ public class Plot {
|
|||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
if (message) {
|
if (message) {
|
||||||
logger.info("No plot area string was supplied");
|
LOGGER.info("No plot area string was supplied");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1668,7 +1668,7 @@ public class Plot {
|
|||||||
|
|
||||||
if (updateDB) {
|
if (updateDB) {
|
||||||
if (!this.getPlotModificationManager().create(player.getUUID(), true)) {
|
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()
|
this.getId().toCommaSeparatedString()
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
@ -72,8 +72,8 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -95,7 +95,7 @@ import java.util.function.Consumer;
|
|||||||
*/
|
*/
|
||||||
public abstract class PlotArea {
|
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 MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
||||||
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public abstract class PlotArea {
|
|||||||
try {
|
try {
|
||||||
flags.add(flagInstance.parse(split[1]));
|
flags.add(flagInstance.parse(split[1]));
|
||||||
} catch (final FlagParseException e) {
|
} catch (final FlagParseException e) {
|
||||||
logger.warn(
|
LOGGER.warn(
|
||||||
"Failed to parse default flag with key '{}' and value '{}'. "
|
"Failed to parse default flag with key '{}' and value '{}'. "
|
||||||
+ "Reason: {}. This flag will not be added as a default flag.",
|
+ "Reason: {}. This flag will not be added as a default flag.",
|
||||||
e.getFlag().getName(),
|
e.getFlag().getName(),
|
||||||
|
@ -54,8 +54,8 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -75,7 +75,7 @@ import static com.plotsquared.core.plot.Plot.MAX_HEIGHT;
|
|||||||
*/
|
*/
|
||||||
public final class PlotModificationManager {
|
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 Plot plot;
|
||||||
private final ProgressSubscriberFactory subscriberFactory;
|
private final ProgressSubscriberFactory subscriberFactory;
|
||||||
@ -504,7 +504,7 @@ public final class PlotModificationManager {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logger.info(
|
LOGGER.info(
|
||||||
"Failed to add plot {} to plot area {}",
|
"Failed to add plot {} to plot area {}",
|
||||||
this.plot.getId().toCommaSeparatedString(),
|
this.plot.getId().toCommaSeparatedString(),
|
||||||
this.plot.getArea().toString()
|
this.plot.getArea().toString()
|
||||||
|
@ -34,8 +34,8 @@ import com.plotsquared.core.util.MathMan;
|
|||||||
import com.plotsquared.core.util.query.PlotQuery;
|
import com.plotsquared.core.util.query.PlotQuery;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -47,7 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class PlotAnalysis {
|
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 static boolean running = false;
|
||||||
public int changes;
|
public int changes;
|
||||||
@ -97,11 +97,11 @@ public class PlotAnalysis {
|
|||||||
*/
|
*/
|
||||||
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
||||||
if (running) {
|
if (running) {
|
||||||
logger.info("Calibration task already in progress!");
|
LOGGER.info("Calibration task already in progress!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (threshold <= 0 || threshold >= 1) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
running = true;
|
running = true;
|
||||||
@ -110,7 +110,7 @@ public class PlotAnalysis {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Iterator<Plot> iterator = plots.iterator();
|
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()) {
|
while (iterator.hasNext()) {
|
||||||
Plot plot = iterator.next();
|
Plot plot = iterator.next();
|
||||||
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
|
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
|
||||||
@ -122,14 +122,14 @@ public class PlotAnalysis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plots.size() < 3) {
|
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;
|
running = false;
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
}
|
}
|
||||||
return;
|
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[] changes = new int[plots.size()];
|
||||||
int[] faces = new int[plots.size()];
|
int[] faces = new int[plots.size()];
|
||||||
@ -154,7 +154,7 @@ public class PlotAnalysis {
|
|||||||
ratings[i] = (int) (
|
ratings[i] = (int) (
|
||||||
(plot.getAverageRating() + plot.getSettings().getRatings().size())
|
(plot.getAverageRating() + plot.getSettings().getRatings().size())
|
||||||
* 100);
|
* 100);
|
||||||
logger.info(" | {} (rating) {}", plot, ratings[i]);
|
LOGGER.info(" | {} (rating) {}", plot, ratings[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -166,7 +166,7 @@ public class PlotAnalysis {
|
|||||||
if (queuePlot == null) {
|
if (queuePlot == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger.info(" | {}", queuePlot);
|
LOGGER.info(" | {}", queuePlot);
|
||||||
|
|
||||||
final Object lock = new Object();
|
final Object lock = new Object();
|
||||||
TaskManager.runTask(new Runnable() {
|
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 {
|
try {
|
||||||
ratingAnalysis.join();
|
ratingAnalysis.join();
|
||||||
@ -207,11 +207,11 @@ public class PlotAnalysis {
|
|||||||
e.printStackTrace();
|
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++) {
|
for (int i = 0; i < plots.size(); i++) {
|
||||||
Plot plot = plots.get(i);
|
Plot plot = plots.get(i);
|
||||||
logger.info(" | {}", plot);
|
LOGGER.info("| {}", plot);
|
||||||
|
|
||||||
PlotAnalysis analysis = plot.getComplexity(null);
|
PlotAnalysis analysis = plot.getComplexity(null);
|
||||||
|
|
||||||
@ -228,16 +228,16 @@ public class PlotAnalysis {
|
|||||||
variety_sd[i] = analysis.variety_sd;
|
variety_sd[i] = analysis.variety_sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(" - Calculating rankings");
|
LOGGER.info("- Calculating rankings");
|
||||||
|
|
||||||
int[] rankRatings = rank(ratings);
|
int[] rankRatings = rank(ratings);
|
||||||
int n = rankRatings.length;
|
int n = rankRatings.length;
|
||||||
|
|
||||||
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
|
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
|
||||||
|
|
||||||
logger.info(" - Calculating rank correlation: ");
|
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 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("- The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
|
||||||
|
|
||||||
Settings.Auto_Clear settings = new Settings.Auto_Clear();
|
Settings.Auto_Clear settings = new Settings.Auto_Clear();
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factorChanges * 1000 / MathMan.getMean(changes));
|
(int) (factorChanges * 1000 / MathMan.getMean(changes));
|
||||||
|
|
||||||
logger.info(" - | changes {}", factorChanges);
|
LOGGER.info("- | changes {}", factorChanges);
|
||||||
|
|
||||||
int[] rankFaces = rank(faces);
|
int[] rankFaces = rank(faces);
|
||||||
int[] sdFaces = getSD(rankFaces, rankRatings);
|
int[] sdFaces = getSD(rankFaces, rankRatings);
|
||||||
@ -260,7 +260,7 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.FACES =
|
settings.CALIBRATION.FACES =
|
||||||
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
|
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
|
||||||
|
|
||||||
logger.info(" - | faces {}", factorFaces);
|
LOGGER.info("- | faces {}", factorFaces);
|
||||||
|
|
||||||
int[] rankData = rank(data);
|
int[] rankData = rank(data);
|
||||||
int[] sdData = getSD(rankData, rankRatings);
|
int[] sdData = getSD(rankData, rankRatings);
|
||||||
@ -270,7 +270,7 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.DATA =
|
settings.CALIBRATION.DATA =
|
||||||
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(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[] rank_air = rank(air);
|
||||||
int[] sd_air = getSD(rank_air, rankRatings);
|
int[] sd_air = getSD(rank_air, rankRatings);
|
||||||
@ -280,7 +280,7 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.AIR =
|
settings.CALIBRATION.AIR =
|
||||||
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(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);
|
int[] rank_variety = rank(variety);
|
||||||
@ -292,7 +292,7 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factor_variety * 1000 / MathMan.getMean(variety));
|
(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[] rank_changes_sd = rank(changes_sd);
|
||||||
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
|
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
|
||||||
@ -303,7 +303,7 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
|
(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[] rank_faces_sd = rank(faces_sd);
|
||||||
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
|
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
|
||||||
@ -314,7 +314,7 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
|
(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[] rank_data_sd = rank(data_sd);
|
||||||
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
|
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
|
||||||
@ -325,7 +325,7 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
|
(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[] rank_air_sd = rank(air_sd);
|
||||||
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
|
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
|
||||||
@ -335,7 +335,7 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.AIR_SD =
|
settings.CALIBRATION.AIR_SD =
|
||||||
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(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[] rank_variety_sd = rank(variety_sd);
|
||||||
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
|
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
|
||||||
@ -346,11 +346,11 @@ public class PlotAnalysis {
|
|||||||
0 :
|
0 :
|
||||||
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
|
(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];
|
int[] complexity = new int[n];
|
||||||
|
|
||||||
logger.info("Calculating threshold");
|
LOGGER.info("Calculating threshold");
|
||||||
|
|
||||||
int max = 0;
|
int max = 0;
|
||||||
int min = 0;
|
int min = 0;
|
||||||
@ -380,7 +380,7 @@ public class PlotAnalysis {
|
|||||||
logln("Correlation: ");
|
logln("Correlation: ");
|
||||||
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
|
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
|
||||||
if (optimalComplexity == Integer.MAX_VALUE) {
|
if (optimalComplexity == Integer.MAX_VALUE) {
|
||||||
logger.info("Insufficient data to determine correlation! {} | {}",
|
LOGGER.info("Insufficient data to determine correlation! {} | {}",
|
||||||
optimalIndex, n
|
optimalIndex, n
|
||||||
);
|
);
|
||||||
running = false;
|
running = false;
|
||||||
@ -399,21 +399,21 @@ public class PlotAnalysis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save calibration
|
// Save calibration
|
||||||
logger.info(" Saving calibration");
|
LOGGER.info("Saving calibration");
|
||||||
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
|
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
|
||||||
Settings.save(PlotSquared.get().getWorldsFile());
|
Settings.save(PlotSquared.get().getWorldsFile());
|
||||||
running = false;
|
running = false;
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
}
|
}
|
||||||
logger.info(" Done!");
|
LOGGER.info("Done!");
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logln(Object obj) {
|
public static void logln(Object obj) {
|
||||||
logger.info("" + log(obj));
|
LOGGER.info("" + log(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String log(Object obj) {
|
public static String log(Object obj) {
|
||||||
|
@ -29,8 +29,8 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -44,7 +44,7 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
public class FlagContainer {
|
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<String, String> unknownFlags = new HashMap<>();
|
||||||
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
|
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
|
||||||
@ -160,7 +160,7 @@ public class FlagContainer {
|
|||||||
this.updateSubscribers
|
this.updateSubscribers
|
||||||
.forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType));
|
.forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType));
|
||||||
} catch (IllegalStateException e) {
|
} 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 "
|
+ "flag name exceeded the allowed limit of 64 characters. Please tell the developer "
|
||||||
+ "of the flag to fix this.", flag.getName(), flag.getClass().getName());
|
+ "of the flag to fix this.", flag.getName(), flag.getClass().getName());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -33,8 +33,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -45,7 +45,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class BlockTypeWrapper {
|
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<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
||||||
private static final Map<String, BlockTypeWrapper> blockCategories = 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);
|
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
|
||||||
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
|
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
|
||||||
if (Settings.DEBUG) {
|
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);
|
this.blockCategory = new NullBlockCategory(this.blockCategoryId);
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ package com.plotsquared.core.queue;
|
|||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public abstract class QueueProvider {
|
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) {
|
public static QueueProvider of(final @NonNull Class<? extends QueueCoordinator> primary) {
|
||||||
return new QueueProvider() {
|
return new QueueProvider() {
|
||||||
@ -43,9 +43,9 @@ public abstract class QueueProvider {
|
|||||||
try {
|
try {
|
||||||
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
|
return (QueueCoordinator) primary.getConstructors()[0].newInstance(world);
|
||||||
} catch (Throwable e) {
|
} 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")) {
|
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.",
|
"It looks like {} is a custom queue. Please look for a plugin in its classpath and report to them.",
|
||||||
primary.getSimpleName()
|
primary.getSimpleName()
|
||||||
);
|
);
|
||||||
|
@ -33,8 +33,8 @@ import com.plotsquared.core.plot.BlockBucket;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -48,7 +48,7 @@ import java.util.Map;
|
|||||||
public final class LegacyConverter {
|
public final class LegacyConverter {
|
||||||
|
|
||||||
public static final String CONFIGURATION_VERSION = "post_flattening";
|
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<>();
|
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -35,8 +35,8 @@ import com.sk89q.jnbt.CompoundTag;
|
|||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -52,7 +52,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
*/
|
*/
|
||||||
public class PlotUploader {
|
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 static final Path TEMP_DIR = Paths.get(PlotSquared.platform().getDirectory().getPath());
|
||||||
private final SchematicHandler schematicHandler;
|
private final SchematicHandler schematicHandler;
|
||||||
private final Arkitektonika arkitektonika;
|
private final Arkitektonika arkitektonika;
|
||||||
@ -104,13 +104,13 @@ public class PlotUploader {
|
|||||||
final CompletableFuture<SchematicKeys> upload = this.arkitektonika.upload(file.toFile());
|
final CompletableFuture<SchematicKeys> upload = this.arkitektonika.upload(file.toFile());
|
||||||
return upload.join();
|
return upload.join();
|
||||||
} catch (CompletionException e) {
|
} catch (CompletionException e) {
|
||||||
logger.error("Failed to upload schematic", e);
|
LOGGER.error("Failed to upload schematic", e);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
Files.delete(file);
|
Files.delete(file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Failed to delete temporary file {}", file, e);
|
LOGGER.error("Failed to delete temporary file {}", file, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ import com.sk89q.worldedit.world.World;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -58,7 +58,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public abstract class RegionManager {
|
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;
|
public static RegionManager manager = null;
|
||||||
private final WorldUtil worldUtil;
|
private final WorldUtil worldUtil;
|
||||||
@ -100,7 +100,7 @@ public abstract class RegionManager {
|
|||||||
for (BlockVector2 loc : chunks) {
|
for (BlockVector2 loc : chunks) {
|
||||||
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
|
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
|
||||||
File file = new File(PlotSquared.platform().worldContainer(), directory);
|
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()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -114,7 +114,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
public abstract class SchematicHandler {
|
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();
|
private static final Gson GSON = new Gson();
|
||||||
public static SchematicHandler manager;
|
public static SchematicHandler manager;
|
||||||
private final WorldUtil worldUtil;
|
private final WorldUtil worldUtil;
|
||||||
@ -260,7 +260,7 @@ public abstract class SchematicHandler {
|
|||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
boolean result = save(compoundTag, directory + File.separator + name + ".schem");
|
boolean result = save(compoundTag, directory + File.separator + name + ".schem");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.error("Failed to save {}", plot.getId());
|
LOGGER.error("Failed to save {}", plot.getId());
|
||||||
}
|
}
|
||||||
TaskManager.runTask(THIS);
|
TaskManager.runTask(THIS);
|
||||||
});
|
});
|
||||||
|
@ -35,8 +35,8 @@ import com.plotsquared.core.util.task.TaskManager;
|
|||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -66,7 +66,7 @@ import java.util.function.Function;
|
|||||||
*/
|
*/
|
||||||
public class UUIDPipeline {
|
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 static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
|
||||||
|
|
||||||
private final Executor executor;
|
private final Executor executor;
|
||||||
@ -176,7 +176,7 @@ public class UUIDPipeline {
|
|||||||
} catch (TimeoutException ignored) {
|
} catch (TimeoutException ignored) {
|
||||||
// This is completely valid, we just don't care anymore
|
// This is completely valid, we just don't care anymore
|
||||||
if (Settings.DEBUG) {
|
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;
|
return null;
|
||||||
@ -201,7 +201,7 @@ public class UUIDPipeline {
|
|||||||
} catch (TimeoutException ignored) {
|
} catch (TimeoutException ignored) {
|
||||||
// This is completely valid, we just don't care anymore
|
// This is completely valid, we just don't care anymore
|
||||||
if (Settings.DEBUG) {
|
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;
|
return null;
|
||||||
@ -345,7 +345,7 @@ public class UUIDPipeline {
|
|||||||
this.consume(mappings);
|
this.consume(mappings);
|
||||||
return mappings;
|
return mappings;
|
||||||
} else if (Settings.DEBUG) {
|
} 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) {
|
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
|
||||||
@ -414,7 +414,7 @@ public class UUIDPipeline {
|
|||||||
this.consume(mappings);
|
this.consume(mappings);
|
||||||
return mappings;
|
return mappings;
|
||||||
} else if (Settings.DEBUG) {
|
} 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");
|
throw new ServiceError("End of pipeline");
|
||||||
|
@ -32,14 +32,14 @@ import com.plotsquared.core.plot.flag.implementations.UseFlag;
|
|||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class FlagTest {
|
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;
|
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
|
// //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);
|
// Optional<? extends Collection> flag = plot.getFlag(use);
|
||||||
// if (flag.isPresent()) {
|
// if (flag.isPresent()) {
|
||||||
// logger.info(Flags.USE.valueToString(flag.get()));
|
// LOGGER.info(Flags.USE.valueToString(flag.get()));
|
||||||
// testBlock = ItemTypes.BONE_BLOCK;
|
// testBlock = ItemTypes.BONE_BLOCK;
|
||||||
// flag.get().add(testBlock);
|
// 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);
|
// Optional<Set<BlockType>> flag2 = plot.getFlag(Flags.USE);
|
||||||
// if (flag2.isPresent()) {
|
// if (flag2.isPresent()) {
|
||||||
// // assertThat(flag2.get(), (Matcher<? super Set<BlockType>>) IsCollectionContaining.hasItem(testBlock));
|
// // assertThat(flag2.get(), (Matcher<? super Set<BlockType>>) IsCollectionContaining.hasItem(testBlock));
|
||||||
|
@ -27,18 +27,18 @@ package com.plotsquared.core.plot;
|
|||||||
|
|
||||||
import com.plotsquared.core.PlotVersion;
|
import com.plotsquared.core.PlotVersion;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class PlotVersionTest {
|
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
|
@Test
|
||||||
public void tryParse() {
|
public void tryParse() {
|
||||||
//These are all random values chosen to form the test class.
|
//These are all random values chosen to form the test class.
|
||||||
PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05");
|
PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05");
|
||||||
logger.info(version.versionString);
|
LOGGER.info(version.versionString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,7 @@ luckperms = "5.3"
|
|||||||
essentialsx = "2.18.2"
|
essentialsx = "2.18.2"
|
||||||
hyperverse = "0.6.0-SNAPSHOT"
|
hyperverse = "0.6.0-SNAPSHOT"
|
||||||
|
|
||||||
slf4j-api = "1.7.30"
|
log4j-api = "2.8.1"
|
||||||
log4j-slf4j-impl = "2.8.1"
|
|
||||||
|
|
||||||
prtree = "1.7.0-SNAPSHOT"
|
prtree = "1.7.0-SNAPSHOT"
|
||||||
aopalliance = "1.0"
|
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" }
|
hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" }
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
|
log4j = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j-api" }
|
||||||
log4j = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j-slf4j-impl" }
|
|
||||||
|
|
||||||
# Other libraries
|
# Other libraries
|
||||||
prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" }
|
prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" }
|
||||||
|
Loading…
Reference in New Issue
Block a user