From f636db49f7f5efe594d81ef27110e257f1272cc4 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Thu, 6 Aug 2020 17:33:23 +0200 Subject: [PATCH] Remove SetupObject --- .../bukkit/util/BukkitSetupUtils.java | 106 ------------------ .../generator/IndependentPlotGenerator.java | 3 +- .../plotsquared/core/plot/SetupObject.java | 96 ---------------- .../com/plotsquared/core/util/SetupUtils.java | 4 - 4 files changed, 1 insertion(+), 208 deletions(-) delete mode 100644 Core/src/main/java/com/plotsquared/core/plot/SetupObject.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java index 4c4262b8d..c403b0e36 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -37,7 +37,6 @@ import com.plotsquared.core.inject.annotations.WorldConfig; import com.plotsquared.core.inject.annotations.WorldFile; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotAreaType; -import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.plot.world.PlotAreaManager; import com.plotsquared.core.setup.PlotAreaBuilder; import com.plotsquared.core.util.SetupUtils; @@ -118,111 +117,6 @@ import java.util.Objects; Bukkit.unloadWorld(world, false); } - @Deprecated @Override public String setupWorld(SetupObject object) { - this.updateGenerators(); - ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step; - String world = object.world; - PlotAreaType type = object.type; - String worldPath = "worlds." + object.world; - switch (type) { - case PARTIAL: { - if (object.id != null) { - if (!this.worldConfiguration.contains(worldPath)) { - this.worldConfiguration.createSection(worldPath); - } - ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath); - String areaName = object.id + "-" + object.min + "-" + object.max; - String areaPath = "areas." + areaName; - if (!worldSection.contains(areaPath)) { - worldSection.createSection(areaPath); - } - ConfigurationSection areaSection = - worldSection.getConfigurationSection(areaPath); - HashMap options = new HashMap<>(); - for (ConfigurationNode step : steps) { - options.put(step.getConstant(), step.getValue()); - } - options.put("generator.type", object.type.toString()); - options.put("generator.terrain", object.terrain.toString()); - options.put("generator.plugin", object.plotManager); - if (object.setupGenerator != null && !object.setupGenerator - .equals(object.plotManager)) { - options.put("generator.init", object.setupGenerator); - } - for (Entry entry : options.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - if (worldSection.contains(key)) { - Object current = worldSection.get(key); - if (!Objects.equals(value, current)) { - areaSection.set(key, value); - } - } else { - worldSection.set(key, value); - } - } - } - GeneratorWrapper gen = SetupUtils.generators.get(object.setupGenerator); - if (gen != null && gen.isFull()) { - object.setupGenerator = null; - } - break; - } - case AUGMENTED: { - if (!object.plotManager.endsWith(":single")) { - if (!this.worldConfiguration.contains(worldPath)) { - this.worldConfiguration.createSection(worldPath); - } - if (steps.length != 0) { - ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath); - for (ConfigurationNode step : steps) { - worldSection.set(step.getConstant(), step.getValue()); - } - } - this.worldConfiguration.set("worlds." + world + ".generator.type", object.type.toString()); - this.worldConfiguration.set("worlds." + world + ".generator.terrain", object.terrain.toString()); - this.worldConfiguration.set("worlds." + world + ".generator.plugin", object.plotManager); - if (object.setupGenerator != null && !object.setupGenerator - .equals(object.plotManager)) { - this.worldConfiguration.set("worlds." + world + ".generator.init", object.setupGenerator); - } - } - GeneratorWrapper gen = SetupUtils.generators.get(object.setupGenerator); - if (gen != null && gen.isFull()) { - object.setupGenerator = null; - } - break; - } - case NORMAL: { - if (steps.length != 0) { - if (!this.worldConfiguration.contains(worldPath)) { - this.worldConfiguration.createSection(worldPath); - } - ConfigurationSection worldSection = this.worldConfiguration.getConfigurationSection(worldPath); - for (ConfigurationNode step : steps) { - worldSection.set(step.getConstant(), step.getValue()); - } - } - break; - } - } - - try { - this.worldConfiguration.save(this.worldFile); - } catch (IOException e) { - e.printStackTrace(); - } - - Objects.requireNonNull(PlotSquared.platform()).getWorldManager() - .handleWorldCreation(object.world, object.setupGenerator); - - if (Bukkit.getWorld(world) != null) { - return world; - } - - return object.world; - } - @Override public String setupWorld(PlotAreaBuilder builder) { this.updateGenerators(); ConfigurationNode[] steps = builder.settingsNodesWrapper() == null ? diff --git a/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java b/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java index dc1a9a23b..02f3c2a8c 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java +++ b/Core/src/main/java/com/plotsquared/core/generator/IndependentPlotGenerator.java @@ -28,7 +28,6 @@ package com.plotsquared.core.generator; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotId; -import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.queue.ScopedQueueCoordinator; import com.plotsquared.core.setup.PlotAreaBuilder; @@ -75,7 +74,7 @@ public abstract class IndependentPlotGenerator { * If any additional setup options need to be changed before world creation. * - e.g. If setup doesn't support some standard options * - * @param setup setup object + * @param setup */ @Deprecated public void processSetup(SetupObject setup) { } diff --git a/Core/src/main/java/com/plotsquared/core/plot/SetupObject.java b/Core/src/main/java/com/plotsquared/core/plot/SetupObject.java deleted file mode 100644 index cab2d279e..000000000 --- a/Core/src/main/java/com/plotsquared/core/plot/SetupObject.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * _____ _ _ _____ _ - * | __ \| | | | / ____| | | - * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | - * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | - * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | - * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| - * | | - * |_| - * PlotSquared plot management system for Minecraft - * Copyright (C) 2020 IntellectualSites - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.plotsquared.core.plot; - -import com.plotsquared.core.configuration.ConfigurationNode; -import com.plotsquared.core.util.SetupUtils; - -/** - * @deprecated will be removed in v6 - */ -@Deprecated -public class SetupObject { - - /** - * Specify a SetupUtils object here to override the existing - */ - public SetupUtils setupManager; - - /** - * The current state - */ - public int current = 0; - - /** - * The index in generator specific settings - */ - public int setup_index = 0; - - /** - * The name of the world - */ - public String world = null; - - /** - * The name of the plot manager - */ - public String plotManager = null; - - /** - * The name of the generator to use for world creation - */ - public String setupGenerator = null; - - /** - * The management type (normal, augmented, partial) - */ - public PlotAreaType type; - - /** - * The terrain type - */ - public PlotAreaTerrainType terrain; - - /** - * Area ID (may be null) - */ - public String id; - - /** - * Minimum plot id (may be null) - */ - public PlotId min; - - /** - * Max plot id (may be null) - */ - public PlotId max; - - /** - * Generator specific configuration steps - */ - public ConfigurationNode[] step = null; -} diff --git a/Core/src/main/java/com/plotsquared/core/util/SetupUtils.java b/Core/src/main/java/com/plotsquared/core/util/SetupUtils.java index 04108d9d8..b1b92c7a7 100644 --- a/Core/src/main/java/com/plotsquared/core/util/SetupUtils.java +++ b/Core/src/main/java/com/plotsquared/core/util/SetupUtils.java @@ -27,7 +27,6 @@ package com.plotsquared.core.util; import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.plot.SetupObject; import com.plotsquared.core.setup.PlotAreaBuilder; import java.util.HashMap; @@ -40,9 +39,6 @@ public abstract class SetupUtils { public abstract String getGenerator(final PlotArea plotArea); - @Deprecated - public abstract String setupWorld(final SetupObject object); - public abstract String setupWorld(final PlotAreaBuilder builder); public abstract void unload(String world, boolean save);