mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixed setup command
This commit is contained in:
parent
42a34fc44a
commit
dda2636250
@ -27,6 +27,7 @@ import java.util.zip.ZipInputStream;
|
|||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.commands.Cluster;
|
import com.intellectualcrafters.plot.commands.Cluster;
|
||||||
@ -361,18 +362,22 @@ public class PlotSquared {
|
|||||||
final PlotGenerator gen_class = generator;
|
final PlotGenerator gen_class = generator;
|
||||||
plotWorld = gen_class.getNewPlotWorld(world);
|
plotWorld = gen_class.getNewPlotWorld(world);
|
||||||
plotManager = gen_class.getPlotManager();
|
plotManager = gen_class.getPlotManager();
|
||||||
|
|
||||||
if (!config.contains(path)) {
|
if (!config.contains(path)) {
|
||||||
config.createSection(path);
|
config.createSection(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
plotWorld.TYPE = 2;
|
plotWorld.TYPE = 2;
|
||||||
plotWorld.TERRAIN = 0;
|
plotWorld.TERRAIN = 0;
|
||||||
plotWorld.saveConfiguration(config.getConfigurationSection(path));
|
plotWorld.saveConfiguration(config.getConfigurationSection(path));
|
||||||
plotWorld.loadDefaultConfiguration(config.getConfigurationSection(path));
|
plotWorld.loadDefaultConfiguration(config.getConfigurationSection(path));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((plotWorld.TYPE == 2) && !Settings.ENABLE_CLUSTERS) || !(plotManager instanceof SquarePlotManager)) {
|
if (((plotWorld.TYPE == 2) && !Settings.ENABLE_CLUSTERS) || !(plotManager instanceof SquarePlotManager)) {
|
||||||
log("&c[ERROR] World '" + world + "' in settings.yml is not using PlotSquared generator! Please set the generator correctly or delete the world from the 'settings.yml'!");
|
log("&c[ERROR] World '" + world + "' in settings.yml is not using PlotSquared generator! Please set the generator correctly or delete the world from the 'settings.yml'!");
|
||||||
return;
|
return;
|
||||||
|
@ -163,7 +163,9 @@ public class Info extends SubCommand {
|
|||||||
final PlotId id2 = MainUtil.getTopPlot(plot).id;
|
final PlotId id2 = MainUtil.getTopPlot(plot).id;
|
||||||
final int num = MainUtil.getPlotSelectionIds(id, id2).size();
|
final int num = MainUtil.getPlotSelectionIds(id, id2).size();
|
||||||
final String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none";
|
final String alias = plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none";
|
||||||
final String biome = BlockManager.manager.getBiome(MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1));
|
Location top = MainUtil.getPlotTopLoc(world, plot.id);
|
||||||
|
Location bot = MainUtil.getPlotBottomLoc(world, plot.id).add(1,0,1);
|
||||||
|
final String biome = BlockManager.manager.getBiome(bot.add((top.getX() - bot.getX()) / 2, 0, (top.getX() - bot.getX()) / 2));
|
||||||
final String helpers = getPlayerList(plot.helpers);
|
final String helpers = getPlayerList(plot.helpers);
|
||||||
final String trusted = getPlayerList(plot.trusted);
|
final String trusted = getPlayerList(plot.trusted);
|
||||||
final String denied = getPlayerList(plot.denied);
|
final String denied = getPlayerList(plot.denied);
|
||||||
|
@ -140,6 +140,7 @@ public class Setup extends SubCommand {
|
|||||||
if (object.step == null) {
|
if (object.step == null) {
|
||||||
object.plotManager = object.setupGenerator;
|
object.plotManager = object.setupGenerator;
|
||||||
object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes();
|
object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes();
|
||||||
|
((PlotGenerator) SetupUtils.generators.get(object.plotManager)).processSetup(object);
|
||||||
}
|
}
|
||||||
final ConfigurationNode step = object.step[object.setup_index];
|
final ConfigurationNode step = object.step[object.setup_index];
|
||||||
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
|
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
|
||||||
@ -148,6 +149,7 @@ public class Setup extends SubCommand {
|
|||||||
object.plotManager = object.setupGenerator;
|
object.plotManager = object.setupGenerator;
|
||||||
object.setupGenerator = null;
|
object.setupGenerator = null;
|
||||||
object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes();
|
object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes();
|
||||||
|
((PlotGenerator) SetupUtils.generators.get(object.plotManager)).processSetup(object);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
object.plotManager = "PlotSquared";
|
object.plotManager = "PlotSquared";
|
||||||
|
@ -150,7 +150,7 @@ public abstract class PlotGenerator extends ChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>random</b> is a optimized random number generator.<br>
|
* <b>random</b> is an optimized random number generator.<br>
|
||||||
* - Change the state to have the same chunk random each time it generates<br>
|
* - Change the state to have the same chunk random each time it generates<br>
|
||||||
* <b>requiredRegion</b> If a plot is being regenerated, you are only required to generate content in this area<br>
|
* <b>requiredRegion</b> If a plot is being regenerated, you are only required to generate content in this area<br>
|
||||||
* - use the contains(RegionWrapper, x, z) method to check if the region contains a location<br>
|
* - use the contains(RegionWrapper, x, z) method to check if the region contains a location<br>
|
||||||
@ -172,11 +172,31 @@ public abstract class PlotGenerator extends ChunkGenerator {
|
|||||||
|
|
||||||
public abstract List<PlotPopulator> getPopulators(String world);
|
public abstract List<PlotPopulator> getPopulators(String world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the generator is initialized.
|
||||||
|
* You don't need to do anything with it necessarily.
|
||||||
|
* @param plotworld
|
||||||
|
*/
|
||||||
public abstract void init(PlotWorld plotworld);
|
public abstract void init(PlotWorld plotworld);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new instance of the PlotWorld for a world
|
||||||
|
* @param world
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public abstract PlotWorld getNewPlotWorld(final String world);
|
public abstract PlotWorld getNewPlotWorld(final String world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PlotManager class for this generator
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public abstract PlotManager getPlotManager();
|
public abstract PlotManager getPlotManager();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you need to do anything fancy for /plot setup<br>
|
||||||
|
* - Otherwise it will just use the PlotWorld configuration<br>
|
||||||
|
* Feel free to extend BukkitSetupUtils and customize world creation
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
public void processSetup(SetupObject object) {};
|
public void processSetup(SetupObject object) {};
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,6 @@ public class BukkitSetupUtils extends SetupUtils {
|
|||||||
@Override
|
@Override
|
||||||
public String setupWorld(final SetupObject object) {
|
public String setupWorld(final SetupObject object) {
|
||||||
SetupUtils.manager.updateGenerators();
|
SetupUtils.manager.updateGenerators();
|
||||||
((PlotGenerator) SetupUtils.generators.get(object.plotManager)).processSetup(object);;
|
|
||||||
final ConfigurationNode[] steps = object.step;
|
final ConfigurationNode[] steps = object.step;
|
||||||
final String world = object.world;
|
final String world = object.world;
|
||||||
for (final ConfigurationNode step : steps) {
|
for (final ConfigurationNode step : steps) {
|
||||||
|
Loading…
Reference in New Issue
Block a user