Better Factions in-game documentation
This commit is contained in:
		@@ -27,6 +27,8 @@ public enum Perm implements Identified
 | 
			
		||||
	DESCRIPTION,
 | 
			
		||||
	DISBAND,
 | 
			
		||||
	DOCUMENTATION,
 | 
			
		||||
	DOCUMENTATION_FLAGS,
 | 
			
		||||
	DOCUMENTATION_PERMS,
 | 
			
		||||
	DOCUMENTATION_POWER,
 | 
			
		||||
	DOCUMENTATION_RANKS,
 | 
			
		||||
	EXPANSIONS,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,27 @@
 | 
			
		||||
package com.massivecraft.factions.cmd;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.Factions;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
 | 
			
		||||
public class CmdFactionsDocumentation extends FactionsCommand
 | 
			
		||||
{
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// CONSTRUCT
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
 | 
			
		||||
	public CmdFactionsDocumentation()
 | 
			
		||||
	{
 | 
			
		||||
		String web = Factions.get().getDescription().getWebsite();
 | 
			
		||||
		this.setHelp(mson("More help can be found at ", mson(web).link(web).color(ChatColor.AQUA)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// FIELDS
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	
 | 
			
		||||
	public CmdFactionsDocumentationPower cmdFactionsDocumentationPower = new CmdFactionsDocumentationPower();
 | 
			
		||||
	public CmdFactionsDocumentationRanks cmdFactionsDocumentationRanks = new CmdFactionsDocumentationRanks();
 | 
			
		||||
	public CmdFactionsDocumentationFlags cmdFactionsDocumentationFlags = new CmdFactionsDocumentationFlags();
 | 
			
		||||
	public CmdFactionsDocumentationPerms cmdFactionsDocumentationPerms = new CmdFactionsDocumentationPerms();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
package com.massivecraft.factions.cmd;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.entity.MFlag;
 | 
			
		||||
import com.massivecraft.factions.entity.MFlagColl;
 | 
			
		||||
import com.massivecraft.massivecore.MassiveException;
 | 
			
		||||
import com.massivecraft.massivecore.util.Txt;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
public class CmdFactionsDocumentationFlags extends FactionsCommandDocumentation
 | 
			
		||||
{
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// CONSTRUCT
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
 | 
			
		||||
	public CmdFactionsDocumentationFlags()
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// OVERRIDE
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void perform() throws MassiveException
 | 
			
		||||
	{
 | 
			
		||||
		msgDoc("Flags are a way to give certain factions certain attributes " +
 | 
			
		||||
				   " such as disabling pvp or enabling friendly fire.");
 | 
			
		||||
		msgDoc("To see all the flags type:");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsFlag.cmdFactionsFlagList.getTemplate(false, true, sender));
 | 
			
		||||
 | 
			
		||||
		List<String> flags = MFlagColl.get().getAll(MFlag::isEditable).stream().map(flag -> Txt.parse("<h>%s", flag.getName())).collect(Collectors.toList());
 | 
			
		||||
		String str = Txt.implodeCommaAndDot(flags, Txt.parse("<i>"));
 | 
			
		||||
		msgDoc("The flags you can edit for your faction are: %s", str);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,45 @@
 | 
			
		||||
package com.massivecraft.factions.cmd;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.massivecore.MassiveException;
 | 
			
		||||
 | 
			
		||||
public class CmdFactionsDocumentationPerms extends FactionsCommandDocumentation
 | 
			
		||||
{
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// CONSTRUCT
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
 | 
			
		||||
	public CmdFactionsDocumentationPerms()
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// OVERRIDE
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void perform() throws MassiveException
 | 
			
		||||
	{
 | 
			
		||||
		msgDoc("Permissions decide who can do what in your faction. " +
 | 
			
		||||
				   "Permissions can be given to a rank, a player, a relation, " +
 | 
			
		||||
				   "everyone in another faction or everyone with a specific rank in another faction.");
 | 
			
		||||
		msgDoc("Because perms can be given to all of these groups individually, it allows for extreme degrees of fine tuning.");
 | 
			
		||||
 | 
			
		||||
		msgDoc("To list all permissions type:");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsPerm.cmdFactionsPermList.getTemplate(false, true, sender));
 | 
			
		||||
 | 
			
		||||
		msgDoc("To see who has a specific perm type:");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsPerm.cmdFactionsPermShow.getTemplate(false, true, sender));
 | 
			
		||||
 | 
			
		||||
		msgDoc("Per default permissions are only granted to ranks within your faction " +
 | 
			
		||||
				   "and a few perms are given to allies, but if you have changed it that will be displayed by the command above.");
 | 
			
		||||
		msgDoc("When you create a new rank, you will have to set up their perms from scratch.");
 | 
			
		||||
 | 
			
		||||
		msgDoc("If you want to know what permissions are specifically given to someone do:");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsPerm.cmdFactionsPermView.getTemplate(false, true, sender));
 | 
			
		||||
 | 
			
		||||
		msgDoc("To set perms do: ");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsPerm.cmdFactionsPermSet.getTemplate(false, true, sender));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -3,7 +3,7 @@ package com.massivecraft.factions.cmd;
 | 
			
		||||
import com.massivecraft.factions.entity.MConf;
 | 
			
		||||
import com.massivecraft.massivecore.MassiveException;
 | 
			
		||||
 | 
			
		||||
public class CmdFactionsDocumentationPower extends FactionsCommand
 | 
			
		||||
public class CmdFactionsDocumentationPower extends FactionsCommandDocumentation
 | 
			
		||||
{
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// CONSTRUCT
 | 
			
		||||
@@ -21,16 +21,16 @@ public class CmdFactionsDocumentationPower extends FactionsCommand
 | 
			
		||||
	@Override
 | 
			
		||||
	public void perform() throws MassiveException
 | 
			
		||||
	{
 | 
			
		||||
		msg("<lime>1) <i>All players  have an amount of power ranging from <h>%.2f <i>to <h>%.2f<i>.", MConf.get().powerMin, MConf.get().powerMax);
 | 
			
		||||
		msg("<lime>2) <i>The power of a faction is equal to the combined power of all it's members.");
 | 
			
		||||
		msg("<lime>3) <i>Your power is <h>%.2f<i>", msender.getPower());
 | 
			
		||||
		msg("<lime>4) <i>Your faction's power is <h>%.2f<i>", msenderFaction.getPower());
 | 
			
		||||
		msg("<lime>5) <i>The amount of chunks a faction can claim is the amount power it has.");
 | 
			
		||||
		msg("<lime>6) <i>For every hour you are online you gain <h>%.2f <i>power.", MConf.get().powerPerHour);
 | 
			
		||||
		msg("<lime>7) <i>Every time you die you power is decreased by <h>%.2f <i>.", MConf.get().powerPerDeath*-1);
 | 
			
		||||
		msgDoc("All players  have an amount of power ranging from <h>%.2f <i>to <h>%.2f<i>.", MConf.get().powerMin, MConf.get().powerMax);
 | 
			
		||||
		msgDoc("The power of a faction is equal to the combined power of all it's members.");
 | 
			
		||||
		msgDoc("Your power is <h>%.2f<i>", msender.getPower());
 | 
			
		||||
		msgDoc("Your faction's power is <h>%.2f<i>", msenderFaction.getPower());
 | 
			
		||||
		msgDoc("The amount of chunks a faction can claim is the amount power it has.");
 | 
			
		||||
		msgDoc("For every hour you are online you gain <h>%.2f <i>power.", MConf.get().powerPerHour);
 | 
			
		||||
		msgDoc("Every time you die you power is decreased by <h>%.2f <i>.", MConf.get().powerPerDeath*-1);
 | 
			
		||||
		if (!MConf.get().canLeaveWithNegativePower && MConf.get().powerMin < 0)
 | 
			
		||||
		{
 | 
			
		||||
			msg("8) <i>You can't leave a faction if your power is negative.");
 | 
			
		||||
			msgDoc("You can't leave a faction if your power is negative.");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,12 +4,13 @@ import com.massivecraft.factions.entity.Rank;
 | 
			
		||||
import com.massivecraft.massivecore.MassiveException;
 | 
			
		||||
import com.massivecraft.massivecore.mson.Mson;
 | 
			
		||||
import com.massivecraft.massivecore.util.Txt;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
 | 
			
		||||
import java.util.Comparator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
public class CmdFactionsDocumentationRanks extends FactionsCommand
 | 
			
		||||
public class CmdFactionsDocumentationRanks extends FactionsCommandDocumentation
 | 
			
		||||
{
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// CONSTRUCT
 | 
			
		||||
@@ -27,27 +28,27 @@ public class CmdFactionsDocumentationRanks extends FactionsCommand
 | 
			
		||||
	@Override
 | 
			
		||||
	public void perform() throws MassiveException
 | 
			
		||||
	{
 | 
			
		||||
		int i = 1;
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>Ranks divide the faction into groups.");
 | 
			
		||||
		msgDoc("Ranks divide the faction into groups.");
 | 
			
		||||
 | 
			
		||||
		List<Rank> ranks = msenderFaction.getRanks().getAll(Comparator.comparingInt(Rank::getPriority).reversed());
 | 
			
		||||
		List<String> rankDesc = ranks.stream().map(r -> r.getDisplayName(msender)).collect(Collectors.toList());
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>Your faction has: <reset>%s", Txt.implodeCommaAndDot(rankDesc, Txt.parse("<i>")));
 | 
			
		||||
		msgDoc("Your faction has: <reset>%s", Txt.implodeCommaAndDot(rankDesc, Txt.parse("<i>")));
 | 
			
		||||
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>Ranks can have a prefix that will be prepended before any player name. Prefixes can be coloured.");
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>All ranks have a priority showed in parentheses after the name.");
 | 
			
		||||
		msgDoc("Ranks can have a prefix that will be prepended before any player name. Prefixes can be coloured.");
 | 
			
		||||
		msgDoc("All ranks have a priority showed in parentheses after the name.");
 | 
			
		||||
 | 
			
		||||
		Mson msonLeader = Mson.parse("<lime>" + i++ + ") <i>The rank with the highest priority is deemed the “leader rank”" +
 | 
			
		||||
										 "(can be renamed) and only one person can have that rank");
 | 
			
		||||
		msonLeader = msonLeader.tooltip("For yor faction the leader rank is" + rankDesc.get(0));
 | 
			
		||||
		message(msonLeader);
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>Whenever a new person joins the faction they will be assigned the rank with the lowest priority.");
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>Priorities are important because they determine who can do what." +
 | 
			
		||||
		Mson msonLeader = mson("The rank with the highest priority is deemed the “leader rank”" +
 | 
			
		||||
										 "(can be renamed) and only one person can have that rank")
 | 
			
		||||
		.tooltip("For yor faction the leader rank is" + rankDesc.get(0))
 | 
			
		||||
		.color(ChatColor.YELLOW);
 | 
			
		||||
		messageDoc(msonLeader);
 | 
			
		||||
		msgDoc("Whenever a new person joins the faction they will be assigned the rank with the lowest priority.");
 | 
			
		||||
		msgDoc("Priorities are important because they determine who can do what." +
 | 
			
		||||
				"For example: you can’t kick someone with the same or higher rank than yourself." +
 | 
			
		||||
				"So if you have both Officers, and Co-leaders, do not fear officers kicking co-leaders or the co-leaders kicking each other." +
 | 
			
		||||
				"They can’t. The same goes for changing ranks, titles and other similar things.");
 | 
			
		||||
 | 
			
		||||
		msg("<lime>" + i++ + ") <i>To show, set or edit ranks do:");
 | 
			
		||||
		msgDoc("To show, set or edit ranks do:");
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsRank.getTemplate(false, true, sender));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,8 @@ public class CmdFactionsPermView extends FactionsCommand
 | 
			
		||||
			Mson msons = Mson.implode(MUtil.list(msonFaction, msonRelation), Mson.SPACE);
 | 
			
		||||
			message(mson(mson("Commands: ").color(ChatColor.YELLOW), msons));
 | 
			
		||||
		}
 | 
			
		||||
		msg("<i>To view all perms held by %s <i>type:", permable.getDisplayName(sender));
 | 
			
		||||
		message(CmdFactions.get().cmdFactionsPerm.cmdFactionsPermViewall.getTemplateWithArgs(sender, MUtil.list(permable.getName(), faction.getName())));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.massivecraft.factions.cmd;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.cmd.req.ReqFactionHomesEnabled;
 | 
			
		||||
import com.massivecraft.massivecore.mson.Mson;
 | 
			
		||||
 | 
			
		||||
public class FactionsCommandDocumentation extends FactionsCommand
 | 
			
		||||
{
 | 
			
		||||
@@ -35,10 +36,16 @@ public class FactionsCommandDocumentation extends FactionsCommand
 | 
			
		||||
	// MESSAGE
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
 | 
			
		||||
	public void msgDoc(String msg, String... args)
 | 
			
		||||
	public void msgDoc(String msg, Object... args)
 | 
			
		||||
	{
 | 
			
		||||
		msg = "<lime>" + this.num++ + ") <i>";
 | 
			
		||||
		msg = "<lime>" + this.num++ + ") <i>" + msg;
 | 
			
		||||
		msg(msg, args);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void messageDoc(Mson message)
 | 
			
		||||
	{
 | 
			
		||||
		Mson mson = mson(Mson.parse("<lime>" + this.num++ + ") "), message);
 | 
			
		||||
		message(mson);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user