Improve the Faction home system.
This commit is contained in:
		@@ -26,6 +26,7 @@ public enum Perm
 | 
				
			|||||||
	FLAG("flag"),
 | 
						FLAG("flag"),
 | 
				
			||||||
	FLAG_SET("flag.set"),
 | 
						FLAG_SET("flag.set"),
 | 
				
			||||||
	HOME("home"),
 | 
						HOME("home"),
 | 
				
			||||||
 | 
						HOME_OTHER("home.other"),
 | 
				
			||||||
	INVITE("invite"),
 | 
						INVITE("invite"),
 | 
				
			||||||
	JOIN("join"),
 | 
						JOIN("join"),
 | 
				
			||||||
	JOIN_ANY("join.any"),
 | 
						JOIN_ANY("join.any"),
 | 
				
			||||||
@@ -59,6 +60,8 @@ public enum Perm
 | 
				
			|||||||
	TITLE_COLOR("title.color"),
 | 
						TITLE_COLOR("title.color"),
 | 
				
			||||||
	UNCLAIM("unclaim"),
 | 
						UNCLAIM("unclaim"),
 | 
				
			||||||
	UNCLAIM_ALL("unclaimall"),
 | 
						UNCLAIM_ALL("unclaimall"),
 | 
				
			||||||
 | 
						UNSETHOME("unsethome"),
 | 
				
			||||||
 | 
						UNSETHOME_OTHER("unsethome.other"),
 | 
				
			||||||
	VERSION("version"),
 | 
						VERSION("version"),
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// END OF LIST
 | 
						// END OF LIST
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import com.massivecraft.factions.entity.MConf;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.HelpCommand;
 | 
					import com.massivecraft.massivecore.cmd.HelpCommand;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.VersionCommand;
 | 
					import com.massivecraft.massivecore.cmd.VersionCommand;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactions extends FCommand
 | 
					public class CmdFactions extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// FIELDS
 | 
						// FIELDS
 | 
				
			||||||
@@ -25,6 +25,7 @@ public class CmdFactions extends FCommand
 | 
				
			|||||||
	public CmdFactionsName cmdFactionsName = new CmdFactionsName();
 | 
						public CmdFactionsName cmdFactionsName = new CmdFactionsName();
 | 
				
			||||||
	public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
 | 
						public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
 | 
				
			||||||
	public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
 | 
						public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
 | 
				
			||||||
 | 
						public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome();
 | 
				
			||||||
	public CmdFactionsOpen cmdFactionsOpen = new CmdFactionsOpen();
 | 
						public CmdFactionsOpen cmdFactionsOpen = new CmdFactionsOpen();
 | 
				
			||||||
	public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
 | 
						public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
 | 
				
			||||||
	public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
 | 
						public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
 | 
				
			||||||
@@ -57,7 +58,7 @@ public class CmdFactions extends FCommand
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public CmdFactions()
 | 
						public CmdFactions()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Add SubCommands
 | 
							// SubCommands
 | 
				
			||||||
		this.addSubCommand(HelpCommand.get());
 | 
							this.addSubCommand(HelpCommand.get());
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsList);
 | 
							this.addSubCommand(this.cmdFactionsList);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsFaction);
 | 
							this.addSubCommand(this.cmdFactionsFaction);
 | 
				
			||||||
@@ -70,6 +71,7 @@ public class CmdFactions extends FCommand
 | 
				
			|||||||
		this.addSubCommand(this.cmdFactionsName);
 | 
							this.addSubCommand(this.cmdFactionsName);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsDescription);
 | 
							this.addSubCommand(this.cmdFactionsDescription);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsSethome);
 | 
							this.addSubCommand(this.cmdFactionsSethome);
 | 
				
			||||||
 | 
							this.addSubCommand(this.cmdFactionsUnsethome);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsOpen);
 | 
							this.addSubCommand(this.cmdFactionsOpen);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsInvite);
 | 
							this.addSubCommand(this.cmdFactionsInvite);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsKick);
 | 
							this.addSubCommand(this.cmdFactionsKick);
 | 
				
			||||||
@@ -95,10 +97,6 @@ public class CmdFactions extends FCommand
 | 
				
			|||||||
		this.addSubCommand(this.cmdFactionsAdmin);
 | 
							this.addSubCommand(this.cmdFactionsAdmin);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsPowerBoost);
 | 
							this.addSubCommand(this.cmdFactionsPowerBoost);
 | 
				
			||||||
		this.addSubCommand(this.cmdFactionsVersion);
 | 
							this.addSubCommand(this.cmdFactionsVersion);
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// Misc
 | 
					 | 
				
			||||||
		this.setDesc("The faction base command");
 | 
					 | 
				
			||||||
		this.setHelp("This command contains all faction stuff.");
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsAccess extends FCommand
 | 
					public class CmdFactionsAccess extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// FIELDS
 | 
						// FIELDS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
 | 
				
			|||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public abstract class CmdFactionsAccessAbstract extends FCommand
 | 
					public abstract class CmdFactionsAccessAbstract extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// FIELDS
 | 
						// FIELDS
 | 
				
			||||||
@@ -53,10 +53,10 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
 | 
				
			|||||||
	public void sendAccessInfo()
 | 
						public void sendAccessInfo()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
 | 
							sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
 | 
				
			||||||
		msg("<k>Host Faction: %s", hostFaction.describeTo(usender, true));
 | 
							msg("<k>Host Faction: %s", hostFaction.describeTo(msender, true));
 | 
				
			||||||
		msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
 | 
							msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
 | 
				
			||||||
		msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), usender));
 | 
							msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), msender));
 | 
				
			||||||
		msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), usender));
 | 
							msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), msender));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
 | 
						public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
 | 
				
			|||||||
		if (newValue == null) return;
 | 
							if (newValue == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
 | 
							if (!FPerm.ACCESS.has(msender, hostFaction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		ta = ta.withFactionId(faction.getId(), newValue);
 | 
							ta = ta.withFactionId(faction.getId(), newValue);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
 | 
				
			|||||||
		if (newValue == null) return;
 | 
							if (newValue == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
 | 
							if (!FPerm.ACCESS.has(msender, hostFaction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		ta = ta.withPlayerId(mplayer.getId(), newValue);
 | 
							ta = ta.withPlayerId(mplayer.getId(), newValue);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import com.massivecraft.factions.Perm;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
					import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsAdmin extends FCommand
 | 
					public class CmdFactionsAdmin extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsAutoClaim extends FCommand
 | 
					public class CmdFactionsAutoClaim extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -35,22 +35,22 @@ public class CmdFactionsAutoClaim extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{	
 | 
						{	
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Faction forFaction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction forFaction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (forFaction == null || forFaction == usender.getAutoClaimFaction())
 | 
							if (forFaction == null || forFaction == msender.getAutoClaimFaction())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.setAutoClaimFaction(null);
 | 
								msender.setAutoClaimFaction(null);
 | 
				
			||||||
			msg("<i>Auto-claiming of land disabled.");
 | 
								msg("<i>Auto-claiming of land disabled.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
 | 
							if (forFaction.isNormal() && !FPerm.TERRITORY.has(msender, forFaction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		usender.setAutoClaimFaction(forFaction);
 | 
							msender.setAutoClaimFaction(forFaction);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(usender));
 | 
							msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(msender));
 | 
				
			||||||
		usender.tryClaim(forFaction, PS.valueOf(me), true, true);
 | 
							msender.tryClaim(forFaction, PS.valueOf(me), true, true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			|||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsClaim extends FCommand
 | 
					public class CmdFactionsClaim extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -43,11 +43,11 @@ public class CmdFactionsClaim extends FCommand
 | 
				
			|||||||
		Integer radius = this.arg(0, ARInteger.get(), 1);
 | 
							Integer radius = this.arg(0, ARInteger.get(), 1);
 | 
				
			||||||
		if (radius == null) return;
 | 
							if (radius == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		final Faction forFaction = this.arg(1, ARFaction.get(), usenderFaction);
 | 
							final Faction forFaction = this.arg(1, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (forFaction == null) return;
 | 
							if (forFaction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
 | 
							if (forFaction.isNormal() && !FPerm.TERRITORY.has(msender, forFaction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Validate
 | 
							// Validate
 | 
				
			||||||
		if (radius < 1)
 | 
							if (radius < 1)
 | 
				
			||||||
@@ -56,7 +56,7 @@ public class CmdFactionsClaim extends FCommand
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (radius > MConf.get().radiusClaimRadiusLimit && !usender.isUsingAdminMode())
 | 
							if (radius > MConf.get().radiusClaimRadiusLimit && !msender.isUsingAdminMode())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
 | 
								msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -67,7 +67,7 @@ public class CmdFactionsClaim extends FCommand
 | 
				
			|||||||
		// single chunk
 | 
							// single chunk
 | 
				
			||||||
		if (radius < 2)
 | 
							if (radius < 2)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.tryClaim(forFaction, PS.valueOf(me), true, true);
 | 
								msender.tryClaim(forFaction, PS.valueOf(me), true, true);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -91,7 +91,7 @@ public class CmdFactionsClaim extends FCommand
 | 
				
			|||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public boolean work()
 | 
								public boolean work()
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				boolean success = usender.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true);
 | 
									boolean success = msender.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true);
 | 
				
			||||||
				if (success)
 | 
									if (success)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					this.failCount = 0;
 | 
										this.failCount = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.store.MStore;
 | 
					import com.massivecraft.massivecore.store.MStore;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsCreate extends FCommand
 | 
					public class CmdFactionsCreate extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -72,24 +72,24 @@ public class CmdFactionsCreate extends FCommand
 | 
				
			|||||||
		Faction faction = FactionColl.get().create(factionId);
 | 
							Faction faction = FactionColl.get().create(factionId);
 | 
				
			||||||
		faction.setName(newName);
 | 
							faction.setName(newName);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		usender.setRole(Rel.LEADER);
 | 
							msender.setRole(Rel.LEADER);
 | 
				
			||||||
		usender.setFaction(faction);
 | 
							msender.setFaction(faction);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
 | 
							EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, msender, faction, MembershipChangeReason.CREATE);
 | 
				
			||||||
		joinEvent.run();
 | 
							joinEvent.run();
 | 
				
			||||||
		// NOTE: join event cannot be cancelled or you'll have an empty faction
 | 
							// NOTE: join event cannot be cancelled or you'll have an empty faction
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		for (MPlayer follower : MPlayerColl.get().getAllOnline())
 | 
							for (MPlayer follower : MPlayerColl.get().getAllOnline())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			follower.msg("%s<i> created a new faction %s", usender.describeTo(follower, true), faction.getName(follower));
 | 
								follower.msg("%s<i> created a new faction %s", msender.describeTo(follower, true), faction.getName(follower));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
 | 
							msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (MConf.get().logFactionCreate)
 | 
							if (MConf.get().logFactionCreate)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(usender.getName()+" created a new faction: "+newName);
 | 
								Factions.get().log(msender.getName()+" created a new faction: "+newName);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
 | 
				
			|||||||
import com.massivecraft.factions.entity.MPlayer;
 | 
					import com.massivecraft.factions.entity.MPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsDemote extends FCommand
 | 
					public class CmdFactionsDemote extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -38,13 +38,13 @@ public class CmdFactionsDemote extends FCommand
 | 
				
			|||||||
		MPlayer you = this.arg(0, ARMPlayer.getAny());
 | 
							MPlayer you = this.arg(0, ARMPlayer.getAny());
 | 
				
			||||||
		if (you == null) return;
 | 
							if (you == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (you.getFaction() != usenderFaction)
 | 
							if (you.getFaction() != msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
 | 
								msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (you == usender)
 | 
							if (you == msender)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>The target player mustn't be yourself.");
 | 
								msg("<b>The target player mustn't be yourself.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -52,23 +52,23 @@ public class CmdFactionsDemote extends FCommand
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if (you.getRole() == Rel.MEMBER)
 | 
							if (you.getRole() == Rel.MEMBER)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!usender.getRole().isAtLeast(Rel.OFFICER))
 | 
								if (!msender.getRole().isAtLeast(Rel.OFFICER))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("<b>You must be an officer to demote a member to recruit.");
 | 
									msg("<b>You must be an officer to demote a member to recruit.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			you.setRole(Rel.RECRUIT);
 | 
								you.setRole(Rel.RECRUIT);
 | 
				
			||||||
			usenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(usenderFaction, true));
 | 
								msenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(msenderFaction, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (you.getRole() == Rel.OFFICER)
 | 
							else if (you.getRole() == Rel.OFFICER)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!usender.getRole().isAtLeast(Rel.LEADER))
 | 
								if (!msender.getRole().isAtLeast(Rel.LEADER))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("<b>You must be the leader to demote an officer to member.");
 | 
									msg("<b>You must be the leader to demote an officer to member.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			you.setRole(Rel.MEMBER);
 | 
								you.setRole(Rel.MEMBER);
 | 
				
			||||||
			usenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(usenderFaction, true));
 | 
								msenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(msenderFaction, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import com.massivecraft.factions.event.EventFactionsDescriptionChange;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.mixin.Mixin;
 | 
					import com.massivecraft.massivecore.mixin.Mixin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsDescription extends FCommand
 | 
					public class CmdFactionsDescription extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -41,18 +41,18 @@ public class CmdFactionsDescription extends FCommand
 | 
				
			|||||||
		String newDescription = this.argConcatFrom(0);
 | 
							String newDescription = this.argConcatFrom(0);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, usenderFaction, newDescription);
 | 
							EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, msenderFaction, newDescription);
 | 
				
			||||||
		event.run();
 | 
							event.run();
 | 
				
			||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
		newDescription = event.getNewDescription();
 | 
							newDescription = event.getNewDescription();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		usenderFaction.setDescription(newDescription);
 | 
							msenderFaction.setDescription(newDescription);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		for (MPlayer follower : usenderFaction.getMPlayers())
 | 
							for (MPlayer follower : msenderFaction.getMPlayers())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
 | 
								follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getDescription());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.util.IdUtil;
 | 
					import com.massivecraft.massivecore.util.IdUtil;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsDisband extends FCommand
 | 
					public class CmdFactionsDisband extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -43,11 +43,11 @@ public class CmdFactionsDisband extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{	
 | 
						{	
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if ( ! FPerm.DISBAND.has(usender, faction, true)) return;
 | 
							if ( ! FPerm.DISBAND.has(msender, faction, true)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Verify
 | 
							// Verify
 | 
				
			||||||
		if (faction.getFlag(FFlag.PERMANENT))
 | 
							if (faction.getFlag(FFlag.PERMANENT))
 | 
				
			||||||
@@ -73,7 +73,7 @@ public class CmdFactionsDisband extends FCommand
 | 
				
			|||||||
		// Inform all players
 | 
							// Inform all players
 | 
				
			||||||
		for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
 | 
							for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			String who = usender.describeTo(mplayer);
 | 
								String who = msender.describeTo(mplayer);
 | 
				
			||||||
			if (mplayer.getFaction() == faction)
 | 
								if (mplayer.getFaction() == faction)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				mplayer.msg("<h>%s<i> disbanded your faction.", who);
 | 
									mplayer.msg("<h>%s<i> disbanded your faction.", who);
 | 
				
			||||||
@@ -86,7 +86,7 @@ public class CmdFactionsDisband extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		if (MConf.get().logFactionDisband)
 | 
							if (MConf.get().logFactionDisband)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), usender.getDisplayName(IdUtil.getConsole())));
 | 
								Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), msender.getDisplayName(IdUtil.getConsole())));
 | 
				
			||||||
		}		
 | 
							}		
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		faction.detach();
 | 
							faction.detach();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
 | 
				
			|||||||
import com.massivecraft.massivecore.util.TimeUnit;
 | 
					import com.massivecraft.massivecore.util.TimeUnit;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsFaction extends FCommand
 | 
					public class CmdFactionsFaction extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -49,7 +49,7 @@ public class CmdFactionsFaction extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Data precalculation 
 | 
							// Data precalculation 
 | 
				
			||||||
@@ -57,7 +57,7 @@ public class CmdFactionsFaction extends FCommand
 | 
				
			|||||||
		boolean normal = faction.isNormal();
 | 
							boolean normal = faction.isNormal();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// INFO: Title
 | 
							// INFO: Title
 | 
				
			||||||
		msg(Txt.titleize("Faction " + faction.getName(usender)));
 | 
							msg(Txt.titleize("Faction " + faction.getName(msender)));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// INFO: Description
 | 
							// INFO: Description
 | 
				
			||||||
		msg("<a>Description: <i>%s", faction.getDescription());	
 | 
							msg("<a>Description: <i>%s", faction.getDescription());	
 | 
				
			||||||
@@ -127,7 +127,7 @@ public class CmdFactionsFaction extends FCommand
 | 
				
			|||||||
		String sepparator = Txt.parse("<i>")+", ";
 | 
							String sepparator = Txt.parse("<i>")+", ";
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// List the relations to other factions
 | 
							// List the relations to other factions
 | 
				
			||||||
		Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(usender, true);
 | 
							Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(msender, true);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (faction.getFlag(FFlag.PEACEFUL))
 | 
							if (faction.getFlag(FFlag.PEACEFUL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -152,12 +152,12 @@ public class CmdFactionsFaction extends FCommand
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			if (follower.isOnline() && Mixin.canSee(sender, follower.getId()))
 | 
								if (follower.isOnline() && Mixin.canSee(sender, follower.getId()))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				followerNamesOnline.add(follower.getNameAndTitle(usender));
 | 
									followerNamesOnline.add(follower.getNameAndTitle(msender));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (normal)
 | 
								else if (normal)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				// For the non-faction we skip the offline members since they are far to many (infinate almost)
 | 
									// For the non-faction we skip the offline members since they are far to many (infinate almost)
 | 
				
			||||||
				followerNamesOffline.add(follower.getNameAndTitle(usender));
 | 
									followerNamesOffline.add(follower.getNameAndTitle(msender));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsFlag extends FCommand
 | 
					public class CmdFactionsFlag extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -36,12 +36,12 @@ public class CmdFactionsFlag extends FCommand
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{	
 | 
						{	
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( ! this.argIsSet(1))
 | 
							if ( ! this.argIsSet(1))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg(Txt.titleize("Flags for " + faction.describeTo(usender, true)));
 | 
								msg(Txt.titleize("Flags for " + faction.describeTo(msender, true)));
 | 
				
			||||||
			for (FFlag flag : FFlag.values())
 | 
								for (FFlag flag : FFlag.values())
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
									msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
				
			||||||
@@ -54,7 +54,7 @@ public class CmdFactionsFlag extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		if ( ! this.argIsSet(2))
 | 
							if ( ! this.argIsSet(2))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
 | 
								msg(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
 | 
				
			||||||
			msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
								msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -66,7 +66,7 @@ public class CmdFactionsFlag extends FCommand
 | 
				
			|||||||
		if ( ! Perm.FLAG_SET.has(sender, true)) return;
 | 
							if ( ! Perm.FLAG_SET.has(sender, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Do the change
 | 
							// Do the change
 | 
				
			||||||
		msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
 | 
							msg(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
 | 
				
			||||||
		faction.setFlag(flag, targetValue);
 | 
							faction.setFlag(flag, targetValue);
 | 
				
			||||||
		msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
							msg(flag.getStateInfo(faction.getFlag(flag), true));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,10 +5,11 @@ import org.bukkit.World;
 | 
				
			|||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.massivecraft.factions.FFlag;
 | 
					import com.massivecraft.factions.FFlag;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.FPerm;
 | 
				
			||||||
import com.massivecraft.factions.Factions;
 | 
					import com.massivecraft.factions.Factions;
 | 
				
			||||||
import com.massivecraft.factions.Perm;
 | 
					import com.massivecraft.factions.Perm;
 | 
				
			||||||
import com.massivecraft.factions.Rel;
 | 
					import com.massivecraft.factions.Rel;
 | 
				
			||||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
 | 
					import com.massivecraft.factions.cmd.arg.ARFaction;
 | 
				
			||||||
import com.massivecraft.factions.entity.BoardColl;
 | 
					import com.massivecraft.factions.entity.BoardColl;
 | 
				
			||||||
import com.massivecraft.factions.entity.MConf;
 | 
					import com.massivecraft.factions.entity.MConf;
 | 
				
			||||||
import com.massivecraft.factions.entity.MPlayer;
 | 
					import com.massivecraft.factions.entity.MPlayer;
 | 
				
			||||||
@@ -21,7 +22,7 @@ import com.massivecraft.massivecore.mixin.TeleporterException;
 | 
				
			|||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsHome extends FCommand
 | 
					public class CmdFactionsHome extends FactionsCommandHome
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -32,9 +33,11 @@ public class CmdFactionsHome extends FCommand
 | 
				
			|||||||
		// Aliases
 | 
							// Aliases
 | 
				
			||||||
		this.addAliases("home");
 | 
							this.addAliases("home");
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							// Args
 | 
				
			||||||
 | 
							this.addOptionalArg("faction", "you");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Requirements
 | 
							// Requirements
 | 
				
			||||||
		this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
 | 
							this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
 | 
				
			||||||
		this.addRequirements(ReqHasFaction.get());
 | 
					 | 
				
			||||||
		this.addRequirements(ReqIsPlayer.get());
 | 
							this.addRequirements(ReqIsPlayer.get());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -45,64 +48,73 @@ public class CmdFactionsHome extends FCommand
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// TODO: Hide this command on help also.
 | 
					 | 
				
			||||||
		if ( ! MConf.get().homesEnabled)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			usender.msg("<b>Sorry, Faction homes are disabled on this server.");
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if ( ! MConf.get().homesTeleportCommandEnabled)
 | 
							if ( ! MConf.get().homesTeleportCommandEnabled)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
 | 
								msender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( ! usenderFaction.hasHome())
 | 
							// Args
 | 
				
			||||||
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
 | 
							if (faction == null) return;
 | 
				
			||||||
 | 
							boolean other = faction != msenderFaction;
 | 
				
			||||||
 | 
							PS home = faction.getHome();
 | 
				
			||||||
 | 
							String homeDesc = "home for " + faction.describeTo(msender, false);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Other Perm
 | 
				
			||||||
 | 
							if (other && !Perm.HOME_OTHER.has(sender, true)) return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (home == null)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>Your faction does not have a home. " + (usender.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
 | 
								msender.msg("<b>%s <b>does not have a home.", faction.describeTo(msender, true));
 | 
				
			||||||
			usender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
 | 
								
 | 
				
			||||||
 | 
								if (FPerm.SETHOME.has(msender, faction, false))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									msender.msg("<i>You should:");
 | 
				
			||||||
 | 
									msender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && usender.isInEnemyTerritory())
 | 
							if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
 | 
								msender.msg("<b>You cannot teleport to %s <b>while in the territory of an enemy faction.", homeDesc);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(usenderFaction.getHome().getWorld()))
 | 
							if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(home.getWorld()))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>You cannot teleport to your faction home while in a different world.");
 | 
								msender.msg("<b>You cannot teleport to %s <b>while in a different world.", homeDesc);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Faction faction = BoardColl.get().getFactionAt(PS.valueOf(me));
 | 
							Faction factionHere = BoardColl.get().getFactionAt(PS.valueOf(me));
 | 
				
			||||||
		Location loc = me.getLocation().clone();
 | 
							Location locationHere = me.getLocation().clone();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
 | 
							// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
 | 
				
			||||||
		if
 | 
							if
 | 
				
			||||||
		(
 | 
							(
 | 
				
			||||||
			MConf.get().homesTeleportAllowedEnemyDistance > 0
 | 
								MConf.get().homesTeleportAllowedEnemyDistance > 0
 | 
				
			||||||
			&&
 | 
								&&
 | 
				
			||||||
			faction.getFlag(FFlag.PVP)
 | 
								factionHere.getFlag(FFlag.PVP)
 | 
				
			||||||
			&&
 | 
								&&
 | 
				
			||||||
			(
 | 
								(
 | 
				
			||||||
				! usender.isInOwnTerritory()
 | 
									! msender.isInOwnTerritory()
 | 
				
			||||||
				||
 | 
									||
 | 
				
			||||||
				(
 | 
									(
 | 
				
			||||||
					usender.isInOwnTerritory()
 | 
										msender.isInOwnTerritory()
 | 
				
			||||||
					&&
 | 
										&&
 | 
				
			||||||
					! MConf.get().homesTeleportIgnoreEnemiesIfInOwnTerritory
 | 
										! MConf.get().homesTeleportIgnoreEnemiesIfInOwnTerritory
 | 
				
			||||||
				)
 | 
									)
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			World w = loc.getWorld();
 | 
								World w = locationHere.getWorld();
 | 
				
			||||||
			double x = loc.getX();
 | 
								double x = locationHere.getX();
 | 
				
			||||||
			double y = loc.getY();
 | 
								double y = locationHere.getY();
 | 
				
			||||||
			double z = loc.getZ();
 | 
								double z = locationHere.getZ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for (Player p : me.getServer().getOnlinePlayers())
 | 
								for (Player p : me.getServer().getOnlinePlayers())
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -110,7 +122,7 @@ public class CmdFactionsHome extends FCommand
 | 
				
			|||||||
					continue;
 | 
										continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				MPlayer fp = MPlayer.get(p);
 | 
									MPlayer fp = MPlayer.get(p);
 | 
				
			||||||
				if (usender.getRelationTo(fp) != Rel.ENEMY)
 | 
									if (msender.getRelationTo(fp) != Rel.ENEMY)
 | 
				
			||||||
					continue;
 | 
										continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				Location l = p.getLocation();
 | 
									Location l = p.getLocation();
 | 
				
			||||||
@@ -123,7 +135,7 @@ public class CmdFactionsHome extends FCommand
 | 
				
			|||||||
				if (dx > max || dy > max || dz > max)
 | 
									if (dx > max || dy > max || dz > max)
 | 
				
			||||||
					continue;
 | 
										continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				usender.msg("<b>You cannot teleport to your faction home while an enemy is within " + MConf.get().homesTeleportAllowedEnemyDistance + " blocks of you.");
 | 
									msender.msg("<b>You cannot teleport to %s <b>while an enemy is within %f blocks of you.", homeDesc, MConf.get().homesTeleportAllowedEnemyDistance);
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -136,7 +148,7 @@ public class CmdFactionsHome extends FCommand
 | 
				
			|||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		try
 | 
							try
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Mixin.teleport(me, usenderFaction.getHome(), "your faction home", sender);
 | 
								Mixin.teleport(me, home, homeDesc, sender);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		catch (TeleporterException e)
 | 
							catch (TeleporterException e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsInvite extends FCommand
 | 
					public class CmdFactionsInvite extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -43,39 +43,39 @@ public class CmdFactionsInvite extends FCommand
 | 
				
			|||||||
		MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
 | 
							MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
 | 
				
			||||||
		if (mplayer == null) return;
 | 
							if (mplayer == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(mplayer));
 | 
							Boolean newInvited = this.arg(1, ARBoolean.get(), !msenderFaction.isInvited(mplayer));
 | 
				
			||||||
		if (newInvited == null) return;
 | 
							if (newInvited == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Allready member?
 | 
							// Allready member?
 | 
				
			||||||
		if (mplayer.getFaction() == usenderFaction)
 | 
							if (mplayer.getFaction() == msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("%s<i> is already a member of %s", mplayer.getName(), usenderFaction.getName());
 | 
								msg("%s<i> is already a member of %s", mplayer.getName(), msenderFaction.getName());
 | 
				
			||||||
			msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
 | 
								msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
 | 
							if ( ! FPerm.INVITE.has(msender, msenderFaction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, usenderFaction, newInvited);
 | 
							EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, newInvited);
 | 
				
			||||||
		event.run();
 | 
							event.run();
 | 
				
			||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
		newInvited = event.isNewInvited();
 | 
							newInvited = event.isNewInvited();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		usenderFaction.setInvited(mplayer, newInvited);
 | 
							msenderFaction.setInvited(mplayer, newInvited);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		if (newInvited)
 | 
							if (newInvited)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			mplayer.msg("%s<i> invited you to %s", usender.describeTo(mplayer, true), usenderFaction.describeTo(mplayer));
 | 
								mplayer.msg("%s<i> invited you to %s", msender.describeTo(mplayer, true), msenderFaction.describeTo(mplayer));
 | 
				
			||||||
			usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), mplayer.describeTo(usenderFaction));
 | 
								msenderFaction.msg("%s<i> invited %s<i> to your faction.", msender.describeTo(msenderFaction, true), mplayer.describeTo(msenderFaction));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(mplayer), usenderFaction.describeTo(mplayer));
 | 
								mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", msender.describeTo(mplayer), msenderFaction.describeTo(mplayer));
 | 
				
			||||||
			usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), mplayer.describeTo(usenderFaction));
 | 
								msenderFaction.msg("%s<i> revoked %s's<i> invitation.", msender.describeTo(msenderFaction), mplayer.describeTo(msenderFaction));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsJoin extends FCommand
 | 
					public class CmdFactionsJoin extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -42,11 +42,11 @@ public class CmdFactionsJoin extends FCommand
 | 
				
			|||||||
		Faction faction = this.arg(0, ARFaction.get());
 | 
							Faction faction = this.arg(0, ARFaction.get());
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), usender);
 | 
							MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender);
 | 
				
			||||||
		if (mplayer == null) return;
 | 
							if (mplayer == null) return;
 | 
				
			||||||
		Faction mplayerFaction = mplayer.getFaction();
 | 
							Faction mplayerFaction = mplayer.getFaction();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean samePlayer = mplayer == usender;
 | 
							boolean samePlayer = mplayer == msender;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Validate
 | 
							// Validate
 | 
				
			||||||
		if (!samePlayer  && ! Perm.JOIN_OTHERS.has(sender, false))
 | 
							if (!samePlayer  && ! Perm.JOIN_OTHERS.has(sender, false))
 | 
				
			||||||
@@ -57,29 +57,29 @@ public class CmdFactionsJoin extends FCommand
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if (faction == mplayerFaction)
 | 
							if (faction == mplayerFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
 | 
								msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(msender, true), (samePlayer ? "are" : "is"), faction.getName(msender));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (MConf.get().factionMemberLimit > 0 && faction.getMPlayers().size() >= MConf.get().factionMemberLimit)
 | 
							if (MConf.get().factionMemberLimit > 0 && faction.getMPlayers().size() >= MConf.get().factionMemberLimit)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, mplayer.describeTo(usender, false));
 | 
								msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(msender), MConf.get().factionMemberLimit, mplayer.describeTo(msender, false));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (mplayerFaction.isNormal())
 | 
							if (mplayerFaction.isNormal())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>%s must leave %s current faction first.", mplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
 | 
								msg("<b>%s must leave %s current faction first.", mplayer.describeTo(msender, true), (samePlayer ? "your" : "their"));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
 | 
							if (!MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(usender, true));
 | 
								msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(msender, true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if( ! (faction.isOpen() || faction.isInvited(mplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
 | 
							if( ! (faction.isOpen() || faction.isInvited(mplayer) || msender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<i>This faction requires invitation.");
 | 
								msg("<i>This faction requires invitation.");
 | 
				
			||||||
			if (samePlayer)
 | 
								if (samePlayer)
 | 
				
			||||||
@@ -90,17 +90,17 @@ public class CmdFactionsJoin extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
 | 
							EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, msender, faction, MembershipChangeReason.JOIN);
 | 
				
			||||||
		membershipChangeEvent.run();
 | 
							membershipChangeEvent.run();
 | 
				
			||||||
		if (membershipChangeEvent.isCancelled()) return;
 | 
							if (membershipChangeEvent.isCancelled()) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		if (!samePlayer)
 | 
							if (!samePlayer)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(mplayer, true), faction.getName(mplayer));
 | 
								mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", msender.describeTo(mplayer, true), faction.getName(mplayer));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		faction.msg("<i>%s <i>joined <lime>your faction<i>.", mplayer.describeTo(faction, true));
 | 
							faction.msg("<i>%s <i>joined <lime>your faction<i>.", mplayer.describeTo(faction, true));
 | 
				
			||||||
		usender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(usender, true), faction.getName(usender));
 | 
							msender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(msender, true), faction.getName(msender));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		mplayer.resetFactionData();
 | 
							mplayer.resetFactionData();
 | 
				
			||||||
@@ -117,7 +117,7 @@ public class CmdFactionsJoin extends FCommand
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), mplayer.getName(), faction.getName()));
 | 
									Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", msender.getName(), mplayer.getName(), faction.getName()));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.IdUtil;
 | 
					import com.massivecraft.massivecore.util.IdUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsKick extends FCommand
 | 
					public class CmdFactionsKick extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -44,14 +44,14 @@ public class CmdFactionsKick extends FCommand
 | 
				
			|||||||
		if (mplayer == null) return;
 | 
							if (mplayer == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Validate
 | 
							// Validate
 | 
				
			||||||
		if (usender == mplayer)
 | 
							if (msender == mplayer)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>You cannot kick yourself.");
 | 
								msg("<b>You cannot kick yourself.");
 | 
				
			||||||
			msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
 | 
								msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
 | 
							if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || msender.isUsingAdminMode()))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>The leader can not be kicked.");
 | 
								msg("<b>The leader can not be kicked.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -65,7 +65,7 @@ public class CmdFactionsKick extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		Faction mplayerFaction = mplayer.getFaction();
 | 
							Faction mplayerFaction = mplayer.getFaction();
 | 
				
			||||||
		if (!FPerm.KICK.has(usender, mplayerFaction, true)) return;
 | 
							if (!FPerm.KICK.has(msender, mplayerFaction, true)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
 | 
							EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
 | 
				
			||||||
@@ -73,16 +73,16 @@ public class CmdFactionsKick extends FCommand
 | 
				
			|||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
 | 
							mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", msender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
 | 
				
			||||||
		mplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
 | 
							mplayer.msg("%s<i> kicked you from %s<i>! :O", msender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
 | 
				
			||||||
		if (mplayerFaction != usenderFaction)
 | 
							if (mplayerFaction != msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(usender), mplayerFaction.describeTo(usender));
 | 
								msender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(msender), mplayerFaction.describeTo(msender));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (MConf.get().logFactionKick)
 | 
							if (MConf.get().logFactionKick)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
 | 
								Factions.get().log(msender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import com.massivecraft.factions.util.RelationUtil;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsLeader extends FCommand
 | 
					public class CmdFactionsLeader extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -41,32 +41,32 @@ public class CmdFactionsLeader extends FCommand
 | 
				
			|||||||
		MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
 | 
							MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
 | 
				
			||||||
		if (newLeader == null) return;
 | 
							if (newLeader == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
 | 
							Faction targetFaction = this.arg(1, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (targetFaction == null) return;
 | 
							if (targetFaction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
 | 
							MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// We now have mplayer and the target faction
 | 
							// We now have mplayer and the target faction
 | 
				
			||||||
		if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
 | 
							if (this.senderIsConsole || msender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// Do whatever you wish
 | 
								// Do whatever you wish
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// Follow the standard rules
 | 
								// Follow the standard rules
 | 
				
			||||||
			if (usender.getRole() != Rel.LEADER || targetFaction != usenderFaction)
 | 
								if (msender.getRole() != Rel.LEADER || targetFaction != msenderFaction)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc()));
 | 
									sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc()));
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if (newLeader.getFaction() != usenderFaction)
 | 
								if (newLeader.getFaction() != msenderFaction)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("%s<i> is not a member in the faction.", newLeader.describeTo(usender, true));
 | 
									msg("%s<i> is not a member in the faction.", newLeader.describeTo(msender, true));
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if (newLeader == usender)
 | 
								if (newLeader == msender)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("<b>The target player musn't be yourself.");
 | 
									msg("<b>The target player musn't be yourself.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
@@ -85,8 +85,8 @@ public class CmdFactionsLeader extends FCommand
 | 
				
			|||||||
		if (targetFactionCurrentLeader == newLeader)
 | 
							if (targetFactionCurrentLeader == newLeader)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			targetFaction.promoteNewLeader();
 | 
								targetFaction.promoteNewLeader();
 | 
				
			||||||
			msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(usender, true));
 | 
								msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(msender, true));
 | 
				
			||||||
			newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", usender.describeTo(newLeader, true));
 | 
								newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", msender.describeTo(newLeader, true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,12 +97,12 @@ public class CmdFactionsLeader extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		newLeader.setFaction(targetFaction);
 | 
							newLeader.setFaction(targetFaction);
 | 
				
			||||||
		newLeader.setRole(Rel.LEADER);
 | 
							newLeader.setRole(Rel.LEADER);
 | 
				
			||||||
		msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
 | 
							msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(msender, true));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform all players
 | 
							// Inform all players
 | 
				
			||||||
		for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
 | 
							for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
 | 
								mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(msender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import com.massivecraft.factions.Perm;
 | 
				
			|||||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
 | 
					import com.massivecraft.factions.cmd.req.ReqHasFaction;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsLeave extends FCommand
 | 
					public class CmdFactionsLeave extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -27,7 +27,7 @@ public class CmdFactionsLeave extends FCommand
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		usender.leave();
 | 
							msender.leave();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsList extends FCommand
 | 
					public class CmdFactionsList extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -67,7 +67,7 @@ public class CmdFactionsList extends FCommand
 | 
				
			|||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
 | 
								lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
 | 
				
			||||||
				faction.getName(usender),
 | 
									faction.getName(msender),
 | 
				
			||||||
				faction.getMPlayersWhereOnline(true).size(),
 | 
									faction.getMPlayersWhereOnline(true).size(),
 | 
				
			||||||
				faction.getMPlayers().size(),
 | 
									faction.getMPlayers().size(),
 | 
				
			||||||
				faction.getLandCount(),
 | 
									faction.getLandCount(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMap extends FCommand
 | 
					public class CmdFactionsMap extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -58,7 +58,7 @@ public class CmdFactionsMap extends FCommand
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public void showMap()
 | 
						public void showMap()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		sendMessage(BoardColl.get().getMap(usenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
 | 
							sendMessage(BoardColl.get().getMap(msenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import com.massivecraft.factions.Perm;
 | 
				
			|||||||
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
 | 
					import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoney extends FCommand
 | 
					public class CmdFactionsMoney extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// FIELDS
 | 
						// FIELDS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import com.massivecraft.factions.integration.Econ;
 | 
				
			|||||||
import com.massivecraft.factions.Perm;
 | 
					import com.massivecraft.factions.Perm;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyBalance extends FCommand
 | 
					public class CmdFactionsMoneyBalance extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -33,12 +33,12 @@ public class CmdFactionsMoneyBalance extends FCommand
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		if (faction != usenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
 | 
							if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Econ.sendBalanceInfo(usender, faction);
 | 
							Econ.sendBalanceInfo(msender, faction);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import com.massivecraft.massivecore.util.Txt;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyDeposit extends FCommand
 | 
					public class CmdFactionsMoneyDeposit extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -44,14 +44,14 @@ public class CmdFactionsMoneyDeposit extends FCommand
 | 
				
			|||||||
		Double amount = this.arg(0, ARDouble.get());
 | 
							Double amount = this.arg(0, ARDouble.get());
 | 
				
			||||||
		if (amount == null) return;
 | 
							if (amount == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Faction faction = this.arg(1, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean success = Econ.transferMoney(usender, usender, faction, amount);
 | 
							boolean success = Econ.transferMoney(msender, msender, faction, amount);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (success && MConf.get().logMoneyTransactions)
 | 
							if (success && MConf.get().logMoneyTransactions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(amount), faction.describeTo(null))));
 | 
								Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", msender.getName(), Money.format(amount), faction.describeTo(null))));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ import com.massivecraft.massivecore.util.Txt;
 | 
				
			|||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyTransferFf extends FCommand
 | 
					public class CmdFactionsMoneyTransferFf extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -52,11 +52,11 @@ public class CmdFactionsMoneyTransferFf extends FCommand
 | 
				
			|||||||
		Faction to = this.arg(2, ARFaction.get());
 | 
							Faction to = this.arg(2, ARFaction.get());
 | 
				
			||||||
		if (to == null) return;
 | 
							if (to == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean success = Econ.transferMoney(usender, from, to, amount);
 | 
							boolean success = Econ.transferMoney(msender, from, to, amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (success && MConf.get().logMoneyTransactions)
 | 
							if (success && MConf.get().logMoneyTransactions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
								Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import com.massivecraft.massivecore.util.Txt;
 | 
				
			|||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyTransferFp extends FCommand
 | 
					public class CmdFactionsMoneyTransferFp extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -54,11 +54,11 @@ public class CmdFactionsMoneyTransferFp extends FCommand
 | 
				
			|||||||
		MPlayer to = this.arg(2, ARMPlayer.getAny());
 | 
							MPlayer to = this.arg(2, ARMPlayer.getAny());
 | 
				
			||||||
		if (to == null) return;
 | 
							if (to == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean success = Econ.transferMoney(usender, from, to, amount);
 | 
							boolean success = Econ.transferMoney(msender, from, to, amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (success && MConf.get().logMoneyTransactions)
 | 
							if (success && MConf.get().logMoneyTransactions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
								Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import com.massivecraft.massivecore.util.Txt;
 | 
				
			|||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyTransferPf extends FCommand
 | 
					public class CmdFactionsMoneyTransferPf extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -54,11 +54,11 @@ public class CmdFactionsMoneyTransferPf extends FCommand
 | 
				
			|||||||
		Faction to = this.arg(2, ARFaction.get());
 | 
							Faction to = this.arg(2, ARFaction.get());
 | 
				
			||||||
		if (to == null) return;
 | 
							if (to == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean success = Econ.transferMoney(usender, from, to, amount);
 | 
							boolean success = Econ.transferMoney(msender, from, to, amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (success && MConf.get().logMoneyTransactions)
 | 
							if (success && MConf.get().logMoneyTransactions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
								Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@ import com.massivecraft.massivecore.util.Txt;
 | 
				
			|||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsMoneyWithdraw extends FCommand
 | 
					public class CmdFactionsMoneyWithdraw extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -46,16 +46,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand
 | 
				
			|||||||
		Double amount = this.arg(0, ARDouble.get());
 | 
							Double amount = this.arg(0, ARDouble.get());
 | 
				
			||||||
		if (amount == null) return;
 | 
							if (amount == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Faction from = this.arg(1, ARFaction.get(), usenderFaction);
 | 
							Faction from = this.arg(1, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (from == null) return;
 | 
							if (from == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		MPlayer to = usender;
 | 
							MPlayer to = msender;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean success = Econ.transferMoney(usender, from, to, amount);
 | 
							boolean success = Econ.transferMoney(msender, from, to, amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (success && MConf.get().logMoneyTransactions)
 | 
							if (success && MConf.get().logMoneyTransactions)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(amount), from.describeTo(null))));
 | 
								Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", msender.getName(), Money.format(amount), from.describeTo(null))));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import com.massivecraft.factions.event.EventFactionsNameChange;
 | 
				
			|||||||
import com.massivecraft.factions.util.MiscUtil;
 | 
					import com.massivecraft.factions.util.MiscUtil;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsName extends FCommand
 | 
					public class CmdFactionsName extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -45,7 +45,7 @@ public class CmdFactionsName extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		// TODO does not first test cover selfcase?
 | 
							// TODO does not first test cover selfcase?
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
 | 
							if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(msenderFaction.getComparisonName()))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>That name is already taken");
 | 
								msg("<b>That name is already taken");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -60,26 +60,26 @@ public class CmdFactionsName extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsNameChange event = new EventFactionsNameChange(sender, usenderFaction, newName);
 | 
							EventFactionsNameChange event = new EventFactionsNameChange(sender, msenderFaction, newName);
 | 
				
			||||||
		event.run();
 | 
							event.run();
 | 
				
			||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
		newName = event.getNewName();
 | 
							newName = event.getNewName();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		String oldName = usenderFaction.getName();
 | 
							String oldName = msenderFaction.getName();
 | 
				
			||||||
		usenderFaction.setName(newName);
 | 
							msenderFaction.setName(newName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
 | 
							msenderFaction.msg("%s<i> changed your faction name to %s", msender.describeTo(msenderFaction, true), msenderFaction.getName(msenderFaction));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (!MConf.get().broadcastNameChange) return;
 | 
							if (!MConf.get().broadcastNameChange) return;
 | 
				
			||||||
		for (Faction faction : FactionColl.get().getAll())
 | 
							for (Faction faction : FactionColl.get().getAll())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (faction == usenderFaction)
 | 
								if (faction == msenderFaction)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			faction.msg("<i>The player %s<i> changed their faction name from %s<i> to %s<i>.", usender.describeTo(faction, true), usender.getColorTo(faction)+oldName, usenderFaction.getName(faction));
 | 
								faction.msg("<i>The player %s<i> changed their faction name from %s<i> to %s<i>.", msender.describeTo(faction, true), msender.getColorTo(faction)+oldName, msenderFaction.getName(faction));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import com.massivecraft.factions.entity.MPlayer;
 | 
				
			|||||||
import com.massivecraft.factions.entity.Faction;
 | 
					import com.massivecraft.factions.entity.Faction;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsOfficer extends FCommand
 | 
					public class CmdFactionsOfficer extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -38,19 +38,19 @@ public class CmdFactionsOfficer extends FCommand
 | 
				
			|||||||
		boolean permAny = Perm.OFFICER_ANY.has(sender, false);
 | 
							boolean permAny = Perm.OFFICER_ANY.has(sender, false);
 | 
				
			||||||
		Faction targetFaction = you.getFaction();
 | 
							Faction targetFaction = you.getFaction();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (targetFaction != usenderFaction && !permAny)
 | 
							if (targetFaction != msenderFaction && !permAny)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
 | 
								msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (usender != null && usender.getRole() != Rel.LEADER && !permAny)
 | 
							if (msender != null && msender.getRole() != Rel.LEADER && !permAny)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>You are not the faction leader.");
 | 
								msg("<b>You are not the faction leader.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (you == usender && !permAny)
 | 
							if (you == msender && !permAny)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>The target player musn't be yourself.");
 | 
								msg("<b>The target player musn't be yourself.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -67,14 +67,14 @@ public class CmdFactionsOfficer extends FCommand
 | 
				
			|||||||
			// Revoke
 | 
								// Revoke
 | 
				
			||||||
			you.setRole(Rel.MEMBER);
 | 
								you.setRole(Rel.MEMBER);
 | 
				
			||||||
			targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true));
 | 
								targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true));
 | 
				
			||||||
			msg("<i>You have removed officer status from %s<i>.", you.describeTo(usender, true));
 | 
								msg("<i>You have removed officer status from %s<i>.", you.describeTo(msender, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// Give
 | 
								// Give
 | 
				
			||||||
			you.setRole(Rel.OFFICER);
 | 
								you.setRole(Rel.OFFICER);
 | 
				
			||||||
			targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true));
 | 
								targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true));
 | 
				
			||||||
			msg("<i>You have promoted %s<i> to officer.", you.describeTo(usender, true));
 | 
								msg("<i>You have promoted %s<i> to officer.", you.describeTo(msender, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import com.massivecraft.factions.event.EventFactionsOpenChange;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
					import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsOpen extends FCommand
 | 
					public class CmdFactionsOpen extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -36,21 +36,21 @@ public class CmdFactionsOpen extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Boolean newOpen = this.arg(0, ARBoolean.get(), !usenderFaction.isOpen());
 | 
							Boolean newOpen = this.arg(0, ARBoolean.get(), !msenderFaction.isOpen());
 | 
				
			||||||
		if (newOpen == null) return;
 | 
							if (newOpen == null) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsOpenChange event = new EventFactionsOpenChange(sender, usenderFaction, newOpen);
 | 
							EventFactionsOpenChange event = new EventFactionsOpenChange(sender, msenderFaction, newOpen);
 | 
				
			||||||
		event.run();
 | 
							event.run();
 | 
				
			||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
		newOpen = event.isNewOpen();
 | 
							newOpen = event.isNewOpen();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		usenderFaction.setOpen(newOpen);
 | 
							msenderFaction.setOpen(newOpen);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		String descTarget = usenderFaction.isOpen() ? "open" : "closed";
 | 
							String descTarget = msenderFaction.isOpen() ? "open" : "closed";
 | 
				
			||||||
		usenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", usender.describeTo(usenderFaction, true), descTarget);
 | 
							msenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", msender.describeTo(msenderFaction, true), descTarget);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsPerm extends FCommand
 | 
					public class CmdFactionsPerm extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -40,12 +40,12 @@ public class CmdFactionsPerm extends FCommand
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( ! this.argIsSet(1))
 | 
							if ( ! this.argIsSet(1))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg(Txt.titleize("Perms for " + faction.describeTo(usender, true)));
 | 
								msg(Txt.titleize("Perms for " + faction.describeTo(msender, true)));
 | 
				
			||||||
			msg(FPerm.getStateHeaders());
 | 
								msg(FPerm.getStateHeaders());
 | 
				
			||||||
			for (FPerm perm : FPerm.values())
 | 
								for (FPerm perm : FPerm.values())
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@@ -60,14 +60,14 @@ public class CmdFactionsPerm extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		if ( ! this.argIsSet(2))
 | 
							if ( ! this.argIsSet(2))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
 | 
								msg(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
 | 
				
			||||||
			msg(FPerm.getStateHeaders());
 | 
								msg(FPerm.getStateHeaders());
 | 
				
			||||||
			msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
 | 
								msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Do the sender have the right to change perms for this faction?
 | 
							// Do the sender have the right to change perms for this faction?
 | 
				
			||||||
		if ( ! FPerm.PERMS.has(usender, faction, true)) return;
 | 
							if ( ! FPerm.PERMS.has(msender, faction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Rel rel = this.arg(2, ARRel.get());
 | 
							Rel rel = this.arg(2, ARRel.get());
 | 
				
			||||||
		if (rel == null) return;
 | 
							if (rel == null) return;
 | 
				
			||||||
@@ -91,7 +91,7 @@ public class CmdFactionsPerm extends FCommand
 | 
				
			|||||||
			faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
 | 
								faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
 | 
							msg(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
 | 
				
			||||||
		msg(FPerm.getStateHeaders());
 | 
							msg(FPerm.getStateHeaders());
 | 
				
			||||||
		msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
 | 
							msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
 | 
				
			|||||||
import com.massivecraft.massivecore.util.TimeUnit;
 | 
					import com.massivecraft.massivecore.util.TimeUnit;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsPlayer extends FCommand
 | 
					public class CmdFactionsPlayer extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -37,11 +37,11 @@ public class CmdFactionsPlayer extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), usender);
 | 
							MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender);
 | 
				
			||||||
		if (mplayer == null) return;
 | 
							if (mplayer == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// INFO: Title
 | 
							// INFO: Title
 | 
				
			||||||
		msg(Txt.titleize("Player " + mplayer.describeTo(usender)));
 | 
							msg(Txt.titleize("Player " + mplayer.describeTo(msender)));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// INFO: Power (as progress bar)
 | 
							// INFO: Power (as progress bar)
 | 
				
			||||||
		double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax();
 | 
							double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import com.massivecraft.factions.entity.Faction;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.arg.ARDouble;
 | 
					import com.massivecraft.massivecore.cmd.arg.ARDouble;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsPowerBoost extends FCommand
 | 
					public class CmdFactionsPowerBoost extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -72,7 +72,7 @@ public class CmdFactionsPowerBoost extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
 | 
							msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
 | 
				
			||||||
		Factions.get().log(usender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
 | 
							Factions.get().log(msender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
 | 
				
			|||||||
import com.massivecraft.factions.entity.MPlayer;
 | 
					import com.massivecraft.factions.entity.MPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsPromote extends FCommand
 | 
					public class CmdFactionsPromote extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -38,13 +38,13 @@ public class CmdFactionsPromote extends FCommand
 | 
				
			|||||||
		MPlayer you = this.arg(0, ARMPlayer.getAny());
 | 
							MPlayer you = this.arg(0, ARMPlayer.getAny());
 | 
				
			||||||
		if (you == null) return;
 | 
							if (you == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (you.getFaction() != usenderFaction)
 | 
							if (you.getFaction() != msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
 | 
								msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (you == usender)
 | 
							if (you == msender)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>The target player mustn't be yourself.");
 | 
								msg("<b>The target player mustn't be yourself.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
@@ -52,24 +52,24 @@ public class CmdFactionsPromote extends FCommand
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if (you.getRole() == Rel.RECRUIT)
 | 
							if (you.getRole() == Rel.RECRUIT)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!usender.getRole().isAtLeast(Rel.OFFICER))
 | 
								if (!msender.getRole().isAtLeast(Rel.OFFICER))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("<b>You must be an officer to promote someone to member.");
 | 
									msg("<b>You must be an officer to promote someone to member.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			you.setRole(Rel.MEMBER);
 | 
								you.setRole(Rel.MEMBER);
 | 
				
			||||||
			usenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(usenderFaction, true));
 | 
								msenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(msenderFaction, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (you.getRole() == Rel.MEMBER)
 | 
							else if (you.getRole() == Rel.MEMBER)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!usender.getRole().isAtLeast(Rel.LEADER))
 | 
								if (!msender.getRole().isAtLeast(Rel.LEADER))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				msg("<b>You must be the leader to promote someone to officer.");
 | 
									msg("<b>You must be the leader to promote someone to officer.");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// Give
 | 
								// Give
 | 
				
			||||||
			you.setRole(Rel.OFFICER);
 | 
								you.setRole(Rel.OFFICER);
 | 
				
			||||||
			usenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(usenderFaction, true));
 | 
								msenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(msenderFaction, true));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import com.massivecraft.factions.entity.MConf;
 | 
				
			|||||||
import com.massivecraft.factions.event.EventFactionsRelationChange;
 | 
					import com.massivecraft.factions.event.EventFactionsRelationChange;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public abstract class CmdFactionsRelationAbstract extends FCommand
 | 
					public abstract class CmdFactionsRelationAbstract extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public Rel targetRelation;
 | 
						public Rel targetRelation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -51,40 +51,40 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		// Verify
 | 
							// Verify
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (otherFaction == usenderFaction)
 | 
							if (otherFaction == msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>Nope! You can't declare a relation to yourself :)");
 | 
								msg("<b>Nope! You can't declare a relation to yourself :)");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (usenderFaction.getRelationWish(otherFaction) == newRelation)
 | 
							if (msenderFaction.getRelationWish(otherFaction) == newRelation)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
 | 
								msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsRelationChange event = new EventFactionsRelationChange(sender, usenderFaction, otherFaction, newRelation);
 | 
							EventFactionsRelationChange event = new EventFactionsRelationChange(sender, msenderFaction, otherFaction, newRelation);
 | 
				
			||||||
		event.run();
 | 
							event.run();
 | 
				
			||||||
		if (event.isCancelled()) return;
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
		newRelation = event.getNewRelation();
 | 
							newRelation = event.getNewRelation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// try to set the new relation
 | 
							// try to set the new relation
 | 
				
			||||||
		usenderFaction.setRelationWish(otherFaction, newRelation);
 | 
							msenderFaction.setRelationWish(otherFaction, newRelation);
 | 
				
			||||||
		Rel currentRelation = usenderFaction.getRelationTo(otherFaction, true);
 | 
							Rel currentRelation = msenderFaction.getRelationTo(otherFaction, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// if the relation change was successful
 | 
							// if the relation change was successful
 | 
				
			||||||
		if (newRelation == currentRelation)
 | 
							if (newRelation == currentRelation)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			otherFaction.msg("%s<i> is now %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
 | 
								otherFaction.msg("%s<i> is now %s.", msenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
 | 
				
			||||||
			usenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(usenderFaction, true), newRelation.getDescFactionOne());
 | 
								msenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(msenderFaction, true), newRelation.getDescFactionOne());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// inform the other faction of your request
 | 
							// inform the other faction of your request
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
 | 
								otherFaction.msg("%s<i> wishes to be %s.", msenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
 | 
				
			||||||
			otherFaction.msg("<i>Type <c>/"+MConf.get().aliasesF.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept.");
 | 
								otherFaction.msg("<i>Type <c>/"+MConf.get().aliasesF.get(0)+" "+newRelation+" "+msenderFaction.getName()+"<i> to accept.");
 | 
				
			||||||
			usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
 | 
								msenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(msenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// TODO: The ally case should work!!
 | 
							// TODO: The ally case should work!!
 | 
				
			||||||
@@ -92,13 +92,13 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
 | 
				
			|||||||
		if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL))
 | 
							if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
 | 
								otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
 | 
				
			||||||
			usenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
 | 
								msenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if ( newRelation != Rel.TRUCE && usenderFaction.getFlag(FFlag.PEACEFUL))
 | 
							if ( newRelation != Rel.TRUCE && msenderFaction.getFlag(FFlag.PEACEFUL))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
 | 
								otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
 | 
				
			||||||
			usenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
 | 
								msenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			|||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
 | 
					import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsSeeChunk extends FCommand
 | 
					public class CmdFactionsSeeChunk extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,12 @@ import com.massivecraft.factions.Factions;
 | 
				
			|||||||
import com.massivecraft.factions.Perm;
 | 
					import com.massivecraft.factions.Perm;
 | 
				
			||||||
import com.massivecraft.factions.cmd.arg.ARFaction;
 | 
					import com.massivecraft.factions.cmd.arg.ARFaction;
 | 
				
			||||||
import com.massivecraft.factions.entity.Faction;
 | 
					import com.massivecraft.factions.entity.Faction;
 | 
				
			||||||
import com.massivecraft.factions.entity.MConf;
 | 
					 | 
				
			||||||
import com.massivecraft.factions.event.EventFactionsHomeChange;
 | 
					import com.massivecraft.factions.event.EventFactionsHomeChange;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsSethome extends FCommand
 | 
					public class CmdFactionsSethome extends FactionsCommandHome
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -26,8 +25,8 @@ public class CmdFactionsSethome extends FCommand
 | 
				
			|||||||
		this.addOptionalArg("faction", "you");
 | 
							this.addOptionalArg("faction", "you");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Requirements
 | 
							// Requirements
 | 
				
			||||||
		this.addRequirements(ReqIsPlayer.get());
 | 
					 | 
				
			||||||
		this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
 | 
							this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
 | 
				
			||||||
 | 
							this.addRequirements(ReqIsPlayer.get());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
@@ -38,25 +37,18 @@ public class CmdFactionsSethome extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
		if (faction == null) return;
 | 
							if (faction == null) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		PS newHome = PS.valueOf(me.getLocation());
 | 
							PS newHome = PS.valueOf(me.getLocation());
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Validate
 | 
					 | 
				
			||||||
		if ( ! MConf.get().homesEnabled)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			usender.msg("<b>Sorry, Faction homes are disabled on this server.");
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if ( ! FPerm.SETHOME.has(usender, faction, true)) return;
 | 
							if ( ! FPerm.SETHOME.has(msender, faction, true)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Verify
 | 
							// Verify
 | 
				
			||||||
		if (!usender.isUsingAdminMode() && !faction.isValidHome(newHome))
 | 
							if (!msender.isUsingAdminMode() && !faction.isValidHome(newHome))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
 | 
								msender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -70,11 +62,11 @@ public class CmdFactionsSethome extends FCommand
 | 
				
			|||||||
		faction.setHome(newHome);
 | 
							faction.setHome(newHome);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		faction.msg("%s<i> set the home for your faction. You can now use:", usender.describeTo(usenderFaction, true));
 | 
							faction.msg("%s<i> set the home for your faction. You can now use:", msender.describeTo(msenderFaction, true));
 | 
				
			||||||
		faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
 | 
							faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
 | 
				
			||||||
		if (faction != usenderFaction)
 | 
							if (faction != msenderFaction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			usender.msg("<b>You have set the home for the "+faction.getName(usender)+"<i> faction.");
 | 
								msender.msg("<i>You have set the home for " + faction.getName(msender) + "<i>.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.arg.ARString;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsTitle extends FCommand
 | 
					public class CmdFactionsTitle extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -53,7 +53,7 @@ public class CmdFactionsTitle extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Verify
 | 
							// Verify
 | 
				
			||||||
		if ( ! canIAdministerYou(usender, you)) return;
 | 
							if ( ! canIAdministerYou(msender, you)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Event
 | 
							// Event
 | 
				
			||||||
		EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
 | 
							EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
 | 
				
			||||||
@@ -65,7 +65,7 @@ public class CmdFactionsTitle extends FCommand
 | 
				
			|||||||
		you.setTitle(newTitle);
 | 
							you.setTitle(newTitle);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		usenderFaction.msg("%s<i> changed a title: %s", usender.describeTo(usenderFaction, true), you.describeTo(usenderFaction, true));
 | 
							msenderFaction.msg("%s<i> changed a title: %s", msender.describeTo(msenderFaction, true), you.describeTo(msenderFaction, true));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsUnclaim extends FCommand
 | 
					public class CmdFactionsUnclaim extends FactionsCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -37,7 +37,7 @@ public class CmdFactionsUnclaim extends FCommand
 | 
				
			|||||||
		Faction newFaction = FactionColl.get().getNone();
 | 
							Faction newFaction = FactionColl.get().getNone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		if (usender.tryClaim(newFaction, chunk, true, true)) return;
 | 
							if (msender.tryClaim(newFaction, chunk, true, true)) return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@ import com.massivecraft.factions.event.EventFactionsChunkChange;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
import com.massivecraft.massivecore.ps.PS;
 | 
					import com.massivecraft.massivecore.ps.PS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CmdFactionsUnclaimall extends FCommand
 | 
					public class CmdFactionsUnclaimall extends FactionsCommand
 | 
				
			||||||
{	
 | 
					{	
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// CONSTRUCT
 | 
						// CONSTRUCT
 | 
				
			||||||
@@ -41,11 +41,11 @@ public class CmdFactionsUnclaimall extends FCommand
 | 
				
			|||||||
	public void perform()
 | 
						public void perform()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		// Args
 | 
							// Args
 | 
				
			||||||
		Faction faction = usenderFaction;
 | 
							Faction faction = msenderFaction;
 | 
				
			||||||
		Faction newFaction = FactionColl.get().getNone();
 | 
							Faction newFaction = FactionColl.get().getNone();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// FPerm
 | 
							// FPerm
 | 
				
			||||||
		if (!FPerm.TERRITORY.has(usender, faction, true)) return;
 | 
							if (!FPerm.TERRITORY.has(msender, faction, true)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Apply
 | 
							// Apply
 | 
				
			||||||
		Set<PS> chunks = BoardColl.get().getChunks(faction);
 | 
							Set<PS> chunks = BoardColl.get().getChunks(faction);
 | 
				
			||||||
@@ -68,12 +68,12 @@ public class CmdFactionsUnclaimall extends FCommand
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Inform
 | 
							// Inform
 | 
				
			||||||
		usenderFaction.msg("%s<i> unclaimed <h>%d <i>of your <h>%d <i>faction land. You now have <h>%d <i>land claimed.", usender.describeTo(usenderFaction, true), countSuccess, countTotal, countFail);
 | 
							msenderFaction.msg("%s<i> unclaimed <h>%d <i>of your <h>%d <i>faction land. You now have <h>%d <i>land claimed.", msender.describeTo(msenderFaction, true), countSuccess, countTotal, countFail);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Log
 | 
							// Log
 | 
				
			||||||
		if (MConf.get().logLandUnclaims)
 | 
							if (MConf.get().logLandUnclaims)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Factions.get().log(usender.getName()+" unclaimed everything for the faction: "+usenderFaction.getName());
 | 
								Factions.get().log(msender.getName()+" unclaimed everything for the faction: "+msenderFaction.getName());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,68 @@
 | 
				
			|||||||
 | 
					package com.massivecraft.factions.cmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.massivecraft.factions.FPerm;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.Perm;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.cmd.arg.ARFaction;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.entity.Faction;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.event.EventFactionsHomeChange;
 | 
				
			||||||
 | 
					import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class CmdFactionsUnsethome extends FactionsCommandHome
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// CONSTRUCT
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public CmdFactionsUnsethome()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							// Aliases
 | 
				
			||||||
 | 
							this.addAliases("unsethome");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Args
 | 
				
			||||||
 | 
							this.addOptionalArg("faction", "you");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Requirements
 | 
				
			||||||
 | 
							this.addRequirements(ReqHasPerm.get(Perm.UNSETHOME.node));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// OVERRIDE
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public void perform()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							// Args
 | 
				
			||||||
 | 
							Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
 | 
				
			||||||
 | 
							if (faction == null) return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Other Perm
 | 
				
			||||||
 | 
							if (faction != msenderFaction && !Perm.HOME_OTHER.has(sender, true)) return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// FPerm
 | 
				
			||||||
 | 
							if ( ! FPerm.SETHOME.has(msender, faction, true)) return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// NoChange
 | 
				
			||||||
 | 
							if ( ! faction.hasHome())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								msender.msg("<i>%s <i>does already not have a home.", faction.describeTo(msender));
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Event
 | 
				
			||||||
 | 
							EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, null);
 | 
				
			||||||
 | 
							event.run();
 | 
				
			||||||
 | 
							if (event.isCancelled()) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Apply
 | 
				
			||||||
 | 
							faction.setHome(null);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Inform
 | 
				
			||||||
 | 
							faction.msg("%s<i> unset the home for your faction.", msender.describeTo(msenderFaction, true));
 | 
				
			||||||
 | 
							if (faction != msenderFaction)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								msender.msg("<i>You have unset the home for " + faction.getName(msender) + "<i>.");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -6,15 +6,14 @@ import com.massivecraft.factions.entity.Faction;
 | 
				
			|||||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
 | 
					import com.massivecraft.massivecore.cmd.MassiveCommand;
 | 
				
			||||||
import com.massivecraft.massivecore.util.Txt;
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public abstract class FCommand extends MassiveCommand
 | 
					public abstract class FactionsCommand extends MassiveCommand
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// FIELDS
 | 
						// FIELDS
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public MPlayer msender;
 | 
						public MPlayer msender;
 | 
				
			||||||
	public MPlayer usender;
 | 
						public Faction msenderFaction;
 | 
				
			||||||
	public Faction usenderFaction;
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
	// OVERRIDE
 | 
						// OVERRIDE
 | 
				
			||||||
@@ -24,12 +23,7 @@ public abstract class FCommand extends MassiveCommand
 | 
				
			|||||||
	public void fixSenderVars()
 | 
						public void fixSenderVars()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		this.msender = MPlayer.get(sender);
 | 
							this.msender = MPlayer.get(sender);
 | 
				
			||||||
		
 | 
							this.msenderFaction = this.msender.getFaction();
 | 
				
			||||||
		this.usender = null;
 | 
					 | 
				
			||||||
		this.usenderFaction = null;			
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		this.usender = MPlayer.get(this.sender);
 | 
					 | 
				
			||||||
		this.usenderFaction = this.usender.getFaction();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -37,8 +31,7 @@ public abstract class FCommand extends MassiveCommand
 | 
				
			|||||||
	public void unsetSenderVars()
 | 
						public void unsetSenderVars()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		this.msender = null;
 | 
							this.msender = null;
 | 
				
			||||||
		this.usender = null;
 | 
							this.msenderFaction = null;
 | 
				
			||||||
		this.usenderFaction = null;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// -------------------------------------------- //
 | 
						// -------------------------------------------- //
 | 
				
			||||||
@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					package com.massivecraft.factions.cmd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.massivecraft.factions.cmd.req.ReqFactionHomesEnabled;
 | 
				
			||||||
 | 
					import com.massivecraft.factions.entity.MConf;
 | 
				
			||||||
 | 
					import com.massivecraft.massivecore.cmd.VisibilityMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class FactionsCommandHome extends FactionsCommand
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// CONSTRUCT
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public FactionsCommandHome()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this.addRequirements(ReqFactionHomesEnabled.get());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// OVERRIDE
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public VisibilityMode getVisibilityMode()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return MConf.get().homesEnabled ? super.getVisibilityMode() : VisibilityMode.INVISIBLE;  
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					package com.massivecraft.factions.cmd.req;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.massivecraft.factions.entity.MConf;
 | 
				
			||||||
 | 
					import com.massivecraft.massivecore.cmd.MassiveCommand;
 | 
				
			||||||
 | 
					import com.massivecraft.massivecore.cmd.req.ReqAbstract;
 | 
				
			||||||
 | 
					import com.massivecraft.massivecore.util.Txt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ReqFactionHomesEnabled extends ReqAbstract
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// INSTANCE & CONSTRUCT
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private static ReqFactionHomesEnabled i = new ReqFactionHomesEnabled();
 | 
				
			||||||
 | 
						public static ReqFactionHomesEnabled get() { return i; }
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						// OVERRIDE
 | 
				
			||||||
 | 
						// -------------------------------------------- //
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public boolean apply(CommandSender sender, MassiveCommand command)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return MConf.get().homesEnabled;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public String createErrorMessage(CommandSender sender, MassiveCommand command)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return Txt.parse("<b>Homes must be enabled on the server to "+(command == null ? "do that" : command.getDesc())+".");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -29,6 +29,10 @@ public class RelationUtil
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if (that instanceof Faction)
 | 
							if (that instanceof Faction)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								if (thatFaction.isNone())
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									ret = thatFaction.getName();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if (me instanceof MPlayer && myFaction == thatFaction)
 | 
								if (me instanceof MPlayer && myFaction == thatFaction)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				ret = "your faction";
 | 
									ret = "your faction";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@ permissions:
 | 
				
			|||||||
  factions.flag: {description: manage faction flags, default: false}
 | 
					  factions.flag: {description: manage faction flags, default: false}
 | 
				
			||||||
  factions.flag.set: {description: set faction flags, default: false}
 | 
					  factions.flag.set: {description: set faction flags, default: false}
 | 
				
			||||||
  factions.home: {description: teleport to faction home, default: false}
 | 
					  factions.home: {description: teleport to faction home, default: false}
 | 
				
			||||||
 | 
					  factions.home.other: {description: teleport to another faction home, default: false}
 | 
				
			||||||
  factions.invite: {description: set if player is invited, default: false}
 | 
					  factions.invite: {description: set if player is invited, default: false}
 | 
				
			||||||
  factions.join: {description: join faction, default: false}
 | 
					  factions.join: {description: join faction, default: false}
 | 
				
			||||||
  factions.join.any: {description: join closed faction, default: false}
 | 
					  factions.join.any: {description: join closed faction, default: false}
 | 
				
			||||||
@@ -59,6 +60,8 @@ permissions:
 | 
				
			|||||||
  factions.title.color: {description: set player title with color, default: false}
 | 
					  factions.title.color: {description: set player title with color, default: false}
 | 
				
			||||||
  factions.unclaim: {description: unclaim land where you stand, default: false}
 | 
					  factions.unclaim: {description: unclaim land where you stand, default: false}
 | 
				
			||||||
  factions.unclaimall: {description: unclaim all land, default: false}
 | 
					  factions.unclaimall: {description: unclaim all land, default: false}
 | 
				
			||||||
 | 
					  factions.unsethome: {description: unset faction home, default: false}
 | 
				
			||||||
 | 
					  factions.unsethome.other: {description: unset other faction home, default: false}
 | 
				
			||||||
  factions.version: {description: see plugin version, default: false}
 | 
					  factions.version: {description: see plugin version, default: false}
 | 
				
			||||||
# -------------------------------------------- #
 | 
					# -------------------------------------------- #
 | 
				
			||||||
# STAR NOTATION
 | 
					# STAR NOTATION
 | 
				
			||||||
@@ -81,6 +84,7 @@ permissions:
 | 
				
			|||||||
      factions.flag: true
 | 
					      factions.flag: true
 | 
				
			||||||
      factions.flag.set: true
 | 
					      factions.flag.set: true
 | 
				
			||||||
      factions.home: true
 | 
					      factions.home: true
 | 
				
			||||||
 | 
					      factions.home.other: true
 | 
				
			||||||
      factions.invite: true
 | 
					      factions.invite: true
 | 
				
			||||||
      factions.join: true
 | 
					      factions.join: true
 | 
				
			||||||
      factions.join.any: true
 | 
					      factions.join.any: true
 | 
				
			||||||
@@ -114,6 +118,8 @@ permissions:
 | 
				
			|||||||
      factions.title.color: true
 | 
					      factions.title.color: true
 | 
				
			||||||
      factions.unclaim: true
 | 
					      factions.unclaim: true
 | 
				
			||||||
      factions.unclaimall: true
 | 
					      factions.unclaimall: true
 | 
				
			||||||
 | 
					      factions.unsethome: true
 | 
				
			||||||
 | 
					      factions.unsethome.other: true
 | 
				
			||||||
      factions.version: true
 | 
					      factions.version: true
 | 
				
			||||||
# -------------------------------------------- #
 | 
					# -------------------------------------------- #
 | 
				
			||||||
# KITS
 | 
					# KITS
 | 
				
			||||||
@@ -142,6 +148,8 @@ permissions:
 | 
				
			|||||||
    children:
 | 
					    children:
 | 
				
			||||||
      factions.kit.rank0: true
 | 
					      factions.kit.rank0: true
 | 
				
			||||||
      factions.admin: true
 | 
					      factions.admin: true
 | 
				
			||||||
 | 
					      factions.home.other: true
 | 
				
			||||||
 | 
					      factions.unsethome.other: true
 | 
				
			||||||
  factions.kit.rank0:
 | 
					  factions.kit.rank0:
 | 
				
			||||||
    default: false
 | 
					    default: false
 | 
				
			||||||
    children:
 | 
					    children:
 | 
				
			||||||
@@ -187,6 +195,7 @@ permissions:
 | 
				
			|||||||
      factions.title.color: true
 | 
					      factions.title.color: true
 | 
				
			||||||
      factions.unclaim: true
 | 
					      factions.unclaim: true
 | 
				
			||||||
      factions.unclaimall: true
 | 
					      factions.unclaimall: true
 | 
				
			||||||
 | 
					      factions.unsethome: true
 | 
				
			||||||
      factions.version: true
 | 
					      factions.version: true
 | 
				
			||||||
  factions.kit.default:
 | 
					  factions.kit.default:
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user