Add /DeleteClaimsInWorld
This commit is contained in:
parent
3402efe5c7
commit
97f279cd6d
|
|
@ -67,6 +67,10 @@ commands:
|
|||
description: Deletes all of another player's claims.
|
||||
usage: /DeleteAllClaims <player>
|
||||
permission: griefprevention.deleteclaims
|
||||
deleteclaimsinworld:
|
||||
description: Deletes all the claims in a world. Only usable at the server console.
|
||||
usage: /DeleteClaimsInWorld <world>
|
||||
permission: griefprevention.deleteclaimsinworld
|
||||
adminclaims:
|
||||
description: Switches the shovel tool to administrative claims mode.
|
||||
usage: /AdminClaims
|
||||
|
|
@ -262,6 +266,9 @@ permissions:
|
|||
griefprevention.deleteclaims:
|
||||
description: Grants permission to delete other players' claims.
|
||||
default: op
|
||||
griefprevention.deleteclaimsinworld:
|
||||
description: Not used. DeleteClaimsInWorld must be executed at the server console.
|
||||
default: false
|
||||
griefprevention.adjustclaimblocks:
|
||||
description: Grants permission to add or remove bonus blocks from a player's account.
|
||||
default: op
|
||||
|
|
|
|||
|
|
@ -1605,6 +1605,8 @@ public abstract class DataStore
|
|||
this.addDefault(defaults, Messages.BookUsefulCommands, "Useful Commands:", null);
|
||||
this.addDefault(defaults, Messages.NoProfanity, "Please moderate your language.", null);
|
||||
this.addDefault(defaults, Messages.IsIgnoringYou, "That player is ignoring you.", null);
|
||||
this.addDefault(defaults, Messages.ConsoleOnlyCommand, "That command may only be executed from the server console.", null);
|
||||
this.addDefault(defaults, Messages.WorldNotFound, "World not found.", null);
|
||||
|
||||
//load the config file
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||
|
|
@ -1764,4 +1766,18 @@ public abstract class DataStore
|
|||
|
||||
return claims;
|
||||
}
|
||||
|
||||
//deletes all the land claims in a specified world
|
||||
void deleteClaimsInWorld(World world)
|
||||
{
|
||||
for(int i = 0; i < claims.size(); i++)
|
||||
{
|
||||
Claim claim = claims.get(i);
|
||||
if(claim.getLesserBoundaryCorner().getWorld().equals(world))
|
||||
{
|
||||
this.deleteClaim(claim, false, false);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1945,6 +1945,32 @@ public class GriefPrevention extends JavaPlugin
|
|||
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 claims in that world
|
||||
this.dataStore.deleteClaimsInWorld(world);
|
||||
GriefPrevention.AddLogEntry("Deleted all claims in world: " + world.getName() + ".", CustomLogEntryTypes.AdminActivity);
|
||||
return true;
|
||||
}
|
||||
|
||||
//claimbook
|
||||
else if(cmd.getName().equalsIgnoreCase("claimbook"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -241,5 +241,7 @@ public enum Messages
|
|||
MinimumRadius,
|
||||
RadiusRequiresGoldenShovel,
|
||||
ClaimTooSmallForActiveBlocks,
|
||||
TooManyActiveBlocksInClaim
|
||||
TooManyActiveBlocksInClaim,
|
||||
ConsoleOnlyCommand,
|
||||
WorldNotFound
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user