diff --git a/plugin.yml b/plugin.yml index 7ce587a..fc4ddf1 100644 --- a/plugin.yml +++ b/plugin.yml @@ -72,6 +72,11 @@ commands: usage: /DeleteClaimsInWorld aliases: [deleteallclaimsinworld, clearclaimsinworld, clearallclaimsinworld] permission: griefprevention.deleteclaimsinworld + deleteuserclaimsinworld: + description: Deletes all the non-admin claims in a world. Only usable at the server console. + usage: /DeleteUserClaimsInWorld + aliases: [deletealluserclaimsinworld, clearuserclaimsinworld, clearalluserclaimsinworld] + permission: griefprevention.deleteclaimsinworld adminclaims: description: Switches the shovel tool to administrative claims mode. usage: /AdminClaims diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index 7d06957..b2bec02 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -1771,13 +1771,14 @@ public abstract class DataStore } //deletes all the land claims in a specified world - void deleteClaimsInWorld(World world) + void deleteClaimsInWorld(World world, boolean deleteAdminClaims) { for(int i = 0; i < claims.size(); i++) { Claim claim = claims.get(i); if(claim.getLesserBoundaryCorner().getWorld().equals(world)) { + if(!deleteAdminClaims && claim.isAdminClaim()) continue; this.deleteClaim(claim, false, false); i--; } diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 98f81b7..5a82da8 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -1963,11 +1963,37 @@ public class GriefPrevention extends JavaPlugin } //delete all claims in that world - this.dataStore.deleteClaimsInWorld(world); + this.dataStore.deleteClaimsInWorld(world, true); GriefPrevention.AddLogEntry("Deleted all claims in world: " + world.getName() + ".", CustomLogEntryTypes.AdminActivity); return true; } + else if(cmd.getName().equalsIgnoreCase("deleteclaimsinworld")) + { + //must be executed at the console + if(player != null) + { + GriefPrevention.sendMessage(player, TextMode.Err, Messages.ConsoleOnlyCommand); + return true; + } + + //requires exactly one parameter, the world name + if(args.length != 1) return false; + + //try to find the specified world + World world = Bukkit.getServer().getWorld(args[0]); + if(world == null) + { + GriefPrevention.sendMessage(player, TextMode.Err, Messages.WorldNotFound); + return true; + } + + //delete all USER claims in that world + this.dataStore.deleteClaimsInWorld(world, false); + GriefPrevention.AddLogEntry("Deleted all user claims in world: " + world.getName() + ".", CustomLogEntryTypes.AdminActivity); + return true; + } + //claimbook else if(cmd.getName().equalsIgnoreCase("claimbook")) {