Attempts to make SonarCloud happier
This commit is contained in:
		@@ -74,7 +74,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||||||
@SuppressWarnings("unused")
 | 
					@SuppressWarnings("unused")
 | 
				
			||||||
public class Stargate extends JavaPlugin {
 | 
					public class Stargate extends JavaPlugin {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final String configFileName = "config.yml";
 | 
					    private static final String CONFIG_FILE_NAME = "config.yml";
 | 
				
			||||||
    private static final Queue<BlockChangeRequest> blockChangeRequestQueue = new LinkedList<>();
 | 
					    private static final Queue<BlockChangeRequest> blockChangeRequestQueue = new LinkedList<>();
 | 
				
			||||||
    private static final Queue<ChunkUnloadRequest> chunkUnloadQueue = new PriorityQueue<>();
 | 
					    private static final Queue<ChunkUnloadRequest> chunkUnloadQueue = new PriorityQueue<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -353,7 +353,7 @@ public class Stargate extends JavaPlugin {
 | 
				
			|||||||
        super.reloadConfig();
 | 
					        super.reloadConfig();
 | 
				
			||||||
        this.configuration = new StargateYamlConfiguration();
 | 
					        this.configuration = new StargateYamlConfiguration();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            this.configuration.load(new File(getDataFolder(), configFileName));
 | 
					            this.configuration.load(new File(getDataFolder(), CONFIG_FILE_NAME));
 | 
				
			||||||
        } catch (IOException | InvalidConfigurationException e) {
 | 
					        } catch (IOException | InvalidConfigurationException e) {
 | 
				
			||||||
            logSevere("Unable to load the configuration! Message: " + e.getMessage());
 | 
					            logSevere("Unable to load the configuration! Message: " + e.getMessage());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -363,7 +363,7 @@ public class Stargate extends JavaPlugin {
 | 
				
			|||||||
    public void saveConfig() {
 | 
					    public void saveConfig() {
 | 
				
			||||||
        super.saveConfig();
 | 
					        super.saveConfig();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            this.configuration.save(new File(getDataFolder(), configFileName));
 | 
					            this.configuration.save(new File(getDataFolder(), CONFIG_FILE_NAME));
 | 
				
			||||||
        } catch (IOException e) {
 | 
					        } catch (IOException e) {
 | 
				
			||||||
            logSevere("Unable to save the configuration! Message: " + e.getMessage());
 | 
					            logSevere("Unable to save the configuration! Message: " + e.getMessage());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -381,15 +381,15 @@ public class Stargate extends JavaPlugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onEnable() {
 | 
					    public void onEnable() {
 | 
				
			||||||
        stargate = this;
 | 
					        Stargate.stargate = this;
 | 
				
			||||||
        logger = getLogger();
 | 
					        Stargate.logger = getLogger();
 | 
				
			||||||
        this.saveDefaultConfig();
 | 
					        this.saveDefaultConfig();
 | 
				
			||||||
        this.getConfig();
 | 
					        this.getConfig();
 | 
				
			||||||
        PluginDescriptionFile pluginDescriptionFile = this.getDescription();
 | 
					        PluginDescriptionFile pluginDescriptionFile = this.getDescription();
 | 
				
			||||||
        pluginManager = getServer().getPluginManager();
 | 
					        pluginManager = getServer().getPluginManager();
 | 
				
			||||||
        this.configuration = new StargateYamlConfiguration();
 | 
					        this.configuration = new StargateYamlConfiguration();
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            this.configuration.load(new File(getDataFolder(), configFileName));
 | 
					            this.configuration.load(new File(getDataFolder(), CONFIG_FILE_NAME));
 | 
				
			||||||
        } catch (IOException | InvalidConfigurationException e) {
 | 
					        } catch (IOException | InvalidConfigurationException e) {
 | 
				
			||||||
            getLogger().log(Level.SEVERE, e.getMessage());
 | 
					            getLogger().log(Level.SEVERE, e.getMessage());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -549,12 +549,10 @@ public final class StargateConfig {
 | 
				
			|||||||
        createMissingFolder(new File(portalFolder), "Unable to create portal directory");
 | 
					        createMissingFolder(new File(portalFolder), "Unable to create portal directory");
 | 
				
			||||||
        File newFile = new File(portalFolder, Stargate.getInstance().getServer().getWorlds().get(0).getName() +
 | 
					        File newFile = new File(portalFolder, Stargate.getInstance().getServer().getWorlds().get(0).getName() +
 | 
				
			||||||
                ".db");
 | 
					                ".db");
 | 
				
			||||||
        if (!newFile.exists() && !newFile.getParentFile().exists()) {
 | 
					        if (!newFile.exists() && !newFile.getParentFile().exists() && !newFile.getParentFile().mkdirs()) {
 | 
				
			||||||
            if (!newFile.getParentFile().mkdirs()) {
 | 
					 | 
				
			||||||
            logger.severe("Unable to create portal database folder: " + newFile.getParentFile().getPath());
 | 
					            logger.severe("Unable to create portal database folder: " + newFile.getParentFile().getPath());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates the given folder if it's missing
 | 
					     * Creates the given folder if it's missing
 | 
				
			||||||
@@ -563,12 +561,10 @@ public final class StargateConfig {
 | 
				
			|||||||
     * @param errorMessage <p>The error message to display if unable to create the folder</p>
 | 
					     * @param errorMessage <p>The error message to display if unable to create the folder</p>
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void createMissingFolder(File folder, String errorMessage) {
 | 
					    private void createMissingFolder(File folder, String errorMessage) {
 | 
				
			||||||
        if (!folder.exists()) {
 | 
					        if (!folder.exists() && !folder.mkdirs()) {
 | 
				
			||||||
            if (!folder.mkdirs()) {
 | 
					 | 
				
			||||||
            logger.severe(errorMessage);
 | 
					            logger.severe(errorMessage);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets the folder all portals are stored in
 | 
					     * Gets the folder all portals are stored in
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,11 @@ import java.util.ArrayList;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * A YAML configuration which keeps all comments
 | 
					 * A YAML configuration which retains all comments
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * <p>This configuration converts all comments to YAML values when loaded, which all start with comment_. When saved,
 | 
				
			||||||
 | 
					 * those YAML values are converted to normal text comments. This ensures that the comments aren't removed by the
 | 
				
			||||||
 | 
					 * YamlConfiguration during its parsing.</p>
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author Thorin
 | 
					 * @author Thorin
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user