Add abandonsublevelclaim command.
This commit is contained in:
parent
88f9c27194
commit
98a0a06081
|
|
@ -1588,6 +1588,8 @@ public abstract class DataStore
|
||||||
this.addDefault(defaults, Messages.SubclaimUnrestricted, "This subclaim's permissions will now inherit from the parent claim", null);
|
this.addDefault(defaults, Messages.SubclaimUnrestricted, "This subclaim's permissions will now inherit from the parent claim", null);
|
||||||
|
|
||||||
this.addDefault(defaults, Messages.NetherPortalTrapDetectionMessage, "It seems you might be stuck inside a nether portal. We will rescue you in a few seconds if that is the case!", "Sent to player on join, if they left while inside a nether portal.");
|
this.addDefault(defaults, Messages.NetherPortalTrapDetectionMessage, "It seems you might be stuck inside a nether portal. We will rescue you in a few seconds if that is the case!", "Sent to player on join, if they left while inside a nether portal.");
|
||||||
|
this.addDefault(defaults, Messages.NoSubDivisions, "This claim has no subdivisions.", null);
|
||||||
|
this.addDefault(defaults, Messages.SubDivisionsRemoved, "This claim has all subdivisions removed.", null);
|
||||||
|
|
||||||
//load the config file
|
//load the config file
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||||
|
|
|
||||||
|
|
@ -1118,6 +1118,12 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return this.abandonClaimHandler(player, true);
|
return this.abandonClaimHandler(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//abandonsublevelclaim
|
||||||
|
if (cmd.getName().equalsIgnoreCase("abandonsublevelclaim") && player != null)
|
||||||
|
{
|
||||||
|
return this.abandonSubLevelClaimHandler(player);
|
||||||
|
}
|
||||||
|
|
||||||
//forceabandonclaim
|
//forceabandonclaim
|
||||||
if (cmd.getName().equalsIgnoreCase("forceabandonclaim") && player != null)
|
if (cmd.getName().equalsIgnoreCase("forceabandonclaim") && player != null)
|
||||||
{
|
{
|
||||||
|
|
@ -2542,6 +2548,40 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return location.getWorld().getName() + ": x" + location.getBlockX() + ", z" + location.getBlockZ() + " to x" + location2.getBlockX() + ", z" + location2.getBlockZ();
|
return location.getWorld().getName() + ": x" + location.getBlockX() + ", z" + location.getBlockZ() + " to x" + location2.getBlockX() + ", z" + location2.getBlockZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean abandonSubLevelClaimHandler(Player player)
|
||||||
|
{
|
||||||
|
//which claim is being abandoned?
|
||||||
|
Claim claim = this.dataStore.getClaimAt(player.getLocation(), true /*ignore height*/, null);
|
||||||
|
if (claim == null)
|
||||||
|
{
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.AbandonClaimMissing);
|
||||||
|
}
|
||||||
|
|
||||||
|
//verify ownership
|
||||||
|
else if (claim.checkPermission(player, ClaimPermission.Edit, null) != null)
|
||||||
|
{
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NotYourClaim);
|
||||||
|
}
|
||||||
|
else if (claim.children.isEmpty())
|
||||||
|
{
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.NoSubDivisions);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//delete it
|
||||||
|
for (Claim subClaim : claim.children)
|
||||||
|
{
|
||||||
|
GriefPrevention.instance.dataStore.deleteClaim(subClaim, false, true);
|
||||||
|
}
|
||||||
|
//revert any current visualization
|
||||||
|
Visualization.Revert(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private boolean abandonClaimHandler(Player player, boolean deleteTopLevelClaim)
|
private boolean abandonClaimHandler(Player player, boolean deleteTopLevelClaim)
|
||||||
{
|
{
|
||||||
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
|
||||||
|
|
@ -255,5 +255,7 @@ public enum Messages
|
||||||
SubclaimRestricted,
|
SubclaimRestricted,
|
||||||
SubclaimUnrestricted,
|
SubclaimUnrestricted,
|
||||||
NetherPortalTrapDetectionMessage,
|
NetherPortalTrapDetectionMessage,
|
||||||
NoClaimTrust
|
NoClaimTrust,
|
||||||
|
NoSubDivisions,
|
||||||
|
SubDivisionsRemoved
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ commands:
|
||||||
description: Deletes a claim and all its subdivisions.
|
description: Deletes a claim and all its subdivisions.
|
||||||
usage: /AbandonTopLevelClaim
|
usage: /AbandonTopLevelClaim
|
||||||
permission: griefprevention.claims
|
permission: griefprevention.claims
|
||||||
|
abandonsublevelclaim:
|
||||||
|
description: Deletes all subdivisions in a claim.
|
||||||
|
usage: /abandonsublevelclaim
|
||||||
|
permission: griefprevention.claims
|
||||||
abandonallclaims:
|
abandonallclaims:
|
||||||
description: Deletes ALL your claims.
|
description: Deletes ALL your claims.
|
||||||
usage: /AbandonAllClaims
|
usage: /AbandonAllClaims
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user