Clearing a mega-plot is now deemed safe

I also reorganized the configuration.
This commit is contained in:
boy0001 2014-09-27 14:34:43 +10:00
parent 38ec36f81d
commit 2eb82fe703
3 changed files with 14 additions and 17 deletions

View File

@ -73,11 +73,11 @@ public class WorldGenerator extends ChunkGenerator {
this.plotworld = new PlotWorld(); this.plotworld = new PlotWorld();
Map<String, Object> options = new HashMap<String, Object>(); Map<String, Object> options = new HashMap<String, Object>();
options.put("worlds." + world + ".plot_height", PLOT_HEIGHT_DEFAULT); options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
options.put("worlds." + world + ".plot_size", PLOT_WIDTH_DEFAULT); options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
options.put("worlds." + world + ".plot_biome", PLOT_BIOME_DEFAULT); options.put("worlds." + world + ".plot.biome", PLOT_BIOME_DEFAULT);
options.put("worlds." + world + ".plot_filling", Arrays.asList(MAIN_BLOCK_DEFAULT)); options.put("worlds." + world + ".plot.filling", Arrays.asList(MAIN_BLOCK_DEFAULT));
options.put("worlds." + world + ".top_floor", Arrays.asList(TOP_BLOCK_DEFAULT)); options.put("worlds." + world + ".plot.floor", Arrays.asList(TOP_BLOCK_DEFAULT));
options.put("worlds." + world + ".wall.block", WALL_BLOCK_DEFAULT); options.put("worlds." + world + ".wall.block", WALL_BLOCK_DEFAULT);
options.put("worlds." + world + ".road.width", ROAD_WIDTH_DEFAULT); options.put("worlds." + world + ".road.width", ROAD_WIDTH_DEFAULT);
options.put("worlds." + world + ".road.height", ROAD_HEIGHT_DEFAULT); options.put("worlds." + world + ".road.height", ROAD_HEIGHT_DEFAULT);
@ -88,7 +88,7 @@ public class WorldGenerator extends ChunkGenerator {
options.put("worlds." + world + ".wall.height", WALL_HEIGHT_DEFAULT); options.put("worlds." + world + ".wall.height", WALL_HEIGHT_DEFAULT);
options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT); options.put("worlds." + world + ".schematic.on_claim", SCHEMATIC_ON_CLAIM_DEFAULT);
options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT); options.put("worlds." + world + ".schematic.file", SCHEMATIC_FILE_DEFAULT);
options.put("worlds." + world + ".default_flags", DEFAULT_FLAGS_DEFAULT); options.put("worlds." + world + ".flags.default", DEFAULT_FLAGS_DEFAULT);
for (Entry<String, Object> node : options.entrySet()) { for (Entry<String, Object> node : options.entrySet()) {
if (!config.contains(node.getKey())) { if (!config.contains(node.getKey())) {
@ -100,11 +100,11 @@ public class WorldGenerator extends ChunkGenerator {
} catch (IOException e) { } catch (IOException e) {
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save"); PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
} }
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot_height"); this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot_size"); this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
this.plotworld.PLOT_BIOME = config.getString("worlds." + world + ".plot_biome"); this.plotworld.PLOT_BIOME = config.getString("worlds." + world + ".plot.biome");
this.plotworld.MAIN_BLOCK = config.getStringList("worlds." + world + ".plot_filling").toArray(new String[0]); this.plotworld.MAIN_BLOCK = config.getStringList("worlds." + world + ".plot.filling").toArray(new String[0]);
this.plotworld.TOP_BLOCK = config.getStringList("worlds." + world + ".top_floor").toArray(new String[0]); this.plotworld.TOP_BLOCK = config.getStringList("worlds." + world + ".plot.floor").toArray(new String[0]);
this.plotworld.WALL_BLOCK = config.getString("worlds." + world + ".wall.block"); this.plotworld.WALL_BLOCK = config.getString("worlds." + world + ".wall.block");
this.plotworld.ROAD_WIDTH = config.getInt("worlds." + world + ".road.width"); this.plotworld.ROAD_WIDTH = config.getInt("worlds." + world + ".road.width");
this.plotworld.ROAD_HEIGHT = config.getInt("worlds." + world + ".road.height"); this.plotworld.ROAD_HEIGHT = config.getInt("worlds." + world + ".road.height");
@ -117,7 +117,7 @@ public class WorldGenerator extends ChunkGenerator {
this.plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim"); this.plotworld.SCHEMATIC_ON_CLAIM = config.getBoolean("worlds." + world + ".schematic.on_claim");
this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file"); this.plotworld.SCHEMATIC_FILE = config.getString("worlds." + world + ".schematic.file");
String[] default_flags_string = config.getStringList("worlds." + world + ".default_flags").toArray(new String[0]); String[] default_flags_string = config.getStringList("worlds." + world + ".flags.default").toArray(new String[0]);
Flag[] default_flags = new Flag[default_flags_string.length]; Flag[] default_flags = new Flag[default_flags_string.length];
for (int i = 0; i < default_flags.length; i++) { for (int i = 0; i < default_flags.length; i++) {
String current = default_flags_string[i]; String current = default_flags_string[i];

View File

@ -27,6 +27,8 @@ public class Auto extends SubCommand {
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING); super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING);
} }
// TODO auto claim a mega plot!!!!!!!!!!!!
@Override @Override
public boolean execute(Player plr, String... args) { public boolean execute(Player plr, String... args) {
World world; World world;

View File

@ -34,15 +34,10 @@ public class Clear extends SubCommand {
return true; return true;
} }
Plot plot = PlayerFunctions.getCurrentPlot(plr); Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (!PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
PlayerFunctions.sendMessage(plr, C.UNLINK_REQUIRED);
return true;
}
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) { if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS); PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
return true; return true;
} }
PlotHelper.removeSign(plr, plot);
plot.clear(plr); plot.clear(plr);
return true; return true;
} }