Cleanup logging system

This commit is contained in:
N0tMyFaultOG 2020-08-18 15:50:28 +02:00
parent b6e7f90f6a
commit 352136f0c6
32 changed files with 250 additions and 250 deletions

View File

@ -257,12 +257,12 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
if (PremiumVerification.isPremium()) {
logger.info("[P2] PlotSquared version licensed to Spigot user {}", getUserID());
logger.info("[P2] https://www.spigotmc.org/resources/{}", getResourceID());
logger.info("[P2] Download ID: {}", getDownloadID());
logger.info("[P2] Thanks for supporting us :)");
logger.info("PlotSquared version licensed to Spigot user {}", getUserID());
logger.info("https://www.spigotmc.org/resources/{}", getResourceID());
logger.info("Download ID: {}", getDownloadID());
logger.info("Thanks for supporting us :)");
} else {
logger.info("[P2] Couldn't verify purchase :(");
logger.info("Couldn't verify purchase :(");
}
// Database
@ -274,7 +274,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
// Perform upgrade
if (DBFunc.dbManager.convertFlags()) {
logger.info("[P2] Flags were converted successfully!");
logger.info("Flags were converted successfully!");
// Update the config version
try {
plotSquared.setConfigurationVersion("v5");
@ -298,13 +298,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// WorldEdit
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
try {
logger.info("[P2] {} hooked into WorldEdit", this.getPluginName());
logger.info("{} hooked into WorldEdit", this.getPluginName());
WorldEdit.getInstance().getEventBus().register(this.getInjector().getInstance(WESubscriber.class));
if (Settings.Enabled_Components.COMMANDS) {
new WE_Anywhere();
}
} catch (Throwable e) {
logger.error("[P2] Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
logger.error("Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master");
}
}
@ -347,7 +347,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
try {
getInjector().getInstance(ComponentPresetManager.class);
} catch (final Exception e) {
logger.error("[P2] Failed to initialize the preset system", e);
logger.error("Failed to initialize the preset system", e);
}
}
@ -370,11 +370,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
continue;
}
if (!worldUtil.isWorld(world) && !world.equals("*")) {
logger.warn("[P2] `{}` was not properly loaded - {} will now try to load it properly", world, this.getPluginName());
logger.warn("`{}` was not properly loaded - {} will now try to load it properly", world, this.getPluginName());
logger.warn(
"[P2] - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
logger.warn("[P2] - Your world management plugin may be faulty (or non existent)");
logger.warn("[P2] This message may also be a false positive and could be ignored.");
" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
logger.warn(" - Your world management plugin may be faulty (or non existent)");
logger.warn(" This message may also be a false positive and could be ignored.");
this.setGenerator(world);
}
}
@ -394,7 +394,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
this.impromptuPipeline.registerService(offlineModeUUIDService);
this.backgroundPipeline.registerService(offlineModeUUIDService);
logger.info("[P2] (UUID) Using the offline mode UUID service");
logger.info("(UUID) Using the offline mode UUID service");
}
if (Settings.UUID.SERVICE_BUKKIT) {
@ -415,7 +415,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final LuckPermsUUIDService luckPermsUUIDService;
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
luckPermsUUIDService = new LuckPermsUUIDService();
logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service");
logger.info("(UUID) Using LuckPerms as a complementary UUID service");
} else {
luckPermsUUIDService = null;
}
@ -423,7 +423,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final BungeePermsUUIDService bungeePermsUUIDService;
if (Settings.UUID.SERVICE_BUNGEE_PERMS && Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
bungeePermsUUIDService = new BungeePermsUUIDService();
logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service");
logger.info("(UUID) Using BungeePerms as a complementary UUID service");
} else {
bungeePermsUUIDService = null;
}
@ -431,7 +431,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final EssentialsUUIDService essentialsUUIDService;
if (Settings.UUID.SERVICE_ESSENTIALSX && Bukkit.getPluginManager().getPlugin("Essentials") != null) {
essentialsUUIDService = new EssentialsUUIDService();
logger.info("[P2] (UUID) Using EssentialsX as a complementary UUID service");
logger.info("(UUID) Using EssentialsX as a complementary UUID service");
} else {
essentialsUUIDService = null;
}
@ -442,7 +442,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final PaperUUIDService paperUUIDService = new PaperUUIDService();
this.impromptuPipeline.registerService(paperUUIDService);
this.backgroundPipeline.registerService(paperUUIDService);
logger.info("[P2] (UUID) Using Paper as a complementary UUID service");
logger.info("(UUID) Using Paper as a complementary UUID service");
}
this.impromptuPipeline.registerService(sqLiteUUIDService);
@ -496,9 +496,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
}
logger.info("[P2] PlotSquared hooked into PlaceholderAPI");
logger.info("PlotSquared hooked into PlaceholderAPI");
} else {
logger.info("[P2] PlaceholderAPI is not in use. Hook deactivated");
logger.info("PlaceholderAPI is not in use. Hook deactivated");
}
this.startMetrics();
@ -570,7 +570,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final Chunk[] chunks = world.getLoadedChunks();
if (chunks.length == 0) {
if (!Bukkit.unloadWorld(world, true)) {
logger.warn("[P2] Failed to unload {}", world.getName());
logger.warn("Failed to unload {}", world.getName());
}
return;
} else {
@ -619,7 +619,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
});
logger.info("[P2] (UUID) {} UUIDs will be cached", uuidQueue.size());
logger.info("(UUID) {} UUIDs will be cached", uuidQueue.size());
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
// Begin by reading all the SQLite cache at once
@ -627,7 +627,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Now fetch names for all known UUIDs
final int totalSize = uuidQueue.size();
int read = 0;
logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
logger.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
// Used to indicate that the second retrieval has been attempted
@ -635,7 +635,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
if (!uuidList.isEmpty() && secondRun) {
logger.warn("[P2] (UUID) Giving up on last batch. Fetching new batch instead");
logger.warn("(UUID) Giving up on last batch. Fetching new batch instead");
uuidList.clear();
}
if (uuidList.isEmpty()) {
@ -659,13 +659,13 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// Print progress
final double percentage = ((double) read / (double) totalSize) * 100.0D;
if (Settings.DEBUG) {
logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
logger.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
}
} catch (final InterruptedException | ExecutionException e) {
logger.error("[P2] (UUID) Failed to retrieve last batch. Will try again", e);
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
}
}
logger.info("[P2] (UUID) PlotSquared has cached all UUIDs");
logger.info("(UUID) PlotSquared has cached all UUIDs");
}, 10, TimeUnit.SECONDS);
}
@ -697,7 +697,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
@SuppressWarnings("deprecation") private void runEntityTask() {
logger.info("[P2] KillAllEntities started");
logger.info("KillAllEntities started");
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
final World world = Bukkit.getWorld(plotArea.getWorldName());
try {
@ -1018,7 +1018,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
}
} catch (final Exception e) {
logger.error("[P2] Failed to reload world: {} | {}", world, e.getMessage());
logger.error("Failed to reload world: {} | {}", world, e.getMessage());
Bukkit.getServer().unloadWorld(world, false);
return;
}

View File

@ -391,7 +391,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
try {
entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) {
logger.error("[P2] Failed to restore inventory", e);
logger.error("Failed to restore inventory", e);
}
}
@ -738,7 +738,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
return entity;
default:
if (Settings.DEBUG) {
logger.info("[P2] Could not identify entity: {}", entity.getType());
logger.info("Could not identify entity: {}", entity.getType());
}
return entity;
// END LIVING

View File

@ -46,8 +46,8 @@ public class BackupModule extends AbstractModule {
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
bind(BackupManager.class).to(SimpleBackupManager.class);
} catch (final Exception e) {
logger.error("[P2] Failed to initialize backup manager", e);
logger.error("[P2] Backup features will be disabled");
logger.error("Failed to initialize backup manager", e);
logger.error("Backup features will be disabled");
bind(BackupManager.class).to(NullBackupManager.class);
}
}

View File

@ -349,7 +349,7 @@ public class BukkitUtil extends WorldUtil {
@Override public void setBiomes(@Nonnull final String worldName, @Nonnull final CuboidRegion region, @Nonnull final BiomeType biomeType) {
final World world = getWorld(worldName);
if (world == null) {
logger.warn("[P2] An error occurred while setting the biome because the world was null", new RuntimeException());
logger.warn("An error occurred while setting the biome because the world was null", new RuntimeException());
return;
}
final Biome biome = BukkitAdapter.adapt(biomeType);
@ -459,7 +459,7 @@ public class BukkitUtil extends WorldUtil {
}
break;
default: {
logger.error("[P2] Unknown entity category requested: {}", category);
logger.error("Unknown entity category requested: {}", category);
}
break;
}

View File

@ -126,7 +126,7 @@ public class ContentMap {
try {
entity.spawn(world, xOffset, zOffset);
} catch (Exception e) {
logger.error("[P2] Failed to restore entity", e);
logger.error("Failed to restore entity", e);
}
}
this.entities.clear();

View File

@ -72,22 +72,22 @@ public class UpdateUtility implements Listener {
.getAsJsonObject();
spigotVersion = result.get("current_version").getAsString();
} catch (IOException e) {
logger.error("[P2] Unable to check for updates. Error: {}", e.getMessage());
logger.error("Unable to check for updates. Error: {}", e.getMessage());
return;
}
if (internalVersion.isLaterVersion(spigotVersion)) {
logger.info("[P2] There appears to be a PlotSquared update available!");
logger.info("[P2] You are running version {}, the latest version is {}",
logger.info("There appears to be a PlotSquared update available!");
logger.info("You are running version {}, the latest version is {}",
internalVersion.versionString(), spigotVersion);
logger.info("[P2] https://www.spigotmc.org/resources/77506/updates");
logger.info("https://www.spigotmc.org/resources/77506/updates");
hasUpdate = true;
if (Settings.UpdateChecker.NOTIFY_ONCE) {
cancelTask();
}
} else if (notify) {
notify = false;
logger.info("[P2] Congratulations! You are running the latest PlotSquared version");
logger.info("Congratulations! You are running the latest PlotSquared version");
}
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
}

View File

@ -82,7 +82,7 @@ public class SquirrelIdUUIDService implements UUIDService {
//
if (uuids.size() >= 2) {
if (Settings.DEBUG) {
logger.info("[P2] (UUID) Found invalid UUID in batch. Will try each UUID individually.");
logger.info("(UUID) Found invalid UUID in batch. Will try each UUID individually.");
}
for (final UUID uuid : uuids) {
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
@ -92,7 +92,7 @@ public class SquirrelIdUUIDService implements UUIDService {
results.add(result.get(0));
}
} else if (uuids.size() == 1 && Settings.DEBUG) {
logger.info("[P2] (UUID) Found invalid UUID: {}", uuids.get(0));
logger.info("(UUID) Found invalid UUID: {}", uuids.get(0));
}
}
} catch (IOException | InterruptedException e) {

View File

@ -391,16 +391,16 @@ public class PlotSquared {
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
int height = (int) list.get(2);
logger.info("[P2] Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
logger.info("[P2] - Regions: {}", regions.size());
logger.info("[P2] - Chunks: {}", chunks.size());
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
logger.info(" - Regions: {}", regions.size());
logger.info(" - Chunks: {}", chunks.size());
HybridUtils.UPDATE = true;
PlotSquared.platform().getHybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
} catch (IOException | ClassNotFoundException e) {
logger.error("[P2] Error restarting road regeneration", e);
logger.error("Error restarting road regeneration", e);
} finally {
if (!file.delete()) {
logger.error("[P2] 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());
}
}
});
@ -803,10 +803,10 @@ public class PlotSquared {
// Conventional plot generator
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
PlotManager plotManager = plotArea.getPlotManager();
logger.info("[P2] Detected world load for '{}'", world);
logger.info("[P2] - generator: {}>{}", baseGenerator, plotGenerator);
logger.info("[P2] - plot world: {}", plotArea.getClass().getCanonicalName());
logger.info("[P2] - plot area manager: {}", plotManager.getClass().getCanonicalName());
logger.info("Detected world load for '{}'", world);
logger.info(" - generator: {}>{}", baseGenerator, plotGenerator);
logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName());
logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
if (!this.worldConfiguration.contains(path)) {
this.worldConfiguration.createSection(path);
worldSection = this.worldConfiguration.getConfigurationSection(path);
@ -830,7 +830,7 @@ public class PlotSquared {
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
return;
}
logger.info("[P2] Detected world load for '{}'", world);
logger.info("Detected world load for '{}'", world);
String gen_string = worldSection.getString("generator.plugin", platform.getPluginName());
if (type == PlotAreaType.PARTIAL) {
Set<PlotCluster> clusters =
@ -846,7 +846,7 @@ public class PlotSquared {
String fullId = name + "-" + pos1 + "-" + pos2;
worldSection.createSection("areas." + fullId);
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
logger.info("[P2] - {}-{}-{}", name, pos1, pos2);
logger.info(" - {}-{}-{}", name, pos1, pos2);
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
@ -860,10 +860,10 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
logger.info("[P2] | plot world: {}", pa);
logger.info("[P2] | manager: {}", pa);
logger.info("[P2] Note: Area created for cluster '{}' (invalid or old configuration?)", name);
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
logger.info(" | plot world: {}", pa);
logger.info(" | manager: {}", pa);
logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
toLoad.add(pa);
@ -885,9 +885,9 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info("[P2] - generator: {}>{}", baseGenerator, areaGen);
logger.info("[P2] - plot world: {}", pa);
logger.info("[P2] - plot area manager: {}", pa.getPlotManager());
logger.info(" - generator: {}>{}", baseGenerator, areaGen);
logger.info(" - plot world: {}", pa);
logger.info(" - plot area manager: {}", pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -899,7 +899,7 @@ public class PlotSquared {
+ PlotAreaType.AUGMENTED + "`");
}
for (String areaId : areasSection.getKeys(false)) {
logger.info("[P2] - {}", areaId);
logger.info(" - {}", areaId);
String[] split = areaId.split("(?<=[^;-])-");
if (split.length != 3) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
@ -961,10 +961,10 @@ public class PlotSquared {
} catch (IOException e) {
e.printStackTrace();
}
logger.info("[P2] Detected area load for '{}'", world);
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
logger.info("[P2] | plot world: {}", pa);
logger.info("[P2] | manager: {}", pa.getPlotManager());
logger.info("Detected area load for '{}'", world);
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
logger.info(" | plot world: {}", pa);
logger.info(" | manager: {}", pa.getPlotManager());
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
@ -1035,7 +1035,7 @@ public class PlotSquared {
for (String element : split) {
String[] pair = element.split("=");
if (pair.length != 2) {
logger.error("[P2] No value provided for '{}'", element);
logger.error("No value provided for '{}'", element);
return false;
}
String key = pair[0].toLowerCase();
@ -1083,11 +1083,11 @@ public class PlotSquared {
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString());
break;
default:
logger.error("[P2] Key not found: {}", element);
logger.error("Key not found: {}", element);
return false;
}
} catch (Exception e) {
logger.error("[P2] Invalid value '{}' for arg '{}'", value, element);
logger.error("Invalid value '{}' for arg '{}'", value, element);
e.printStackTrace();
return false;
}
@ -1155,7 +1155,7 @@ public class PlotSquared {
}
}
} catch (IOException e) {
logger.error("[P2] Could not save {}", file);
logger.error("Could not save {}", file);
e.printStackTrace();
}
}
@ -1178,7 +1178,7 @@ public class PlotSquared {
// Close the connection
DBFunc.close();
} catch (NullPointerException throwable) {
logger.error("[P2] Could not close database connection", throwable);
logger.error("Could not close database connection", throwable);
throwable.printStackTrace();
}
}
@ -1191,9 +1191,9 @@ public class PlotSquared {
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
return;
}
logger.info("[P2] Road regeneration incomplete. Saving incomplete regions to disk");
logger.info("[P2] - regions: {}", HybridUtils.regions.size());
logger.info("[P2] - chunks: {}", HybridUtils.chunks.size());
logger.info("Road regeneration incomplete. Saving incomplete regions to disk");
logger.info(" - regions: {}", HybridUtils.regions.size());
logger.info(" - chunks: {}", HybridUtils.chunks.size());
ArrayList<int[]> regions = new ArrayList<>();
ArrayList<int[]> chunks = new ArrayList<>();
for (BlockVector2 r : HybridUtils.regions) {
@ -1210,14 +1210,14 @@ public class PlotSquared {
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
.getId() + "_" + HybridUtils.area.getWorldName());
if (file.exists() && !file.delete()) {
logger.error("[P2] persistent_regene_data file already exists and could not be deleted");
logger.error("persistent_regene_data file already exists and could not be deleted");
return;
}
try (ObjectOutputStream oos = new ObjectOutputStream(
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
oos.writeObject(list);
} catch (IOException e) {
logger.error("[P2] Error creating persistent_region_data file", e);
logger.error("Error creating persistent_region_data file", e);
}
}
@ -1237,7 +1237,7 @@ public class PlotSquared {
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
database = new SQLite(file);
} else {
logger.error("[P2] No storage type is set. Disabling PlotSquared");
logger.error("No storage type is set. Disabling PlotSquared");
this.platform.shutdown(); //shutdown used instead of disable because no database is set
return;
}
@ -1255,11 +1255,11 @@ public class PlotSquared {
}
this.clustersTmp = DBFunc.getClusters();
} catch (ClassNotFoundException | SQLException e) {
logger.error("[P2] Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
logger.error("[P2] ==== Here is an ugly stacktrace, if you are interested in those things ===");
logger.error("Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
logger.error("==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace();
logger.error("[P2] &d==== End of stacktrace ====");
logger.error("[P2] &6Please go to the {} 'storage.yml' and configure the database correctly",
logger.error("==== End of stacktrace ====");
logger.error("Please go to the {} 'storage.yml' and configure the database correctly",
platform.getPluginName());
this.platform.shutdown(); //shutdown used instead of disable because of database error
}
@ -1285,7 +1285,7 @@ public class PlotSquared {
try {
worldConfiguration.save(worldsFile);
} catch (IOException e) {
logger.error("[P2] Failed to save worlds.yml", e);
logger.error("Failed to save worlds.yml", e);
e.printStackTrace();
}
}
@ -1319,12 +1319,12 @@ public class PlotSquared {
public boolean setupConfigs() {
File folder = new File(this.platform.getDirectory(), "config");
if (!folder.exists() && !folder.mkdirs()) {
logger.error("[P2] Failed to create the /plugins/config folder. Please create it manually");
logger.error("Failed to create the /plugins/PlotSquared/config folder. Please create it manually");
}
try {
this.worldsFile = new File(folder, "worlds.yml");
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
logger.error("[P2] 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);
@ -1334,20 +1334,20 @@ public class PlotSquared {
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
.getString("configuration_version").equalsIgnoreCase("v5"))) {
// Conversion needed
logger.info("[P2] &aA legacy configuration file was detected. Conversion will be attempted.");
logger.info("A legacy configuration file was detected. Conversion will be attempted.");
try {
com.google.common.io.Files
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
logger.info("[P2] &6A copy of worlds.yml has been saved in the file worlds.yml.old");
logger.info("A copy of worlds.yml has been saved in the file worlds.yml.old");
final ConfigurationSection worlds =
this.worldConfiguration.getConfigurationSection("worlds");
final LegacyConverter converter = new LegacyConverter(worlds);
converter.convert();
this.worldConfiguration.set("worlds", worlds);
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
logger.info("[P2] &aThe 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.");
logger.info("The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
} catch (final Exception e) {
logger.error("[P2] &cFailed to convert the legacy configuration file. See stack trace for information.", e);
logger.error("Failed to convert the legacy configuration file. See stack trace for information.", e);
}
// Disable plugin
this.platform.shutdown();
@ -1357,27 +1357,27 @@ public class PlotSquared {
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
}
} catch (IOException ignored) {
logger.error("[P2] Failed to save worlds.yml");
logger.error("Failed to save worlds.yml");
}
try {
this.configFile = new File(folder, "settings.yml");
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
logger.error("[P2] Could not create the settings file. Please create 'settings.yml' manually");
logger.error("Could not create the settings file. Please create 'settings.yml' manually");
}
this.config = YamlConfiguration.loadConfiguration(this.configFile);
setupConfig();
} catch (IOException ignored) {
logger.error("[P2] Failed to save settings.yml");
logger.error("Failed to save settings.yml");
}
try {
this.storageFile = new File(folder, "storage.yml");
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
logger.error("[P2] Could not create the storage settings file. Please create 'storage.yml' manually");
logger.error("Could not create the storage settings file. Please create 'storage.yml' manually");
}
YamlConfiguration.loadConfiguration(this.storageFile);
setupStorage();
} catch (IOException ignored) {
logger.error("[P2] Failed to save storage.yml");
logger.error("Failed to save storage.yml");
}
return true;
}
@ -1408,7 +1408,7 @@ public class PlotSquared {
if (Settings.DEBUG) {
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
for (Entry<String, Object> component : components.entrySet()) {
logger.info("[P2] Key: {} | Value: {}", component.getKey(), component.getValue());
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
}
}
}

View File

@ -175,7 +175,7 @@ public class Claim extends SubCommand {
try {
TaskManager.getPlatformImplementation().sync(() -> {
if (!plot.claim(player, true, finalSchematic, false)) {
logger.info("[P2] Failed to claim plot {}", plot.getId().toCommaSeparatedString());
logger.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
plot.setOwnerAbs(null);
} else if (area.isAutoMerge()) {
@ -196,7 +196,7 @@ public class Claim extends SubCommand {
e.printStackTrace();
}
}, () -> {
logger.info("[P2] Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
logger.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
plot.setOwnerAbs(null);
});

View File

@ -110,10 +110,10 @@ public class Debug extends SubCommand {
return true;
}
if (args.length > 0 && "logging".equalsIgnoreCase(args[0])) {
logger.info("[P2] Info!");
logger.warn("[P2] Warning!");
logger.error("[P2] Error!", new RuntimeException());
logger.debug("[P2] Debug!");
logger.info("Info!");
logger.warn("Warning!");
logger.error("Error!", new RuntimeException());
logger.debug("Debug!");
return true;
}
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {

View File

@ -459,12 +459,12 @@ public class DebugExec extends SubCommand {
} catch (ScriptException e) {
e.printStackTrace();
}
logger.info("[P2] {}ms -> {}", System.currentTimeMillis() - start, result);
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
});
} else {
long start = System.currentTimeMillis();
Object result = this.engine.eval(script, this.scope);
logger.info("[P2] {}ms -> {}", System.currentTimeMillis() - start, result);
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
}
return true;
} catch (ScriptException e) {

View File

@ -201,7 +201,7 @@ public class Purge extends SubCommand {
boolean finalClear = clear;
Runnable run = () -> {
if (Settings.DEBUG) {
logger.info("[P2] Calculating plots to purge, please wait...");
logger.info("Calculating plots to purge, please wait...");
}
HashSet<Integer> ids = new HashSet<>();
Iterator<Plot> iterator = toDelete.iterator();
@ -217,7 +217,7 @@ public class Purge extends SubCommand {
if (finalClear) {
plot.clear(false, true, () -> {
if (Settings.DEBUG) {
logger.info("[P2] Plot {} cleared by purge", plot.getId());
logger.info("Plot {} cleared by purge", plot.getId());
}
});
} else {
@ -228,7 +228,7 @@ public class Purge extends SubCommand {
Purge.this.plotListener.plotEntry(pp, plot);
}
} catch (NullPointerException e) {
logger.error("[P2] NullPointer during purge detected. This is likely"
logger.error("NullPointer during purge detected. This is likely"
+ " because you are deleting a world that has been removed", e);
}
}

View File

@ -145,15 +145,15 @@ public class Trim extends SubCommand {
@Override public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
Runnable regenTask;
if (regen) {
logger.info("[P2] Starting regen task");
logger.info("[P2] - This is a VERY slow command");
logger.info("[P2] - It will say 'Trim done!' when complete");
logger.info("Starting regen task");
logger.info(" - This is a VERY slow command");
logger.info(" - It will say 'Trim done!' when complete");
regenTask = new Runnable() {
@Override public void run() {
if (nonViable.isEmpty()) {
Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!");
logger.info("Trim done!");
return;
}
Iterator<BlockVector2> iterator = nonViable.iterator();
@ -203,7 +203,7 @@ public class Trim extends SubCommand {
regenTask = () -> {
Trim.TASK = false;
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
logger.info("[P2] Trim done!");
logger.info("Trim done!");
};
}
regionManager.deleteRegionFiles(world, viable, regenTask);

View File

@ -83,7 +83,7 @@ public class ComponentPresetManager {
e.printStackTrace();
}
if (!created) {
logger.error("[P2] Failed to create components.yml");
logger.error("Failed to create components.yml");
this.guiName = "&cInvalid!";
this.presets = new ArrayList<>();
return;
@ -99,7 +99,7 @@ public class ComponentPresetManager {
try {
yamlConfiguration.save(file);
} catch (IOException e) {
logger.error("[P2] 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");
@ -115,7 +115,7 @@ public class ComponentPresetManager {
try {
yamlConfiguration.save(file);
} catch (final IOException e) {
logger.error("[P2] Failed to save default values to components.yml", e);
logger.error("Failed to save default values to components.yml", e);
}
this.presets = defaultPreset;
}

View File

@ -98,12 +98,12 @@ public class Config {
field.set(instance, value);
return;
} catch (final Throwable e) {
logger.error("[P2] Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
logger.error("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
e.printStackTrace();
}
}
}
logger.error("[P2] 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) {
@ -289,7 +289,7 @@ public class Config {
setAccessible(field);
return field;
} catch (final Throwable e) {
logger.error("[P2] Invalid config field: {} for {}",
logger.error("Invalid config field: {} for {}",
StringMan.join(split, "."), toNodeName(instance.getClass().getSimpleName()));
e.printStackTrace();
return null;

View File

@ -82,11 +82,11 @@ public class YamlConfiguration extends FileConfiguration {
}
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
if (Settings.DEBUG) {
logger.error("[P2] Could not read: {}", file);
logger.error("[P2] Renamed to: {}", file);
logger.error("[P2] ============ Full stacktrace ============");
logger.error("Could not read: {}", file);
logger.error("Renamed to: {}", file);
logger.error("============ Full stacktrace ============");
ex.printStackTrace();
logger.error("[P2] =========================================");
logger.error("=========================================");
}
} catch (IOException e) {
e.printStackTrace();

View File

@ -373,12 +373,12 @@ public class SQLManager implements AbstractDB {
try {
task.run();
} catch (Throwable e) {
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] There was an error updating the database.");
logger.error("[P2] - It will be corrected on shutdown");
logger.error("============ DATABASE ERROR ============");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
e.printStackTrace();
logger.error("[P2] ========================================");
logger.error("========================================");
}
}
commit();
@ -428,12 +428,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] There was an error updating the database.");
logger.error("[P2] - It will be corrected on shutdown");
logger.error("[P2] ========================================");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
e.printStackTrace();
logger.error("[P2] ========================================");
logger.error("========================================");
}
}
if (statement != null && task != null) {
@ -473,12 +473,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] There was an error updating the database.");
logger.error("[P2] - It will be corrected on shutdown");
logger.error("[P2] ========================================");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
e.printStackTrace();
logger.error("[P2] ========================================");
logger.error("========================================");
}
}
if (statement != null && task != null) {
@ -519,12 +519,12 @@ public class SQLManager implements AbstractDB {
}
lastTask = task;
} catch (Throwable e) {
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] There was an error updating the database.");
logger.error("[P2] - It will be corrected on shutdown");
logger.error("[P2] ========================================");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
e.printStackTrace();
logger.error("[P2] ========================================");
logger.error("========================================");
}
}
if (statement != null && task != null) {
@ -548,12 +548,12 @@ public class SQLManager implements AbstractDB {
this.plotTasks.clear();
}
} catch (Throwable e) {
logger.error("[P2] ============ DATABASE ERROR ============");
logger.error("[P2] There was an error updating the database.");
logger.error("[P2] - It will be corrected on shutdown");
logger.error("[P2] ========================================");
logger.error("============ DATABASE ERROR ============");
logger.error("There was an error updating the database.");
logger.error(" - It will be corrected on shutdown");
logger.error("========================================");
e.printStackTrace();
logger.error("[P2] ========================================");
logger.error("========================================");
}
return false;
}
@ -641,7 +641,7 @@ public class SQLManager implements AbstractDB {
}
})))));
} catch (SQLException e) {
logger.warn("[P2] Failed to set all flags and member tiers for plots", e);
logger.warn("Failed to set all flags and member tiers for plots", e);
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -650,7 +650,7 @@ public class SQLManager implements AbstractDB {
}
});
} catch (Exception e) {
logger.warn("[P2] Warning! Failed to set all helper for plots", e);
logger.warn("Warning! Failed to set all helper for plots", e);
try {
SQLManager.this.connection.commit();
} catch (SQLException e1) {
@ -719,19 +719,19 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("[P2] Failed to store flag values for plot with entry ID: {}", plot);
logger.error("Failed to store flag values for plot with entry ID: {}", plot);
e.printStackTrace();
continue;
}
if (Settings.DEBUG) {
logger.info("[P2] - Finished converting flag values for plot with entry ID: {}",
logger.info("- Finished converting flag values for plot with entry ID: {}",
plot.getId());
}
}
} catch (final Exception e) {
logger.error("[P2] Failed to store flag values", e);
logger.error("Failed to store flag values", e);
}
logger.info("[P2] Finished converting flags ({} plots processed)", plots.size());
logger.info("Finished converting flags ({} plots processed)", plots.size());
whenDone.run();
}
@ -848,7 +848,7 @@ public class SQLManager implements AbstractDB {
return;
} catch (SQLException e) {
if (this.mySQL) {
logger.error("[P2] 1: | {}", objList.get(0).getClass().getCanonicalName());
logger.error("1: | {}", objList.get(0).getClass().getCanonicalName());
e.printStackTrace();
}
}
@ -886,8 +886,8 @@ public class SQLManager implements AbstractDB {
preparedStmt.close();
} catch (SQLException e) {
e.printStackTrace();
logger.error("[P2] 2: | {}", objList.get(0).getClass().getCanonicalName());
logger.error("[P2] Could not bulk save!");
logger.error("2: | {}", objList.get(0).getClass().getCanonicalName());
logger.error("Could not bulk save!");
try (PreparedStatement preparedStmt = this.connection
.prepareStatement(mod.getCreateSQL())) {
for (T obj : objList) {
@ -896,7 +896,7 @@ public class SQLManager implements AbstractDB {
}
preparedStmt.executeBatch();
} catch (SQLException e3) {
logger.error("[P2] Failed to save all", e);
logger.error("Failed to save all", e);
e3.printStackTrace();
}
}
@ -948,7 +948,7 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("[P2] Failed to store settings for plot with entry ID: {}", legacySettings.id);
logger.error("Failed to store settings for plot with entry ID: {}", legacySettings.id);
e.printStackTrace();
continue;
}
@ -960,13 +960,13 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("[P2] Failed to store settings", e);
logger.error("Failed to store settings", e);
}
}
} catch (final Exception e) {
logger.error("[P2] Failed to store settings", e);
logger.error("Failed to store settings", e);
}
logger.info("[P2] Finished converting settihgs ({} plots processed)", myList.size());
logger.info("Finished converting settings ({} plots processed)", myList.size());
whenDone.run();
}
@ -1647,11 +1647,11 @@ public class SQLManager implements AbstractDB {
}
}
} catch (final Exception e) {
logger.error("[P2] Failed to load old flag values", e);
logger.error("Failed to load old flag values", e);
return false;
}
logger.info("[P2] Loaded {} plot flag collections...", flagMap.size());
logger.info("[P2] Attempting to store these flags in the new table...");
logger.info("Loaded {} plot flag collections...", flagMap.size());
logger.info("Attempting to store these flags in the new table...");
try (final PreparedStatement preparedStatement = this.connection.prepareStatement(
"INSERT INTO `" + SQLManager.this.prefix
+ "plot_flags`(`plot_id`, `flag`, `value`) VALUES(?, ?, ?)")) {
@ -1679,7 +1679,7 @@ public class SQLManager implements AbstractDB {
try {
preparedStatement.executeBatch();
} catch (final Exception e) {
logger.error("[P2] Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey());
logger.error("Failed to store flag values for plot with entry ID: {}", plotFlagEntry.getKey());
e.printStackTrace();
continue;
}
@ -1687,17 +1687,17 @@ public class SQLManager implements AbstractDB {
if (System.currentTimeMillis() - timeStarted >= 1000L || plotsProcessed >= flagMap
.size()) {
timeStarted = System.currentTimeMillis();
logger.info("[P2] ... Flag conversion in progress. {}% done",
logger.info("... Flag conversion in progress. {}% done",
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100));
}
if (Settings.DEBUG) {
logger.info("[P2] - Finished converting flags for plot with entry ID: {}",
logger.info("- Finished converting flags for plot with entry ID: {}",
plotFlagEntry.getKey());
}
}
} catch (final Exception e) {
logger.error("[P2] Failed to store flag values", e);
logger.error("Failed to store flag values", e);
return false;
}
return true;
@ -1788,7 +1788,7 @@ public class SQLManager implements AbstractDB {
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(parsable)
.getTime();
} catch (ParseException e) {
logger.error("[P2] Could not parse date for plot: #{}({};{}) ({})",
logger.error("Could not parse date for plot: #{}({};{}) ({})",
id, areaID, plot_id, parsable);
time = System.currentTimeMillis() + id;
}
@ -1803,7 +1803,7 @@ public class SQLManager implements AbstractDB {
if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(last.temp);
} else if (Settings.DEBUG) {
logger.info("[P2] Plot #{}({}) in `{}plot` is a duplicate."
logger.info("Plot #{}({}) in `{}plot` is a duplicate."
+ " Delete this plot or set `database-purger: true` in the settings.yml", id, last, this.prefix);
}
}
@ -1835,7 +1835,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -1863,7 +1863,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -1890,7 +1890,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -1917,7 +1917,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -1945,8 +1945,8 @@ public class SQLManager implements AbstractDB {
plot.getFlagContainer().addFlag(plotFlag.parse(value));
} catch (final FlagParseException e) {
e.printStackTrace();
logger.error("[P2] Plot with ID {} has an invalid value:", id);
logger.error("[P2] Failed to parse flag '{}', value '{}': {}",
logger.error("Plot with ID {} has an invalid value:", id);
logger.error("Failed to parse flag '{}', value '{}': {}",
plotFlag.getName(), e.getValue(), e.getErrorMessage());
if (!invalidFlags.containsKey(plot)) {
invalidFlags.put(plot, new ArrayList<>());
@ -1957,7 +1957,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -2013,7 +2013,7 @@ public class SQLManager implements AbstractDB {
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
toDelete.add(id);
} else if (Settings.DEBUG) {
logger.info("[P2] 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);
}
}
@ -2031,15 +2031,15 @@ public class SQLManager implements AbstractDB {
String worldName = entry.getKey();
invalidPlot = true;
if (Settings.DEBUG) {
logger.info("[P2] Warning! Found {} plots in DB for non existent world: '{}'",
logger.info("Warning! Found {} plots in DB for non existent world: '{}'",
entry.getValue().intValue(), worldName);
}
}
if (invalidPlot && Settings.DEBUG) {
logger.info("[P2] Warning! Please create the world(s) or remove the plots using the purge command");
logger.info("Warning! Please create the world(s) or remove the plots using the purge command");
}
} catch (SQLException e) {
logger.error("[P2] Failed to load plots", e);
logger.error("Failed to load plots", e);
}
return newPlots;
}
@ -2080,7 +2080,7 @@ public class SQLManager implements AbstractDB {
preparedStatement.setInt(3, id2);
preparedStatement.execute();
} catch (final Exception e) {
logger.error("[P2] Failed to persist wap of {} and {}", plot1, plot2);
logger.error("Failed to persist wap of {} and {}", plot1, plot2);
e.printStackTrace();
future.complete(false);
return;
@ -2223,12 +2223,12 @@ public class SQLManager implements AbstractDB {
commit();
}
} catch (SQLException e) {
logger.error("[P2] Failed to purge plots", e);
logger.error("Failed to purge plots", e);
return;
}
}
if (Settings.DEBUG) {
logger.info("[P2] Successfully purged {} plots", uniqueIds.size());
logger.info("Successfully purged {} plots", uniqueIds.size());
}
}
});
@ -2252,7 +2252,7 @@ public class SQLManager implements AbstractDB {
}
purgeIds(ids);
} catch (SQLException e) {
logger.error("[P2] Failed to purge area '{}'", area);
logger.error("Failed to purge area '{}'", area);
e.printStackTrace();
}
for (Iterator<PlotId> iterator = plots.iterator(); iterator.hasNext(); ) {
@ -2509,7 +2509,7 @@ public class SQLManager implements AbstractDB {
}
}
} catch (SQLException e) {
logger.error("[P2] Failed to fetch rating for plot {}", plot.getId().toString());
logger.error("Failed to fetch rating for plot {}", plot.getId().toString());
e.printStackTrace();
}
return map;
@ -2729,7 +2729,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.helpers.add(user);
} else if (Settings.DEBUG) {
logger.warn("[P2] 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);
}
}
@ -2748,7 +2748,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.invited.add(user);
} else if (Settings.DEBUG) {
logger.warn("[P2] 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);
}
}
@ -2783,7 +2783,7 @@ public class SQLManager implements AbstractDB {
}
cluster.settings.setMerged(merged);
} else if (Settings.DEBUG) {
logger.warn("[P2] 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);
}
}
@ -2793,13 +2793,13 @@ public class SQLManager implements AbstractDB {
for (Entry<String, Integer> entry : noExist.entrySet()) {
String a = entry.getKey();
invalidPlot = true;
logger.warn("[P2] Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
logger.warn("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
}
if (invalidPlot) {
logger.warn("[P2] Warning! Please create the world(s) or remove the clusters using the purge command");
logger.warn("Warning! Please create the world(s) or remove the clusters using the purge command");
}
} catch (SQLException e) {
logger.error("[P2] Failed to load clusters", e);
logger.error("Failed to load clusters", e);
}
return newClusters;
}
@ -2991,7 +2991,7 @@ public class SQLManager implements AbstractDB {
if (!isValid()) {
reconnect();
}
logger.info("[P2] All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
logger.info("All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
commit();
while (true) {
if (!sendBatch()) {
@ -3012,13 +3012,13 @@ public class SQLManager implements AbstractDB {
continue;
}
if (plot.getArea() == null) {
logger.error("[P2] CRITICAL ERROR IN VALIDATION TASK!");
logger.error("[P2] PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
logger.error("PLOT AREA CANNOT BE NULL! SKIPPING PLOT!");
continue;
}
if (database == null) {
logger.error("[P2] CRITICAL ERROR IN VALIDATION TASK!");
logger.error("[P2] DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
logger.error("CRITICAL ERROR IN VALIDATION TASK!");
logger.error("DATABASE VARIABLE CANNOT BE NULL! NOW ENDING VALIDATION!");
break;
}
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());

View File

@ -68,7 +68,7 @@ public class SQLite extends Database {
try {
file.createNewFile();
} catch (IOException ignored) {
logger.error("[P2] Unable to create database");
logger.error("Unable to create database");
}
}
Class.forName("org.sqlite.JDBC");

View File

@ -177,7 +177,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
// Dump world settings
if (Settings.DEBUG) {
logger.info("[P2] - Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
logger.info("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
final Field[] fields = this.getClass().getFields();
for (final Field field : fields) {
final String name = field.getName().toLowerCase(Locale.ENGLISH);
@ -193,7 +193,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} catch (final IllegalAccessException e) {
value = String.format("Failed to parse: %s", e.getMessage());
}
logger.info("[P2] -- {} = {}", name, value);
logger.info("-- {} = {}", name, value);
}
}
}
@ -294,12 +294,12 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
if (Settings.DEBUG) {
logger.info("[P2] - plot schematic: {}", schematic3File.getPath());
logger.info(" - plot schematic: {}", schematic3File.getPath());
}
}
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
if (Settings.DEBUG) {
logger.info("[P2] - schematic: false");
logger.info(" - schematic: false");
}
return;
}
@ -367,7 +367,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
int pair = MathMan.pair(x, z);
BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
if (y >= height) {
logger.error("[P2] Error adding overlay block. `y > height`");
logger.error("Error adding overlay block. `y > height`");
return;
}
existing[y] = id;

View File

@ -421,23 +421,23 @@ public class HybridUtils {
iter.remove();
boolean regenedRoad = regenerateRoad(area, chunk, extend);
if (!regenedRoad && Settings.DEBUG) {
logger.info("[P2] Failed to regenerate roads");
logger.info("Failed to regenerate roads");
}
}
if (Settings.DEBUG) {
logger.info("[P2] Cancelled road task");
logger.info("Cancelled road task");
}
return;
}
count.incrementAndGet();
if (count.intValue() % 20 == 0) {
logger.info("[P2] Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
logger.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
}
if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) {
regeneratePlotWalls(area);
HybridUtils.UPDATE = false;
logger.info("[P2] Finished road conversion");
logger.info("Finished road conversion");
// CANCEL TASK
} else {
final Runnable task = this;
@ -449,8 +449,8 @@ public class HybridUtils {
BlockVector2 loc = iterator.next();
iterator.remove();
if (Settings.DEBUG) {
logger.info("[P2] Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
logger.info("[P2] - Remaining: {}", HybridUtils.regions.size());
logger.info("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
logger.info("- Remaining: {}", HybridUtils.regions.size());
}
chunks.addAll(getChunks(loc));
System.gc();
@ -465,7 +465,7 @@ public class HybridUtils {
iterator.remove();
boolean regenedRoads = regenerateRoad(area, chunk, extend);
if (!regenedRoads && Settings.DEBUG) {
logger.info("[P2] Failed to regenerate road");
logger.info("Failed to regenerate road");
}
}
return null;
@ -476,7 +476,7 @@ public class HybridUtils {
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
BlockVector2 loc = iterator.next();
iterator.remove();
logger.error("[P2] Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", area.getWorldHash(), loc.getX(),
logger.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)", area.getWorldHash(), loc.getX(),
loc.getZ());
}
TaskManager.runTaskLater(task, TaskTime.seconds(1L));

View File

@ -61,7 +61,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override public void loadConfiguration(ConfigurationSection config) {
if (!config.contains("plot.height")) {
if (Settings.DEBUG) {
logger.info("[P2] - Configuration is null? ({})", config.getCurrentPath());
logger.info(" - Configuration is null? ({})", config.getCurrentPath());
}
}

View File

@ -590,7 +590,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
for (Plot owned : getPlots()) {
owned.deletePlot(null);
if (Settings.DEBUG) {
logger.info("[P2] Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
logger.info("Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
}
}
}

View File

@ -327,7 +327,7 @@ public class Plot {
if (arg == null) {
if (player == null) {
if (message) {
logger.info("[P2] No plot area string was supplied");
logger.info("No plot area string was supplied");
}
return null;
}
@ -1093,7 +1093,7 @@ public class Plot {
try {
regionManager.regenerateRegion(current.getBottomAbs(), current.getTopAbs(), false, this);
} catch (UnsupportedOperationException exception) {
logger.info("[P2] Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience.");
logger.info("Please ask md_5 to fix regenerateChunk() because it breaks plugins. We apologize for the inconvenience.");
return;
}
return;
@ -1859,7 +1859,7 @@ public class Plot {
if (updateDB) {
if (!create(player.getUUID(), true)) {
logger.error("[P2] Player {} attempted to claim plot {}, but the database failed to update", player.getName(),
logger.error("Player {} attempted to claim plot {}, but the database failed to update", player.getName(),
this.getId().toCommaSeparatedString());
return false;
}
@ -1952,7 +1952,7 @@ public class Plot {
});
return true;
}
logger.info("[P2] Failed to add plot {} to plot area {}", this.getId().toCommaSeparatedString(), this.area.toString());
logger.info("Failed to add plot {} to plot area {}", this.getId().toCommaSeparatedString(), this.area.toString());
return false;
}

View File

@ -1145,7 +1145,7 @@ public abstract class PlotArea {
try {
flags.add(flagInstance.parse(split[1]));
} catch (final FlagParseException e) {
logger.warn("[P2] Failed to parse default flag with key '{}' and value '{}'. "
logger.warn("Failed to parse default flag with key '{}' and value '{}'. "
+ "Reason: {}. This flag will not be added as a default flag.",
e.getFlag().getName(),
e.getValue(),

View File

@ -98,7 +98,7 @@ public class PlotAnalysis {
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) {
if (Settings.DEBUG) {
logger.info("[P2] Calibration task already in progress!");
logger.info("Calibration task already in progress!");
}
return;
}
@ -115,7 +115,7 @@ public class PlotAnalysis {
@Override public void run() {
Iterator<Plot> iterator = plots.iterator();
if (Settings.DEBUG) {
logger.info("[P2] - Reducing {} plots to those with sufficient data", plots.size());
logger.info("- Reducing {} plots to those with sufficient data", plots.size());
}
while (iterator.hasNext()) {
Plot plot = iterator.next();
@ -140,7 +140,7 @@ public class PlotAnalysis {
}
if (Settings.DEBUG) {
logger.info("[P2] - Analyzing plot contents (this may take a while)");
logger.info("- Analyzing plot contents (this may take a while)");
}
int[] changes = new int[plots.size()];
@ -168,7 +168,7 @@ public class PlotAnalysis {
(plot.getAverageRating() + plot.getSettings().getRatings().size())
* 100);
if (Settings.DEBUG) {
logger.info("[P2] | {} (rating) {}", plot, ratings[i]);
logger.info(" | {} (rating) {}", plot, ratings[i]);
}
}
}
@ -182,7 +182,7 @@ public class PlotAnalysis {
break;
}
if (Settings.DEBUG) {
logger.info("[P2] | {}", queuePlot);
logger.info(" | {}", queuePlot);
}
final Object lock = new Object();
TaskManager.runTask(new Runnable() {
@ -214,7 +214,7 @@ public class PlotAnalysis {
}
if (Settings.DEBUG) {
logger.info("[P2] - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
logger.info(" - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
}
try {
@ -230,7 +230,7 @@ public class PlotAnalysis {
for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i);
if (Settings.DEBUG) {
logger.info("[P2] | {}", plot);
logger.info(" | {}", plot);
}
PlotAnalysis analysis = plot.getComplexity(null);
@ -248,7 +248,7 @@ public class PlotAnalysis {
}
if (Settings.DEBUG) {
logger.info("[P2] - Calculating rankings");
logger.info(" - Calculating rankings");
}
int[] rankRatings = rank(ratings);
@ -257,7 +257,7 @@ public class PlotAnalysis {
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
if (Settings.DEBUG) {
logger.info("[P2] - 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(
@ -276,7 +276,7 @@ public class PlotAnalysis {
(int) (factorChanges * 1000 / MathMan.getMean(changes));
if (Settings.DEBUG) {
logger.info("[P2] - | changes {}", factorChanges);
logger.info(" - | changes {}", factorChanges);
}
int[] rankFaces = rank(faces);
@ -288,7 +288,7 @@ public class PlotAnalysis {
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
if (Settings.DEBUG) {
logger.info("[P2] - | faces {}", factorFaces);
logger.info(" - | faces {}", factorFaces);
}
int[] rankData = rank(data);
@ -300,7 +300,7 @@ public class PlotAnalysis {
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
if (Settings.DEBUG) {
logger.info("[P2] - | data {}", factor_data);
logger.info(" - | data {}", factor_data);
}
int[] rank_air = rank(air);
@ -312,7 +312,7 @@ public class PlotAnalysis {
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
if (Settings.DEBUG) {
logger.info("[P2] - | air {}", factor_air);
logger.info("- | air {}", factor_air);
}
int[] rank_variety = rank(variety);
@ -325,7 +325,7 @@ public class PlotAnalysis {
(int) (factor_variety * 1000 / MathMan.getMean(variety));
if (Settings.DEBUG) {
logger.info("[P2] - | variety {}", factor_variety);
logger.info("- | variety {}", factor_variety);
}
int[] rank_changes_sd = rank(changes_sd);
@ -338,7 +338,7 @@ public class PlotAnalysis {
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
if (Settings.DEBUG) {
logger.info("[P2] - | changed_sd {}", factor_changes_sd);
logger.info(" - | changed_sd {}", factor_changes_sd);
}
int[] rank_faces_sd = rank(faces_sd);
@ -351,7 +351,7 @@ public class PlotAnalysis {
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
if (Settings.DEBUG) {
logger.info("[P2] - | faced_sd {}", factor_faces_sd);
logger.info(" - | faced_sd {}", factor_faces_sd);
}
int[] rank_data_sd = rank(data_sd);
@ -364,7 +364,7 @@ public class PlotAnalysis {
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
if (Settings.DEBUG) {
logger.info("[P2] - | data_sd {}", factor_data_sd);
logger.info(" - | data_sd {}", factor_data_sd);
}
int[] rank_air_sd = rank(air_sd);
@ -376,7 +376,7 @@ public class PlotAnalysis {
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
if (Settings.DEBUG) {
logger.info("[P2] - | air_sd {}", factor_air_sd);
logger.info(" - | air_sd {}", factor_air_sd);
}
int[] rank_variety_sd = rank(variety_sd);
@ -389,13 +389,13 @@ public class PlotAnalysis {
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
if (Settings.DEBUG) {
logger.info("[P2] - | variety_sd {}", factor_variety_sd);
logger.info(" - | variety_sd {}", factor_variety_sd);
}
int[] complexity = new int[n];
if (Settings.DEBUG) {
logger.info("[P2] Calculating threshold");
logger.info(" Calculating threshold");
}
int max = 0;
@ -427,7 +427,7 @@ public class PlotAnalysis {
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
if (optimalComplexity == Integer.MAX_VALUE) {
if (Settings.DEBUG) {
logger.info("[P2] Insufficient data to determine correlation! {} | {}",
logger.info("Insufficient data to determine correlation! {} | {}",
optimalIndex, n);
}
running = false;
@ -448,7 +448,7 @@ public class PlotAnalysis {
// Save calibration
if (Settings.DEBUG) {
logger.info("[P2] Saving calibration");
logger.info(" Saving calibration");
}
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
Settings.save(PlotSquared.get().getWorldsFile());
@ -457,7 +457,7 @@ public class PlotAnalysis {
plot.removeRunning();
}
if (Settings.DEBUG) {
logger.info("[P2] Done!");
logger.info(" Done!");
}
whenDone.run();
}
@ -466,7 +466,7 @@ public class PlotAnalysis {
public static void logln(Object obj) {
if (Settings.DEBUG) {
logger.info("[P2] " + log(obj));
logger.info("" + log(obj));
}
}

View File

@ -149,7 +149,7 @@ public class FlagContainer {
this.updateSubscribers
.forEach(subscriber -> subscriber.handle(flag, plotFlagUpdateType));
} catch (IllegalStateException e) {
logger.info("[P2] Flag {} (class '{}') could not be added to the container because the "
logger.info("Flag {} (class '{}') could not be added to the container because the "
+ "flag name exceeded the allowed limit of 64 characters. Please tell the developer "
+ "of the flag to fix this.", flag.getName(), flag.getClass().getName());
e.printStackTrace();

View File

@ -133,7 +133,7 @@ public class BlockTypeWrapper {
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
if (Settings.DEBUG) {
logger.info("[P2] - Block category #{} does not exist", this.blockCategoryId);
logger.info("- Block category #{} does not exist", this.blockCategoryId);
}
this.blockCategory = new NullBlockCategory(this.blockCategoryId);
}

View File

@ -72,7 +72,7 @@ public abstract class Expression<T> {
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
} catch (ScriptException e) {
if (Settings.DEBUG) {
logger.info("[P2] Invalid expression: {}", expression);
logger.info("Invalid expression: {}", expression);
}
e.printStackTrace();
}

View File

@ -89,7 +89,7 @@ public abstract class RegionManager {
for (BlockVector2 loc : chunks) {
String directory = world + File.separator + "region" + File.separator + "r." + loc.getX() + "." + loc.getZ() + ".mca";
File file = new File(PlotSquared.platform().getWorldContainer(), directory);
logger.info("[P2] - Deleting file: {} (max 1024 chunks)", file.getName());
logger.info("- Deleting file: {} (max 1024 chunks)", file.getName());
if (file.exists()) {
file.delete();
}

View File

@ -236,7 +236,7 @@ public abstract class SchematicHandler {
TaskManager.runTaskAsync(() -> {
boolean result = save(value, directory + File.separator + name + ".schem");
if (!result) {
logger.error("[P2] Failed to save {}", plot.getId());
logger.error("Failed to save {}", plot.getId());
}
TaskManager.runTask(THIS);
});

View File

@ -161,7 +161,7 @@ public final class IncendoPaster {
if (!httpURLConnection.getResponseMessage().contains("OK")) {
if (httpURLConnection.getResponseCode() == 413) {
final long size = content.length;
logger.error("[P2] Paste too big > size: {}MB", size / 1_000_000);
logger.error("Paste too big > size: {}MB", size / 1_000_000);
}
throw new IllegalStateException(String
.format("Server returned status: %d %s", httpURLConnection.getResponseCode(),

View File

@ -173,7 +173,7 @@ public class UUIDPipeline {
} catch (TimeoutException ignored) {
// This is completely valid, we just don't care anymore
if (Settings.DEBUG) {
logger.warn("[P2] (UUID) Request for {} timed out", username);
logger.warn("(UUID) Request for {} timed out", username);
}
}
return null;
@ -198,7 +198,7 @@ public class UUIDPipeline {
} catch (TimeoutException ignored) {
// This is completely valid, we just don't care anymore
if (Settings.DEBUG) {
logger.warn("[P2] (UUID) Request for {} timed out", uuid);
logger.warn("(UUID) Request for {} timed out", uuid);
}
}
return null;
@ -328,7 +328,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
logger.info("[P2] (UUID) Failed to find all usernames");
logger.info("(UUID) Failed to find all usernames");
}
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
@ -391,7 +391,7 @@ public class UUIDPipeline {
this.consume(mappings);
return mappings;
} else if (Settings.DEBUG) {
logger.info("[P2] (UUID) Failed to find all UUIDs");
logger.info("(UUID) Failed to find all UUIDs");
}
throw new ServiceError("End of pipeline");