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) {