Option for building restriction on finished plots

This commit is contained in:
boy0001 2015-08-19 06:44:32 +10:00
parent be6705241c
commit be94aa53d3
6 changed files with 12 additions and 9 deletions

View File

@ -1795,8 +1795,9 @@ public class PS {
config.set("clear.ignore-if-modified", null); config.set("clear.ignore-if-modified", null);
// Done // Done
config.set("approval.ratings.require-done", Settings.REQUIRE_DONE); options.put("approval.ratings.require-done", Settings.REQUIRE_DONE);
config.set("approval.done.counts-towards-limit", Settings.DONE_COUNTS_TOWARDS_LIMIT); options.put("approval.done.counts-towards-limit", Settings.DONE_COUNTS_TOWARDS_LIMIT);
options.put("approval.done.restrict-building", Settings.DONE_RESTRICTS_BUILDING);
// Schematics // Schematics
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
@ -1905,6 +1906,7 @@ public class PS {
// Done // Done
Settings.REQUIRE_DONE = config.getBoolean("approval.ratings.require-done"); Settings.REQUIRE_DONE = config.getBoolean("approval.ratings.require-done");
Settings.DONE_COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit"); Settings.DONE_COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit");
Settings.DONE_RESTRICTS_BUILDING = config.getBoolean("approval.done.restrict-building");
// Schematics // Schematics
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");

View File

@ -88,7 +88,7 @@ public class Clear extends SubCommand {
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER); MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
return false; return false;
} }
if (FlagManager.isPlotFlagTrue(plot, "done" ) && (!Permissions.hasPermission(plr, "plots.continue") || (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)))) { if (Settings.DONE_RESTRICTS_BUILDING && FlagManager.isPlotFlagTrue(plot, "done" ) && (!Permissions.hasPermission(plr, "plots.continue") || (Settings.DONE_COUNTS_TOWARDS_LIMIT && MainUtil.getAllowedPlots(plr) >= MainUtil.getPlayerPlotCount(plr)))) {
MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE); MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE);
return false; return false;
} }

View File

@ -46,13 +46,14 @@ public class Settings {
*/ */
public static String WEB_URL = "http://empcraft.com/plots/"; public static String WEB_URL = "http://empcraft.com/plots/";
public static String WEB_IP = "your.ip.here"; public static String WEB_IP = "your.ip.here";
/** /**
* Ratings * Ratings
*/ */
public static List<String> RATING_CATEGORIES = null; public static List<String> RATING_CATEGORIES = null;
public static boolean REQUIRE_DONE = false; public static boolean REQUIRE_DONE = false;
public static boolean DONE_COUNTS_TOWARDS_LIMIT = false; public static boolean DONE_COUNTS_TOWARDS_LIMIT = false;
public static boolean DONE_RESTRICTS_BUILDING = false;
/** /**
* PlotMe settings * PlotMe settings
*/ */

View File

@ -656,7 +656,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true); event.setCancelled(true);
} }
else if (plot.getSettings().flags.containsKey("done")) { else if (Settings.DONE_RESTRICTS_BUILDING && plot.getSettings().flags.containsKey("done")) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true); event.setCancelled(true);
@ -2071,7 +2071,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
return; return;
} }
} }
else if (plot.getSettings().flags.containsKey("done")) { else if (Settings.DONE_RESTRICTS_BUILDING && plot.getSettings().flags.containsKey("done")) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true); event.setCancelled(true);

View File

@ -28,7 +28,7 @@ public class WEManager {
HashSet<RegionWrapper> regions = new HashSet<>(); HashSet<RegionWrapper> regions = new HashSet<>();
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) { for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) {
if (plot.isBasePlot() && FlagManager.getPlotFlag(plot, "done") == null) { if (Settings.DONE_RESTRICTS_BUILDING && plot.isBasePlot() && FlagManager.getPlotFlag(plot, "done") == null) {
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) { if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1); Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id); Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);

View File

@ -515,7 +515,7 @@ public class MainListener {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true); event.setCancelled(true);
} }
else if (plot.getSettings().flags.containsKey("done")) { else if (Settings.DONE_RESTRICTS_BUILDING && plot.getSettings().flags.containsKey("done")) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true); event.setCancelled(true);
@ -568,7 +568,7 @@ public class MainListener {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
event.setCancelled(true); event.setCancelled(true);
} }
else if (plot.getSettings().flags.containsKey("done")) { else if (Settings.DONE_RESTRICTS_BUILDING && plot.getSettings().flags.containsKey("done")) {
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true); event.setCancelled(true);