Check System Added and Massive Reformat
This commit is contained in:
@@ -8,51 +8,51 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdAutoClaim extends FCommand {
|
||||
|
||||
public CmdAutoClaim() {
|
||||
super();
|
||||
this.aliases.add("autoclaim");
|
||||
public CmdAutoClaim() {
|
||||
super();
|
||||
this.aliases.add("autoclaim");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction", "your");
|
||||
|
||||
this.permission = Permission.AUTOCLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
this.disableOnSpam = false;
|
||||
this.permission = Permission.AUTOCLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
this.disableOnSpam = false;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction forFaction = this.argAsFaction(0, myFaction);
|
||||
if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
|
||||
fme.setAutoClaimFor(null);
|
||||
msg(TL.COMMAND_AUTOCLAIM_DISABLED);
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction forFaction = this.argAsFaction(0, myFaction);
|
||||
if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
|
||||
fme.setAutoClaimFor(null);
|
||||
msg(TL.COMMAND_AUTOCLAIM_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fme.canClaimForFaction(forFaction)) {
|
||||
if (myFaction == forFaction) {
|
||||
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
|
||||
} else {
|
||||
msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
|
||||
}
|
||||
if (!fme.canClaimForFaction(forFaction)) {
|
||||
if (myFaction == forFaction) {
|
||||
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
|
||||
} else {
|
||||
msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fme.setAutoClaimFor(forFaction);
|
||||
fme.setAutoClaimFor(forFaction);
|
||||
|
||||
msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
|
||||
fme.attemptClaim(forFaction, me.getLocation(), true);
|
||||
}
|
||||
msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
|
||||
fme.attemptClaim(forFaction, me.getLocation(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_AUTOCLAIM_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_AUTOCLAIM_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,38 +8,38 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdClaimAt extends FCommand {
|
||||
|
||||
public CmdClaimAt() {
|
||||
super();
|
||||
this.aliases.add("claimat");
|
||||
public CmdClaimAt() {
|
||||
super();
|
||||
this.aliases.add("claimat");
|
||||
|
||||
this.requiredArgs.add("world");
|
||||
this.requiredArgs.add("x");
|
||||
this.requiredArgs.add("z");
|
||||
this.requiredArgs.add("world");
|
||||
this.requiredArgs.add("x");
|
||||
this.requiredArgs.add("z");
|
||||
|
||||
this.permission = Permission.CLAIMAT.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.CLAIMAT.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
int x = argAsInt(1);
|
||||
int z = argAsInt(2);
|
||||
FLocation location = new FLocation(argAsString(0), x, z);
|
||||
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
|
||||
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
|
||||
fme.attemptClaim(myFaction, location, true);
|
||||
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
|
||||
}
|
||||
@Override
|
||||
public void perform() {
|
||||
int x = argAsInt(1);
|
||||
int z = argAsInt(2);
|
||||
FLocation location = new FLocation(argAsString(0), x, z);
|
||||
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
|
||||
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
|
||||
fme.attemptClaim(myFaction, location, true);
|
||||
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,70 +10,70 @@ import org.bukkit.block.BlockFace;
|
||||
|
||||
public class CmdClaimLine extends FCommand {
|
||||
|
||||
public static final BlockFace[] axis = {BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST};
|
||||
public static final BlockFace[] axis = {BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST};
|
||||
|
||||
public CmdClaimLine() {
|
||||
public CmdClaimLine() {
|
||||
|
||||
// Aliases
|
||||
this.aliases.add("claimline");
|
||||
this.aliases.add("cl");
|
||||
// Aliases
|
||||
this.aliases.add("claimline");
|
||||
this.aliases.add("cl");
|
||||
|
||||
// Args
|
||||
this.optionalArgs.put("amount", "1");
|
||||
this.optionalArgs.put("direction", "facing");
|
||||
this.optionalArgs.put("faction", "you");
|
||||
// Args
|
||||
this.optionalArgs.put("amount", "1");
|
||||
this.optionalArgs.put("direction", "facing");
|
||||
this.optionalArgs.put("faction", "you");
|
||||
|
||||
this.permission = Permission.CLAIM_LINE.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.CLAIM_LINE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
// Args
|
||||
Integer amount = this.argAsInt(0, 1); // Default to 1
|
||||
@Override
|
||||
public void perform() {
|
||||
// Args
|
||||
Integer amount = this.argAsInt(0, 1); // Default to 1
|
||||
|
||||
if (amount > Conf.lineClaimLimit) {
|
||||
fme.msg(TL.COMMAND_CLAIMLINE_ABOVEMAX, Conf.lineClaimLimit);
|
||||
return;
|
||||
}
|
||||
if (amount > Conf.lineClaimLimit) {
|
||||
fme.msg(TL.COMMAND_CLAIMLINE_ABOVEMAX, Conf.lineClaimLimit);
|
||||
return;
|
||||
}
|
||||
|
||||
String direction = this.argAsString(1);
|
||||
BlockFace blockFace;
|
||||
String direction = this.argAsString(1);
|
||||
BlockFace blockFace;
|
||||
|
||||
if (direction == null) {
|
||||
blockFace = axis[Math.round(me.getLocation().getYaw() / 90f) & 0x3];
|
||||
} else if (direction.equalsIgnoreCase("north")) {
|
||||
blockFace = BlockFace.NORTH;
|
||||
} else if (direction.equalsIgnoreCase("east")) {
|
||||
blockFace = BlockFace.EAST;
|
||||
} else if (direction.equalsIgnoreCase("south")) {
|
||||
blockFace = BlockFace.SOUTH;
|
||||
} else if (direction.equalsIgnoreCase("west")) {
|
||||
blockFace = BlockFace.WEST;
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_CLAIMLINE_NOTVALID, direction);
|
||||
return;
|
||||
}
|
||||
if (direction == null) {
|
||||
blockFace = axis[Math.round(me.getLocation().getYaw() / 90f) & 0x3];
|
||||
} else if (direction.equalsIgnoreCase("north")) {
|
||||
blockFace = BlockFace.NORTH;
|
||||
} else if (direction.equalsIgnoreCase("east")) {
|
||||
blockFace = BlockFace.EAST;
|
||||
} else if (direction.equalsIgnoreCase("south")) {
|
||||
blockFace = BlockFace.SOUTH;
|
||||
} else if (direction.equalsIgnoreCase("west")) {
|
||||
blockFace = BlockFace.WEST;
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_CLAIMLINE_NOTVALID, direction);
|
||||
return;
|
||||
}
|
||||
|
||||
final Faction forFaction = this.argAsFaction(2, myFaction);
|
||||
Location location = me.getLocation();
|
||||
final Faction forFaction = this.argAsFaction(2, myFaction);
|
||||
Location location = me.getLocation();
|
||||
|
||||
// TODO: make this a task like claiming a radius?
|
||||
for (int i = 0; i < amount; i++) {
|
||||
fme.attemptClaim(forFaction, location, true);
|
||||
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
||||
}
|
||||
}
|
||||
// TODO: make this a task like claiming a radius?
|
||||
for (int i = 0; i < amount; i++) {
|
||||
fme.attemptClaim(forFaction, location, true);
|
||||
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CLAIMLINE_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CLAIMLINE_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,52 +12,52 @@ import org.bukkit.World;
|
||||
|
||||
public class CmdSafeunclaimall extends FCommand {
|
||||
|
||||
public CmdSafeunclaimall() {
|
||||
this.aliases.add("safeunclaimall");
|
||||
this.aliases.add("safedeclaimall");
|
||||
public CmdSafeunclaimall() {
|
||||
this.aliases.add("safeunclaimall");
|
||||
this.aliases.add("safedeclaimall");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("world", "all");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("world", "all");
|
||||
|
||||
this.permission = Permission.MANAGE_SAFE_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.MANAGE_SAFE_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
String worldName = argAsString(0);
|
||||
World world = null;
|
||||
@Override
|
||||
public void perform() {
|
||||
String worldName = argAsString(0);
|
||||
World world = null;
|
||||
|
||||
if (worldName != null) {
|
||||
world = Bukkit.getWorld(worldName);
|
||||
}
|
||||
if (worldName != null) {
|
||||
world = Bukkit.getWorld(worldName);
|
||||
}
|
||||
|
||||
String id = Factions.getInstance().getSafeZone().getId();
|
||||
String id = Factions.getInstance().getSafeZone().getId();
|
||||
|
||||
if (world == null) {
|
||||
Board.getInstance().unclaimAll(id);
|
||||
} else {
|
||||
Board.getInstance().unclaimAllInWorld(id, world);
|
||||
}
|
||||
if (world == null) {
|
||||
Board.getInstance().unclaimAll(id);
|
||||
} else {
|
||||
Board.getInstance().unclaimAllInWorld(id, world);
|
||||
}
|
||||
|
||||
msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
|
||||
msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
|
||||
}
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_SAFEUNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_SAFEUNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,172 +14,172 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class CmdUnclaim extends FCommand {
|
||||
|
||||
public CmdUnclaim() {
|
||||
this.aliases.add("unclaim");
|
||||
this.aliases.add("declaim");
|
||||
public CmdUnclaim() {
|
||||
this.aliases.add("unclaim");
|
||||
this.aliases.add("declaim");
|
||||
|
||||
this.optionalArgs.put("radius", "1");
|
||||
this.optionalArgs.put("radius", "1");
|
||||
|
||||
this.permission = Permission.UNCLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.UNCLAIM.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
// Read and validate input
|
||||
int radius = this.argAsInt(0, 1); // Default to 1
|
||||
@Override
|
||||
public void perform() {
|
||||
// Read and validate input
|
||||
int radius = this.argAsInt(0, 1); // Default to 1
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (radius < 1) {
|
||||
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
||||
return;
|
||||
}
|
||||
if (radius < 1) {
|
||||
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (radius < 2) {
|
||||
// single chunk
|
||||
unClaim(new FLocation(me));
|
||||
} else {
|
||||
// radius claim
|
||||
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
msg(TL.COMMAND_CLAIM_DENIED);
|
||||
return;
|
||||
}
|
||||
if (radius < 2) {
|
||||
// single chunk
|
||||
unClaim(new FLocation(me));
|
||||
} else {
|
||||
// radius claim
|
||||
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
msg(TL.COMMAND_CLAIM_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
new SpiralTask(new FLocation(me), radius) {
|
||||
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
||||
private int failCount = 0;
|
||||
new SpiralTask(new FLocation(me), radius) {
|
||||
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
||||
private int failCount = 0;
|
||||
|
||||
@Override
|
||||
public boolean work() {
|
||||
boolean success = unClaim(this.currentFLocation());
|
||||
if (success) {
|
||||
failCount = 0;
|
||||
} else if (failCount++ >= limit) {
|
||||
this.stop();
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean work() {
|
||||
boolean success = unClaim(this.currentFLocation());
|
||||
if (success) {
|
||||
failCount = 0;
|
||||
} else if (failCount++ >= limit) {
|
||||
this.stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private boolean unClaim(FLocation target) {
|
||||
Faction targetFaction = Board.getInstance().getFactionAt(target);
|
||||
if (targetFaction.isSafeZone()) {
|
||||
if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
|
||||
Board.getInstance().removeAt(target);
|
||||
msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS);
|
||||
private boolean unClaim(FLocation target) {
|
||||
Faction targetFaction = Board.getInstance().getFactionAt(target);
|
||||
if (targetFaction.isSafeZone()) {
|
||||
if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
|
||||
Board.getInstance().removeAt(target);
|
||||
msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS);
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM);
|
||||
return false;
|
||||
}
|
||||
} else if (targetFaction.isWarZone()) {
|
||||
if (Permission.MANAGE_WAR_ZONE.has(sender)) {
|
||||
Board.getInstance().removeAt(target);
|
||||
msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS);
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM);
|
||||
return false;
|
||||
}
|
||||
} else if (targetFaction.isWarZone()) {
|
||||
if (Permission.MANAGE_WAR_ZONE.has(sender)) {
|
||||
Board.getInstance().removeAt(target);
|
||||
msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS);
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (fme.isAdminBypassing()) {
|
||||
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
|
||||
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent));
|
||||
if (unclaimEvent.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
if (fme.isAdminBypassing()) {
|
||||
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
|
||||
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent));
|
||||
if (unclaimEvent.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Board.getInstance().removeAt(target);
|
||||
Board.getInstance().removeAt(target);
|
||||
|
||||
targetFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(targetFaction, true));
|
||||
msg(TL.COMMAND_UNCLAIM_UNCLAIMS);
|
||||
targetFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(targetFaction, true));
|
||||
msg(TL.COMMAND_UNCLAIM_UNCLAIMS);
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) == Access.DENY) {
|
||||
return false;
|
||||
}
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) == Access.DENY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!assertHasFaction()) {
|
||||
return false;
|
||||
}
|
||||
if (!assertHasFaction()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) {
|
||||
return false;
|
||||
}
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (myFaction != targetFaction) {
|
||||
msg(TL.COMMAND_UNCLAIM_WRONGFACTION);
|
||||
return false;
|
||||
}
|
||||
if (myFaction != targetFaction) {
|
||||
msg(TL.COMMAND_UNCLAIM_WRONGFACTION);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
|
||||
Bukkit.getServer().getPluginManager().callEvent(unclaimEvent);
|
||||
if (unclaimEvent.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
|
||||
Bukkit.getServer().getPluginManager().callEvent(unclaimEvent);
|
||||
if (unclaimEvent.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
|
||||
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Board.getInstance().removeAt(target);
|
||||
myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true));
|
||||
Board.getInstance().removeAt(target);
|
||||
myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true));
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_UNCLAIM_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_UNCLAIM_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,55 +12,55 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class CmdUnclaimall extends FCommand {
|
||||
|
||||
public CmdUnclaimall() {
|
||||
this.aliases.add("unclaimall");
|
||||
this.aliases.add("declaimall");
|
||||
public CmdUnclaimall() {
|
||||
this.aliases.add("unclaimall");
|
||||
this.aliases.add("declaimall");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
//this.requiredArgs.add("");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.UNCLAIM_ALL.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.UNCLAIM_ALL.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = true;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void perform() {
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme);
|
||||
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent));
|
||||
if (unclaimAllEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme);
|
||||
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent));
|
||||
if (unclaimAllEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Board.getInstance().unclaimAll(myFaction.getId());
|
||||
myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true));
|
||||
Board.getInstance().unclaimAll(myFaction.getId());
|
||||
myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true));
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag()));
|
||||
}
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_UNCLAIMALL_LOG.format(fme.getName(), myFaction.getTag()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_UNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_UNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,51 +12,51 @@ import org.bukkit.World;
|
||||
|
||||
public class CmdWarunclaimall extends FCommand {
|
||||
|
||||
public CmdWarunclaimall() {
|
||||
this.aliases.add("warunclaimall");
|
||||
this.aliases.add("wardeclaimall");
|
||||
public CmdWarunclaimall() {
|
||||
this.aliases.add("warunclaimall");
|
||||
this.aliases.add("wardeclaimall");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("world", "all");
|
||||
//this.requiredArgs.add("");
|
||||
this.optionalArgs.put("world", "all");
|
||||
|
||||
this.permission = Permission.MANAGE_WAR_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.MANAGE_WAR_ZONE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
senderMustBePlayer = false;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
String worldName = argAsString(0);
|
||||
World world = null;
|
||||
@Override
|
||||
public void perform() {
|
||||
String worldName = argAsString(0);
|
||||
World world = null;
|
||||
|
||||
if (worldName != null) {
|
||||
world = Bukkit.getWorld(worldName);
|
||||
}
|
||||
if (worldName != null) {
|
||||
world = Bukkit.getWorld(worldName);
|
||||
}
|
||||
|
||||
String id = Factions.getInstance().getWarZone().getId();
|
||||
String id = Factions.getInstance().getWarZone().getId();
|
||||
|
||||
if (world == null) {
|
||||
Board.getInstance().unclaimAll(id);
|
||||
} else {
|
||||
Board.getInstance().unclaimAllInWorld(id, world);
|
||||
}
|
||||
if (world == null) {
|
||||
Board.getInstance().unclaimAll(id);
|
||||
} else {
|
||||
Board.getInstance().unclaimAllInWorld(id, world);
|
||||
}
|
||||
|
||||
fme.msg(TL.COMMAND_WARUNCLAIMALL_SUCCESS);
|
||||
fme.msg(TL.COMMAND_WARUNCLAIMALL_SUCCESS);
|
||||
|
||||
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName()));
|
||||
}
|
||||
}
|
||||
if (Conf.logLandUnclaims) {
|
||||
P.p.log(TL.COMMAND_WARUNCLAIMALL_LOG.format(fme.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_WARUNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_WARUNCLAIMALL_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user