Skip to content

Commit

Permalink
Option for building restriction on finished plots
Browse files Browse the repository at this point in the history
  • Loading branch information
boy0001 committed Aug 18, 2015
1 parent be67052 commit be94aa5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/intellectualcrafters/plot/PS.java
Original file line number Diff line number Diff line change
Expand Up @@ -1795,8 +1795,9 @@ public void setupConfig() {
config.set("clear.ignore-if-modified", null);

// Done
config.set("approval.ratings.require-done", Settings.REQUIRE_DONE);
config.set("approval.done.counts-towards-limit", Settings.DONE_COUNTS_TOWARDS_LIMIT);
options.put("approval.ratings.require-done", Settings.REQUIRE_DONE);
options.put("approval.done.counts-towards-limit", Settings.DONE_COUNTS_TOWARDS_LIMIT);
options.put("approval.done.restrict-building", Settings.DONE_RESTRICTS_BUILDING);

// Schematics
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
Expand Down Expand Up @@ -1905,6 +1906,7 @@ public void setupConfig() {
// Done
Settings.REQUIRE_DONE = config.getBoolean("approval.ratings.require-done");
Settings.DONE_COUNTS_TOWARDS_LIMIT = config.getBoolean("approval.done.counts-towards-limit");
Settings.DONE_RESTRICTS_BUILDING = config.getBoolean("approval.done.restrict-building");

// Schematics
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public boolean onCommand(final PlotPlayer plr, final String ... args) {
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
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);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ public class Settings {
*/
public static String WEB_URL = "http://empcraft.com/plots/";
public static String WEB_IP = "your.ip.here";

/**
* Ratings
*/
public static List<String> RATING_CATEGORIES = null;
public static boolean REQUIRE_DONE = false;
public static boolean DONE_COUNTS_TOWARDS_LIMIT = false;
public static boolean DONE_RESTRICTS_BUILDING = false;

/**
* PlotMe settings
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ else if (!plot.isAdded(pp.getUUID())) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
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)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
Expand Down Expand Up @@ -2071,7 +2071,7 @@ else if (!plot.isAdded(pp.getUUID())) {
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)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
HashSet<RegionWrapper> regions = new HashSet<>();
UUID uuid = player.getUUID();
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))) {
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
Location pos2 = MainUtil.getPlotTopLoc(plot.world, plot.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ else if (!plot.isAdded(pp.getUUID())) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
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)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
Expand Down Expand Up @@ -568,7 +568,7 @@ else if (!plot.isAdded(pp.getUUID())) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
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)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
event.setCancelled(true);
Expand Down

0 comments on commit be94aa5

Please sign in to comment.