diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index a26874ca3..1027ea88d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -59,8 +59,8 @@ import com.plotsquared.bukkit.uuid.SquirrelIdUUIDService; import com.plotsquared.core.PlotPlatform; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.backup.BackupManager; -import com.plotsquared.core.backup.NullBackupManager; -import com.plotsquared.core.backup.SimpleBackupManager; +import com.plotsquared.core.command.WE_Anywhere; +import com.plotsquared.core.components.ComponentPresetManager; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ChatFormatter; import com.plotsquared.core.configuration.ConfigurationNode; @@ -79,7 +79,6 @@ import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.inject.modules.PlotSquaredModule; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.listener.WESubscriber; -import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; @@ -95,7 +94,6 @@ import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.setup.PlotAreaBuilder; import com.plotsquared.core.setup.SettingsNodesWrapper; import com.plotsquared.core.util.ChatManager; -import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ConsoleColors; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EventDispatcher; @@ -113,7 +111,6 @@ import com.plotsquared.core.uuid.offline.OfflineModeUUIDService; import com.sk89q.worldedit.WorldEdit; import io.papermc.lib.PaperLib; import lombok.Getter; - import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -131,11 +128,11 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.File; import java.lang.reflect.Method; import java.util.AbstractMap; @@ -161,7 +158,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; @SuppressWarnings("unused") public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform { - private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitMain.class.getSimpleName()); + private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName()); private static final int BSTATS_ID = 1404; static { @@ -290,15 +287,13 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; // WorldEdit if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) { try { - PlotSquared.log(Captions.PREFIX.getTranslated() + "&6" + this.getPluginName() - + " hooked into WorldEdit."); + logger.info("[P2] {} 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) { - PlotSquared.debug( - "Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); + logger.error("[P2] Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); } } @@ -344,8 +339,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; try { getInjector().getInstance(ComponentPresetManager.class); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX + "Failed to initialize the preset system"); - e.printStackTrace(); + logger.error("[P2] Failed to initialize the preset system", e); } } @@ -368,14 +362,11 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass; continue; } if (!worldUtil.isWorld(world) && !world.equals("*")) { - PlotSquared.debug("`" + world + "` was not properly loaded - " + this.getPluginName() - + " will now try to load it properly: "); - PlotSquared.debug( - " - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml"); - PlotSquared.debug( - " - Your world management plugin may be faulty (or non existent)"); - PlotSquared.debug( - " This message may also be a false positive and could be ignored."); + logger.warn("[P2] `{}` 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."); this.setGenerator(world); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BackupModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BackupModule.java index 604ec1de1..d97cf5d05 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BackupModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BackupModule.java @@ -27,26 +27,27 @@ package com.plotsquared.bukkit.inject; import com.google.inject.AbstractModule; import com.google.inject.assistedinject.FactoryModuleBuilder; -import com.plotsquared.core.PlotSquared; import com.plotsquared.core.backup.BackupManager; import com.plotsquared.core.backup.BackupProfile; import com.plotsquared.core.backup.NullBackupManager; import com.plotsquared.core.backup.PlayerBackupProfile; import com.plotsquared.core.backup.SimpleBackupManager; -import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BackupModule extends AbstractModule { + private static final Logger logger = LoggerFactory.getLogger("P2/" + BackupModule.class.getSimpleName()); + @Override protected void configure() { try { install(new FactoryModuleBuilder() .implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class)); bind(BackupManager.class).to(SimpleBackupManager.class); } catch (final Exception e) { - PlotSquared.log(Captions.PREFIX + "&6Failed to initialize backup manager"); - e.printStackTrace(); - PlotSquared.log(Captions.PREFIX + "&6Backup features will be disabled"); + logger.error("[P2] Failed to initialize backup manager", e); + logger.error("[P2] Backup features will be disabled"); bind(BackupManager.class).to(NullBackupManager.class); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java index 4261528ad..55dc45512 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java @@ -29,7 +29,6 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.core.PlotSquared; -import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.core.generator.AugmentedUtils; import com.plotsquared.core.location.Location; import com.plotsquared.core.location.PlotLoc; @@ -58,10 +57,10 @@ import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import javax.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nonnull; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.HashSet; diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 8ad87780c..9a3220f79 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -25,9 +25,6 @@ */ package com.plotsquared.core; -import com.plotsquared.core.configuration.Caption; -import com.plotsquared.core.command.WE_Anywhere; -import com.plotsquared.core.components.ComponentPresetManager; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.configuration.ConfigurationUtil; @@ -48,7 +45,6 @@ import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.inject.factory.HybridPlotWorldFactory; import com.plotsquared.core.listener.PlotListener; import com.plotsquared.core.location.Location; -import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.BlockBucket; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; @@ -67,20 +63,12 @@ import com.plotsquared.core.util.LegacyConverter; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.ReflectionUtils; -import com.plotsquared.core.util.StringMan; -import com.plotsquared.core.util.logger.ILogger; -import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDPipeline; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.math.BlockVector2; import lombok.Getter; -import lombok.Setter; -import javax.annotation.Nullable; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -267,7 +255,6 @@ public class PlotSquared { } public void startExpiryTasks() { - private void startExpiryTasks() { if (Settings.Enabled_Components.PLOT_EXPIRY) { ExpireManager.IMP = new ExpireManager(this.eventDispatcher); ExpireManager.IMP.runAutomatedTask(); @@ -811,9 +798,9 @@ public class PlotSquared { logger.info("[P2] - generator: {}>{}", baseGenerator, plotGenerator); logger.info("[P2] - plot world: {}", plotArea.getClass().getCanonicalName()); logger.info("[P2] - plot area manager: {}", plotManager.getClass().getCanonicalName()); - if (!this.worlds.contains(path)) { - this.worlds.createSection(path); - worldSection = this.worlds.getConfigurationSection(path); + if (!this.worldConfiguration.contains(path)) { + this.worldConfiguration.createSection(path); + worldSection = this.worldConfiguration.getConfigurationSection(path); } plotArea.saveConfiguration(worldSection); plotArea.loadDefaultConfiguration(worldSection); @@ -1264,8 +1251,8 @@ public class PlotSquared { e.printStackTrace(); logger.error("[P2] &d==== End of stacktrace ===="); logger.error("[P2] &6Please go to the {} 'storage.yml' and configure the database correctly", - imp().getPluginName()); - this.IMP.shutdown(); //shutdown used instead of disable because of database error + platform.getPluginName()); + this.platform.shutdown(); //shutdown used instead of disable because of database error } } @@ -1399,11 +1386,6 @@ public class PlotSquared { } catch (IOException ignored) { logger.error("[P2] Failed to save storage.yml"); } - try { - this.style.save(this.styleFile); - } catch (IOException e) { - logger.error("[P2] Configuration file saving failed", e); - } return true; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Trim.java b/Core/src/main/java/com/plotsquared/core/command/Trim.java index 46dd15e11..abdfb0a23 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Trim.java +++ b/Core/src/main/java/com/plotsquared/core/command/Trim.java @@ -63,7 +63,6 @@ import java.util.Set; public class Trim extends SubCommand { private static final Logger logger = LoggerFactory.getLogger("P2/" + Trim.class.getSimpleName()); - public static ArrayList expired = null; private static volatile boolean TASK = false; private final PlotAreaManager plotAreaManager; diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java index 016ec4af8..b93d912c1 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java @@ -29,8 +29,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import lombok.EqualsAndHashCode; import lombok.Setter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; diff --git a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java index e5d431935..d9d1e570c 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java +++ b/Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java @@ -42,7 +42,8 @@ public class PlotMessage { try { reset(ChatManager.manager); } catch (Throwable e) { - logger.error("[P2] {} doesn't support fancy chat for {}", PlotSquared.imp().getPluginName(), PlotSquared.get().IMP.getServerVersion()); + logger.error("[P2] {} doesn't support fancy chat for {}", PlotSquared.platform().getPluginName(), + PlotSquared.platform().getServerVersion()); ChatManager.manager = new PlainChatManager(); reset(ChatManager.manager); } diff --git a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java index d940d49fe..d260b74bc 100644 --- a/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java +++ b/Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java @@ -25,16 +25,17 @@ */ package com.plotsquared.core.util; +import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.ConfigurationSection; import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.plot.BlockBucket; import com.sk89q.worldedit.world.block.BlockState; -import javax.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.HashMap; import java.util.List;