Split up set in to claim and unclaim
This commit is contained in:
		
							parent
							
								
									2240696c98
								
							
						
					
					
						commit
						c058cd7ca5
					
				| @ -15,6 +15,13 @@ public enum Perm | ||||
| 	ACCESS_PLAYER("access.player"), | ||||
| 	ACCESS_FACTION("access.faction"), | ||||
| 	ADMIN("admin"), | ||||
| 	CLAIM("claim"), | ||||
| 	CLAIM_ONE("claim.one"), | ||||
| 	CLAIM_AUTO("claim.auto"), | ||||
| 	CLAIM_FILL("claim.fill"), | ||||
| 	CLAIM_SQUARE("claim.square"), | ||||
| 	CLAIM_CIRCLE("claim.circle"), | ||||
| 	CLAIM_ALL("claim.all"), | ||||
| 	CREATE("create"), | ||||
| 	DEMOTE("demote"), | ||||
| 	DESCRIPTION("description"), | ||||
| @ -52,17 +59,17 @@ public enum Perm | ||||
| 	RELATION("relation"), | ||||
| 	SEECHUNK("seechunk"), | ||||
| 	SEECHUNKOLD("seechunkold"), | ||||
| 	SET("set"), | ||||
| 	SET_ONE("set.one"), | ||||
| 	SET_AUTO("set.auto"), | ||||
| 	SET_FILL("set.fill"), | ||||
| 	SET_SQUARE("set.square"), | ||||
| 	SET_CIRCLE("set.circle"), | ||||
| 	SET_TRANSFER("set.transfer"), | ||||
| 	SETHOME("sethome"), | ||||
| 	NAME("name"), | ||||
| 	TITLE("title"), | ||||
| 	TITLE_COLOR("title.color"), | ||||
| 	UNCLAIM("unclaim"), | ||||
| 	UNCLAIM_ONE("unclaim.one"), | ||||
| 	UNCLAIM_AUTO("unclaim.auto"), | ||||
| 	UNCLAIM_FILL("unclaim.fill"), | ||||
| 	UNCLAIM_SQUARE("unclaim.square"), | ||||
| 	UNCLAIM_CIRCLE("unclaim.circle"), | ||||
| 	UNCLAIM_ALL("unclaim.all"), | ||||
| 	UNSETHOME("unsethome"), | ||||
| 	VERSION("version"), | ||||
| 	 | ||||
|  | ||||
| @ -25,7 +25,6 @@ public class CmdFactions extends FactionsCommand | ||||
| 	public CmdFactionsName cmdFactionsName = new CmdFactionsName(); | ||||
| 	public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription(); | ||||
| 	public CmdFactionsMotd cmdFactionsMotd = new CmdFactionsMotd(); | ||||
| 	public CmdFactionsSet cmdFactionsSet = new CmdFactionsSet(); | ||||
| 	public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome(); | ||||
| 	public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome(); | ||||
| 	public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite(); | ||||
| @ -36,9 +35,10 @@ public class CmdFactions extends FactionsCommand | ||||
| 	public CmdFactionsOfficer cmdFactionsOfficer = new CmdFactionsOfficer(); | ||||
| 	public CmdFactionsLeader cmdFactionsLeader = new CmdFactionsLeader(); | ||||
| 	public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney(); | ||||
| 	public CmdFactionsXPlaceholder cmdFactionsTax = new CmdFactionsXPlaceholder("FactionsTax", "tax"); | ||||
| 	public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk(); | ||||
| 	public CmdFactionsSeeChunkOld cmdFactionsSeeChunkOld = new CmdFactionsSeeChunkOld(); | ||||
| 	public CmdFactionsClaim cmdFactionsClaim = new CmdFactionsClaim(); | ||||
| 	public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim(); | ||||
| 	public CmdFactionsAccess cmdFactionsAccess = new CmdFactionsAccess(); | ||||
| 	public CmdFactionsRelationAlly cmdFactionsRelationAlly = new CmdFactionsRelationAlly(); | ||||
| 	public CmdFactionsRelationTruce cmdFactionsRelationTruce = new CmdFactionsRelationTruce(); | ||||
| @ -46,10 +46,11 @@ public class CmdFactions extends FactionsCommand | ||||
| 	public CmdFactionsRelationEnemy cmdFactionsRelationEnemy = new CmdFactionsRelationEnemy(); | ||||
| 	public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm(); | ||||
| 	public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag(); | ||||
| 	public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband(); | ||||
| 	public CmdFactionsExpansions cmdFactionsExpansions = new CmdFactionsExpansions(); | ||||
| 	public CmdFactionsXPlaceholder cmdFactionsTax = new CmdFactionsXPlaceholder("FactionsTax", "tax"); | ||||
| 	public CmdFactionsXPlaceholder cmdFactionsDynmap = new CmdFactionsXPlaceholder("FactionsDynmap", "dynmap"); | ||||
| 	public CmdFactionsAdmin cmdFactionsAdmin = new CmdFactionsAdmin(); | ||||
| 	public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband(); | ||||
| 	public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost(); | ||||
| 	public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version"); | ||||
| 	 | ||||
| @ -72,7 +73,6 @@ public class CmdFactions extends FactionsCommand | ||||
| 		this.addSubCommand(this.cmdFactionsName); | ||||
| 		this.addSubCommand(this.cmdFactionsDescription); | ||||
| 		this.addSubCommand(this.cmdFactionsMotd); | ||||
| 		this.addSubCommand(this.cmdFactionsSet); | ||||
| 		this.addSubCommand(this.cmdFactionsSethome); | ||||
| 		this.addSubCommand(this.cmdFactionsUnsethome); | ||||
| 		this.addSubCommand(this.cmdFactionsInvite); | ||||
| @ -83,9 +83,10 @@ public class CmdFactions extends FactionsCommand | ||||
| 		this.addSubCommand(this.cmdFactionsOfficer); | ||||
| 		this.addSubCommand(this.cmdFactionsLeader); | ||||
| 		this.addSubCommand(this.cmdFactionsMoney); | ||||
| 		this.addSubCommand(this.cmdFactionsTax); | ||||
| 		this.addSubCommand(this.cmdFactionsSeeChunk); | ||||
| 		this.addSubCommand(this.cmdFactionsSeeChunkOld); | ||||
| 		this.addSubCommand(this.cmdFactionsClaim); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaim); | ||||
| 		this.addSubCommand(this.cmdFactionsAccess); | ||||
| 		this.addSubCommand(this.cmdFactionsRelationAlly); | ||||
| 		this.addSubCommand(this.cmdFactionsRelationTruce); | ||||
| @ -93,18 +94,17 @@ public class CmdFactions extends FactionsCommand | ||||
| 		this.addSubCommand(this.cmdFactionsRelationEnemy); | ||||
| 		this.addSubCommand(this.cmdFactionsPerm); | ||||
| 		this.addSubCommand(this.cmdFactionsFlag); | ||||
| 		this.addSubCommand(this.cmdFactionsDisband); | ||||
| 		this.addSubCommand(this.cmdFactionsExpansions); | ||||
| 		this.addSubCommand(this.cmdFactionsTax); | ||||
| 		this.addSubCommand(this.cmdFactionsDynmap); | ||||
| 		this.addSubCommand(this.cmdFactionsAdmin); | ||||
| 		this.addSubCommand(this.cmdFactionsDisband); | ||||
| 		this.addSubCommand(this.cmdFactionsPowerBoost); | ||||
| 		this.addSubCommand(this.cmdFactionsVersion); | ||||
| 		 | ||||
| 		// Deprecated Commands | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsSet, "claim")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsSet, "unclaim")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsSet, "autoclaim")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsSet, "unclaimall")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsClaim.cmdFactionsClaimAuto, "autoclaim")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsUnclaim.cmdFactionsUnclaimAll, "unclaimall")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsFlag, "open")); | ||||
| 		this.addSubCommand(new CmdFactionsXDeprecated(this.cmdFactionsFaction, "show", "who")); | ||||
| 	} | ||||
|  | ||||
| @ -0,0 +1,41 @@ | ||||
| package com.massivecraft.factions.cmd; | ||||
| 
 | ||||
| import com.massivecraft.factions.Perm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqHasPerm; | ||||
| 
 | ||||
| 
 | ||||
| public class CmdFactionsClaim extends FactionsCommand | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// FIELDS | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetOne cmdFactionsClaimOne = new CmdFactionsSetOne(true); | ||||
| 	public CmdFactionsSetAuto cmdFactionsClaimAuto = new CmdFactionsSetAuto(true); | ||||
| 	public CmdFactionsSetFill cmdFactionsClaimFill = new CmdFactionsSetFill(true); | ||||
| 	public CmdFactionsSetSquare cmdFactionsClaimSquare = new CmdFactionsSetSquare(true); | ||||
| 	public CmdFactionsSetCircle cmdFactionsClaimCircle = new CmdFactionsSetCircle(true); | ||||
| 	public CmdFactionsSetAll cmdFactionsClaimAll = new CmdFactionsSetAll(true); | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsClaim() | ||||
| 	{ | ||||
| 		// Aliases | ||||
| 		this.addAliases("claim"); | ||||
| 		 | ||||
| 		// Add SubCommands | ||||
| 		this.addSubCommand(this.cmdFactionsClaimOne); | ||||
| 		this.addSubCommand(this.cmdFactionsClaimAuto); | ||||
| 		this.addSubCommand(this.cmdFactionsClaimFill); | ||||
| 		this.addSubCommand(this.cmdFactionsClaimSquare); | ||||
| 		this.addSubCommand(this.cmdFactionsClaimCircle); | ||||
| 		this.addSubCommand(this.cmdFactionsClaimAll); | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.CLAIM.node)); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @ -1,45 +0,0 @@ | ||||
| package com.massivecraft.factions.cmd; | ||||
| 
 | ||||
| import com.massivecraft.factions.Perm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqHasPerm; | ||||
| 
 | ||||
| 
 | ||||
| public class CmdFactionsSet extends FactionsCommand | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// FIELDS | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetOne cmdFactionsSetOne = new CmdFactionsSetOne(); | ||||
| 	public CmdFactionsSetAuto cmdFactionsSetAuto = new CmdFactionsSetAuto(); | ||||
| 	public CmdFactionsSetFill cmdFactionsSetFill = new CmdFactionsSetFill(); | ||||
| 	public CmdFactionsSetSquare cmdFactionsSetSquare = new CmdFactionsSetSquare(); | ||||
| 	public CmdFactionsSetCircle cmdFactionsSetCircle = new CmdFactionsSetCircle(); | ||||
| 	public CmdFactionsSetTransfer cmdFactionsSetTransfer = new CmdFactionsSetTransfer(); | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSet() | ||||
| 	{ | ||||
| 		// Aliases | ||||
| 		this.addAliases("s", "set"); | ||||
| 		 | ||||
| 		// Add SubCommands | ||||
| 		this.addSubCommand(this.cmdFactionsSetOne); | ||||
| 		this.addSubCommand(this.cmdFactionsSetAuto); | ||||
| 		this.addSubCommand(this.cmdFactionsSetFill); | ||||
| 		this.addSubCommand(this.cmdFactionsSetSquare); | ||||
| 		this.addSubCommand(this.cmdFactionsSetCircle); | ||||
| 		this.addSubCommand(this.cmdFactionsSetTransfer); | ||||
| 
 | ||||
| 		this.setHelp("Tip: Set faction <h>none <i>to unclaim."); | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET.node)); | ||||
| 	} | ||||
| 	 | ||||
| 	 | ||||
| 	 | ||||
| } | ||||
| @ -8,24 +8,30 @@ import com.massivecraft.factions.entity.BoardColl; | ||||
| import com.massivecraft.factions.entity.Faction; | ||||
| import com.massivecraft.massivecore.cmd.arg.ARWorldId; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqHasPerm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; | ||||
| import com.massivecraft.massivecore.mixin.Mixin; | ||||
| import com.massivecraft.massivecore.ps.PS; | ||||
| import com.massivecraft.massivecore.util.MUtil; | ||||
| 
 | ||||
| 
 | ||||
| public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer | ||||
| public class CmdFactionsSetAll extends CmdFactionsSetXAll | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetTransfer() | ||||
| 	public CmdFactionsSetAll(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("t", "transfer"); | ||||
| 
 | ||||
| 		this.addAliases("all"); | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_TRANSFER.node)); | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		String node = claim ? Perm.CLAIM_ALL.node : Perm.UNCLAIM_ALL.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node)); | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
| @ -35,6 +41,9 @@ public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer | ||||
| 	@Override | ||||
| 	public Set<PS> getChunks() | ||||
| 	{ | ||||
| 		// World | ||||
| 		String word = (this.isClaim() ? "claim" : "unclaim"); | ||||
| 		 | ||||
| 		// Create Ret | ||||
| 		Set<PS> chunks = null; | ||||
| 		 | ||||
| @ -45,8 +54,8 @@ public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer | ||||
| 		if (MUtil.list("a", "al", "all").contains(this.arg(0).toLowerCase())) | ||||
| 		{ | ||||
| 			chunks = BoardColl.get().getChunks(oldFaction); | ||||
| 			this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using transfer all."); | ||||
| 			this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using transfer all."); | ||||
| 			this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using " + word + " all."); | ||||
| 			this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using " + word + " all."); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| @ -71,9 +80,8 @@ public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer | ||||
| 			Board board = BoardColl.get().get(worldId); | ||||
| 			chunks = board.getChunks(oldFaction); | ||||
| 			String worldDisplayName = Mixin.getWorldDisplayName(worldId); | ||||
| 			this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using transfer <h>" + worldDisplayName + "<i>."); | ||||
| 			this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using transfer <h>" + worldDisplayName + "<i>."); | ||||
| 			 | ||||
| 			this.setFormatOne("<h>%s<i> %s <h>%d <i>chunk using " + word + " <h>" + worldDisplayName + "<i>."); | ||||
| 			this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using " + word + " <h>" + worldDisplayName + "<i>."); | ||||
| 		} | ||||
| 		 | ||||
| 		// Return Ret | ||||
| @ -6,6 +6,7 @@ import java.util.Set; | ||||
| import com.massivecraft.factions.Perm; | ||||
| import com.massivecraft.factions.cmd.arg.ARFaction; | ||||
| import com.massivecraft.factions.entity.Faction; | ||||
| import com.massivecraft.factions.entity.FactionColl; | ||||
| import com.massivecraft.factions.entity.MPerm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqHasPerm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqIsPlayer; | ||||
| @ -14,21 +15,36 @@ import com.massivecraft.massivecore.ps.PS; | ||||
| 
 | ||||
| public class CmdFactionsSetAuto extends FactionsCommand | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// FIELDS | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	private boolean claim = true; | ||||
| 	public boolean isClaim() { return this.claim; } | ||||
| 	public void setClaim(boolean claim) { this.claim = claim; } | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetAuto() | ||||
| 	public CmdFactionsSetAuto(boolean claim) | ||||
| 	{ | ||||
| 		// Fields | ||||
| 		this.setClaim(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("a", "auto"); | ||||
| 
 | ||||
| 		// Args | ||||
| 		this.addOptionalArg("faction", "you"); | ||||
| 		if (claim) | ||||
| 		{ | ||||
| 			this.addOptionalArg("faction", "you"); | ||||
| 		} | ||||
| 
 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_AUTO.node)); | ||||
| 		String node = claim ? Perm.CLAIM_AUTO.node : Perm.UNCLAIM_AUTO.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node)); | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
| @ -39,7 +55,15 @@ public class CmdFactionsSetAuto extends FactionsCommand | ||||
| 	public void perform() | ||||
| 	{	 | ||||
| 		// Args | ||||
| 		final Faction newFaction = this.arg(0, ARFaction.get(), msenderFaction); | ||||
| 		final Faction newFaction; | ||||
| 		if (claim) | ||||
| 		{ | ||||
| 			newFaction = this.arg(0, ARFaction.get(), msenderFaction); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			newFaction = FactionColl.get().getNone(); | ||||
| 		} | ||||
| 		 | ||||
| 		// Disable? | ||||
| 		if (newFaction == null || newFaction == msender.getAutoClaimFaction()) | ||||
|  | ||||
| @ -15,8 +15,11 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetCircle() | ||||
| 	public CmdFactionsSetCircle(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("c", "circle"); | ||||
| 
 | ||||
| @ -26,7 +29,8 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_CIRCLE.node)); | ||||
| 		String node = claim ? Perm.CLAIM_CIRCLE.node : Perm.UNCLAIM_CIRCLE.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node)); | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
|  | ||||
| @ -19,8 +19,11 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetFill() | ||||
| 	public CmdFactionsSetFill(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("f", "fill"); | ||||
| 
 | ||||
| @ -30,7 +33,8 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_FILL.node)); | ||||
| 		String node = claim ? Perm.CLAIM_FILL.node : Perm.UNCLAIM_FILL.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node)); | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
|  | ||||
| @ -15,14 +15,18 @@ public class CmdFactionsSetOne extends CmdFactionsSetXSimple | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetOne() | ||||
| 	public CmdFactionsSetOne(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("o", "one"); | ||||
| 
 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_ONE.node)); | ||||
| 		String node = claim ? Perm.CLAIM_ONE.node : Perm.UNCLAIM_ONE.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node)); | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
|  | ||||
| @ -15,8 +15,11 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetSquare() | ||||
| 	public CmdFactionsSetSquare(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Aliases | ||||
| 		this.addAliases("s", "square"); | ||||
| 
 | ||||
| @ -26,7 +29,8 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqIsPlayer.get()); | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.SET_SQUARE.node)); | ||||
| 		String node = claim ? Perm.CLAIM_SQUARE.node : Perm.UNCLAIM_SQUARE.node; | ||||
| 		this.addRequirements(ReqHasPerm.get(node));		 | ||||
| 	} | ||||
| 
 | ||||
| 	// -------------------------------------------- // | ||||
|  | ||||
| @ -4,6 +4,7 @@ import java.util.Set; | ||||
| 
 | ||||
| import com.massivecraft.factions.cmd.arg.ARFaction; | ||||
| import com.massivecraft.factions.entity.Faction; | ||||
| import com.massivecraft.factions.entity.FactionColl; | ||||
| import com.massivecraft.massivecore.ps.PS; | ||||
| 
 | ||||
| 
 | ||||
| @ -21,6 +22,23 @@ public abstract class CmdFactionsSetX extends FactionsCommand | ||||
| 	public String getFormatMany() { return this.formatMany; } | ||||
| 	public void setFormatMany(String formatMany) { this.formatMany = formatMany; } | ||||
| 	 | ||||
| 	private boolean claim = true; | ||||
| 	public boolean isClaim() { return this.claim; } | ||||
| 	public void setClaim(boolean claim) { this.claim = claim; } | ||||
| 	 | ||||
| 	private int factionArgIndex = 0; | ||||
| 	public int getFactionArgIndex() { return this.factionArgIndex; } | ||||
| 	public void setFactionArgIndex(int factionArgIndex) { this.factionArgIndex = factionArgIndex; } | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetX(boolean claim) | ||||
| 	{ | ||||
| 		this.setClaim(claim); | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| @ -43,8 +61,6 @@ public abstract class CmdFactionsSetX extends FactionsCommand | ||||
| 	// ABSTRACT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public abstract int getFactionArgIndex(); | ||||
| 	 | ||||
| 	public abstract Set<PS> getChunks(); | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| @ -53,7 +69,14 @@ public abstract class CmdFactionsSetX extends FactionsCommand | ||||
| 	 | ||||
| 	public Faction getNewFaction() | ||||
| 	{ | ||||
| 		return this.arg(this.getFactionArgIndex(), ARFaction.get(), msenderFaction); | ||||
| 		if (this.isClaim()) | ||||
| 		{ | ||||
| 			return this.arg(this.getFactionArgIndex(), ARFaction.get(), msenderFaction); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			return FactionColl.get().getNone(); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
|  | ||||
| @ -3,28 +3,25 @@ package com.massivecraft.factions.cmd; | ||||
| import com.massivecraft.factions.cmd.arg.ARFaction; | ||||
| import com.massivecraft.factions.entity.Faction; | ||||
| 
 | ||||
| public abstract class CmdFactionsSetXTransfer extends CmdFactionsSetX | ||||
| public abstract class CmdFactionsSetXAll extends CmdFactionsSetX | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetXTransfer() | ||||
| 	public CmdFactionsSetXAll(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Args | ||||
| 		this.addRequiredArg("all|map"); | ||||
| 		this.addRequiredArg("old"); | ||||
| 		this.addRequiredArg("new"); | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	@Override | ||||
| 	public int getFactionArgIndex() | ||||
| 	{ | ||||
| 		return 2; | ||||
| 		this.addRequiredArg("faction"); | ||||
| 		if (claim) | ||||
| 		{ | ||||
| 			this.addRequiredArg("newfaction"); | ||||
| 			this.setFactionArgIndex(2); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| @ -10,21 +10,18 @@ public abstract class CmdFactionsSetXRadius extends CmdFactionsSetX | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetXRadius() | ||||
| 	public CmdFactionsSetXRadius(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Args | ||||
| 		this.addOptionalArg("radius", "1"); | ||||
| 		this.addOptionalArg("faction", "you"); | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 
 | ||||
| 	@Override | ||||
| 	public int getFactionArgIndex() | ||||
| 	{ | ||||
| 		return 1; | ||||
| 		if (claim) | ||||
| 		{ | ||||
| 			this.addOptionalArg("faction", "you"); | ||||
| 			this.setFactionArgIndex(1); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
|  | ||||
| @ -6,20 +6,17 @@ public abstract class CmdFactionsSetXSimple extends CmdFactionsSetX | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetXSimple() | ||||
| 	public CmdFactionsSetXSimple(boolean claim) | ||||
| 	{ | ||||
| 		// Super | ||||
| 		super(claim); | ||||
| 		 | ||||
| 		// Args | ||||
| 		this.addOptionalArg("faction", "you"); | ||||
| 	} | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// OVERRIDE | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	@Override | ||||
| 	public int getFactionArgIndex() | ||||
| 	{ | ||||
| 		return 0; | ||||
| 		if (claim) | ||||
| 		{ | ||||
| 			this.addOptionalArg("faction", "you"); | ||||
| 			this.setFactionArgIndex(0); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
|  | ||||
| @ -0,0 +1,41 @@ | ||||
| package com.massivecraft.factions.cmd; | ||||
| 
 | ||||
| import com.massivecraft.factions.Perm; | ||||
| import com.massivecraft.massivecore.cmd.req.ReqHasPerm; | ||||
| 
 | ||||
| 
 | ||||
| public class CmdFactionsUnclaim extends FactionsCommand | ||||
| { | ||||
| 	// -------------------------------------------- // | ||||
| 	// FIELDS | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsSetOne cmdFactionsUnclaimOne = new CmdFactionsSetOne(false); | ||||
| 	public CmdFactionsSetAuto cmdFactionsUnclaimAuto = new CmdFactionsSetAuto(false); | ||||
| 	public CmdFactionsSetFill cmdFactionsUnclaimFill = new CmdFactionsSetFill(false); | ||||
| 	public CmdFactionsSetSquare cmdFactionsUnclaimSquare = new CmdFactionsSetSquare(false); | ||||
| 	public CmdFactionsSetCircle cmdFactionsUnclaimCircle = new CmdFactionsSetCircle(false); | ||||
| 	public CmdFactionsSetAll cmdFactionsUnclaimAll = new CmdFactionsSetAll(false); | ||||
| 	 | ||||
| 	// -------------------------------------------- // | ||||
| 	// CONSTRUCT | ||||
| 	// -------------------------------------------- // | ||||
| 	 | ||||
| 	public CmdFactionsUnclaim() | ||||
| 	{ | ||||
| 		// Aliases | ||||
| 		this.addAliases("unclaim"); | ||||
| 		 | ||||
| 		// Add SubCommands | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimOne); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimAuto); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimFill); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimSquare); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimCircle); | ||||
| 		this.addSubCommand(this.cmdFactionsUnclaimAll); | ||||
| 		 | ||||
| 		// Requirements | ||||
| 		this.addRequirements(ReqHasPerm.get(Perm.UNCLAIM.node)); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @ -15,6 +15,13 @@ permissions: | ||||
|   factions.access.player: {description: grant player access, with the proper fperm, default: false} | ||||
|   factions.access.view: {description: view access, default: false} | ||||
|   factions.admin: {description: enable adminmode, default: false} | ||||
|   factions.claim: {description: claim faction territory, default: false} | ||||
|   factions.claim.one: {description: claim a single chunk, default: false} | ||||
|   factions.claim.auto: {description: claim as you walk around, default: false} | ||||
|   factions.claim.fill: {description: claim by filling, default: false} | ||||
|   factions.claim.square: {description: claim by square and radius, default: false} | ||||
|   factions.claim.circle: {description: claim by circle and radius, default: false} | ||||
|   factions.claim.all: {description: claim all faction land, default: false} | ||||
|   factions.create: {description: create new faction, default: false} | ||||
|   factions.demote: {description: demote lesser members in your faction, default: false} | ||||
|   factions.description: {description: change faction description, default: false} | ||||
| @ -52,17 +59,17 @@ permissions: | ||||
|   factions.relation: {description: set relation wish to another faction, default: false} | ||||
|   factions.seechunk: {description: see the chunk you stand in, default: false} | ||||
|   factions.seechunkold: {description: see the chunk you stand in, default: false} | ||||
|   factions.set: {description: set faction territory, default: false} | ||||
|   factions.set.one: {description: set faction for a single chunk, default: false} | ||||
|   factions.set.auto: {description: set faction as you walk around, default: false} | ||||
|   factions.set.fill: {description: set faction by filling, default: false} | ||||
|   factions.set.square: {description: set faction by square and radius, default: false} | ||||
|   factions.set.circle: {description: set faction by circle and radius, default: false} | ||||
|   factions.set.transfer: {description: set faction by transfer, default: false} | ||||
|   factions.sethome: {description: set the faction home, default: false} | ||||
|   factions.name: {description: set faction name, default: false} | ||||
|   factions.title: {description: set player title, default: false} | ||||
|   factions.title.color: {description: set player title with color, default: false} | ||||
|   factions.unclaim: {description: unclaim faction territory, default: false} | ||||
|   factions.unclaim.one: {description: unclaim a single chunk, default: false} | ||||
|   factions.unclaim.auto: {description: unclaim as you walk around, default: false} | ||||
|   factions.unclaim.fill: {description: unclaim by filling, default: false} | ||||
|   factions.unclaim.square: {description: unclaim by square and radius, default: false} | ||||
|   factions.unclaim.circle: {description: unclaim by circle and radius, default: false} | ||||
|   factions.unclaim.all: {description: unclaim all faction land, default: false} | ||||
|   factions.unsethome: {description: unset faction home, default: false} | ||||
|   factions.version: {description: see plugin version, default: false} | ||||
| # -------------------------------------------- # | ||||
| @ -75,6 +82,13 @@ permissions: | ||||
|       factions.access.player: true | ||||
|       factions.access.view: true | ||||
|       factions.admin: true | ||||
|       factions.claim: true | ||||
|       factions.claim.one: true | ||||
|       factions.claim.auto: true | ||||
|       factions.claim.fill: true | ||||
|       factions.claim.square: true | ||||
|       factions.claim.circle: true | ||||
|       factions.claim.all: true | ||||
|       factions.create: true | ||||
|       factions.demote: true | ||||
|       factions.description: true | ||||
| @ -112,17 +126,17 @@ permissions: | ||||
|       factions.relation: true | ||||
|       factions.seechunk: true | ||||
|       factions.seechunkold: true | ||||
|       factions.set: true | ||||
|       factions.set.one: true | ||||
|       factions.set.auto: true | ||||
|       factions.set.fill: true | ||||
|       factions.set.square: true | ||||
|       factions.set.circle: true | ||||
|       factions.set.transfer: true | ||||
|       factions.sethome: true | ||||
|       factions.name: true | ||||
|       factions.title: true | ||||
|       factions.title.color: true | ||||
|       factions.unclaim: true | ||||
|       factions.unclaim.one: true | ||||
|       factions.unclaim.auto: true | ||||
|       factions.unclaim.fill: true | ||||
|       factions.unclaim.square: true | ||||
|       factions.unclaim.circle: true | ||||
|       factions.unclaim.all: true | ||||
|       factions.unsethome: true | ||||
|       factions.version: true | ||||
| # -------------------------------------------- # | ||||
| @ -158,6 +172,13 @@ permissions: | ||||
|       factions.access.faction: true | ||||
|       factions.access.player: true | ||||
|       factions.access.view: true | ||||
|       factions.claim: true | ||||
|       factions.claim.one: true | ||||
|       factions.claim.auto: true | ||||
|       factions.claim.fill: true | ||||
|       factions.claim.square: true | ||||
|       factions.claim.circle: true | ||||
|       factions.claim.all: true | ||||
|       factions.create: true | ||||
|       factions.demote: true | ||||
|       factions.description: true | ||||
| @ -190,17 +211,17 @@ permissions: | ||||
|       factions.relation: true | ||||
|       factions.seechunk: true | ||||
|       factions.seechunkold: true | ||||
|       factions.set: true | ||||
|       factions.set.one: true | ||||
|       factions.set.auto: true | ||||
|       factions.set.fill: true | ||||
|       factions.set.square: true | ||||
|       factions.set.circle: true | ||||
|       factions.set.transfer: true | ||||
|       factions.sethome: true | ||||
|       factions.name: true | ||||
|       factions.title: true | ||||
|       factions.title.color: true | ||||
|       factions.unclaim: true | ||||
|       factions.unclaim.one: true | ||||
|       factions.unclaim.auto: true | ||||
|       factions.unclaim.fill: true | ||||
|       factions.unclaim.square: true | ||||
|       factions.unclaim.circle: true | ||||
|       factions.unclaim.all: true | ||||
|       factions.unsethome: true | ||||
|       factions.version: true | ||||
|   factions.kit.default: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user