Factions3/src/com/massivecraft/factions/cmd/CmdHelp.java

179 lines
7.7 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;
2011-03-23 17:39:56 +01:00
2011-10-09 20:10:19 +02:00
public class CmdHelp extends FCommand
{
2011-10-09 20:10:19 +02:00
public CmdHelp()
{
super();
this.aliases.add("help");
this.aliases.add("h");
this.aliases.add("?");
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
2011-10-09 21:57:43 +02:00
this.permission = Permission.HELP.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
2011-03-23 17:39:56 +01:00
@Override
public void perform()
{
2011-10-10 01:21:05 +02:00
if (helpPages == null) updateHelp();
int page = this.argAsInt(0, 1);
sendMessage(p.txt.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
page -= 1;
if (page < 0 || page >= helpPages.size())
{
2011-10-10 13:40:24 +02:00
msg("<b>This page does not exist");
return;
}
sendMessage(helpPages.get(page));
}
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
2011-10-10 01:21:05 +02:00
public ArrayList<ArrayList<String>> helpPages;
2011-10-10 01:21:05 +02:00
public void updateHelp()
{
helpPages = new ArrayList<ArrayList<String>>();
ArrayList<String> pageLines;
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdHelp.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdList.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdShow.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdPower.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdChat.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdHome.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add( p.txt.parse("<i>Learn how to create a faction on the next page.") );
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdCreate.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdDescription.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdTag.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add( p.txt.parse("<i>You might want to close it and use invitations:" ));
pageLines.add( p.cmdBase.cmdOpen.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdInvite.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdDeinvite.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add( p.txt.parse("<i>And don't forget to set your home:" ));
pageLines.add( p.cmdBase.cmdSethome.getUseageTemplate(true) );
2011-03-23 17:39:56 +01:00
helpPages.add(pageLines);
if (Econ.isSetup() && Conf.bankEnabled)
{
Some tweaking of the faction bank code... The new help page with bank related commands will now only be shown if banks are enabled and the Economy is enabled and hooked in. Shortened a couple of command descriptions to fit on one line. Made Deposit, Pay, and Withdraw commands additionally log to the server console/log. When bank is given to person disbanding a faction, it now lets them know and logs it to the server log. Added commands to commandDisable list in plugin.yml, along with "permanent" command which I'd missed adding before Added new permission node factions.viewAnyFactionBalance (granted by default if using superperms), which is required to view the bank balance of other factions For reference, about the faction bank addition as a whole... New conf.json settings: "bankEnabled": true, - enable faction banks "bankMembersCanWithdraw": false, - have to be at least moderator to withdraw or pay money to another faction, unless this is set to true "bankFactionPaysCosts": true, - if true, payments for faction command costs are charged to faction bank "bankFactionPaysLandCosts": true, - if true, payments for land claims are charged to faction bank New commands: /f balance *<faction tag> - Shows the bank balance of a specified faction (if permission checks out), or the player's faction if none is specified /f deposit <amount> - Deposit money into your faction's bank /f pay <faction tag> <amount> - Pay money from your faction bank to another faction (requires moderator or admin status) /f withdraw <amount> - Withdraw money from your faction's bank (requires moderator or admin status, unless "bankMembersCanWithdraw" is set to true) New permission node: factions.viewAnyFactionBalance - Allows the player to view the faction bank balance of all factions (default)
2011-10-01 12:59:09 +02:00
pageLines = new ArrayList<String>();
2011-10-10 01:21:05 +02:00
pageLines.add( p.txt.parse("<i>Your faction has a bank which is used to pay for certain" ));
pageLines.add( p.txt.parse("<i>things, so it will need to have money deposited into it." ));
pageLines.add( p.txt.parse("<i>To learn more, use the money command." ));
pageLines.add( "" );
pageLines.add( p.cmdBase.cmdMoney.getUseageTemplate(true) );
pageLines.add( "" );
Some tweaking of the faction bank code... The new help page with bank related commands will now only be shown if banks are enabled and the Economy is enabled and hooked in. Shortened a couple of command descriptions to fit on one line. Made Deposit, Pay, and Withdraw commands additionally log to the server console/log. When bank is given to person disbanding a faction, it now lets them know and logs it to the server log. Added commands to commandDisable list in plugin.yml, along with "permanent" command which I'd missed adding before Added new permission node factions.viewAnyFactionBalance (granted by default if using superperms), which is required to view the bank balance of other factions For reference, about the faction bank addition as a whole... New conf.json settings: "bankEnabled": true, - enable faction banks "bankMembersCanWithdraw": false, - have to be at least moderator to withdraw or pay money to another faction, unless this is set to true "bankFactionPaysCosts": true, - if true, payments for faction command costs are charged to faction bank "bankFactionPaysLandCosts": true, - if true, payments for land claims are charged to faction bank New commands: /f balance *<faction tag> - Shows the bank balance of a specified faction (if permission checks out), or the player's faction if none is specified /f deposit <amount> - Deposit money into your faction's bank /f pay <faction tag> <amount> - Pay money from your faction bank to another faction (requires moderator or admin status) /f withdraw <amount> - Withdraw money from your faction's bank (requires moderator or admin status, unless "bankMembersCanWithdraw" is set to true) New permission node: factions.viewAnyFactionBalance - Allows the player to view the faction bank balance of all factions (default)
2011-10-01 12:59:09 +02:00
pageLines.add( "" );
pageLines.add( "" );
helpPages.add(pageLines);
}
2011-09-24 03:22:53 +02:00
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdClaim.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdAutoClaim.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdUnclaim.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdUnclaimall.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdKick.getUseageTemplate(true) );
2011-10-23 17:55:53 +02:00
pageLines.add( p.cmdBase.cmdOfficer.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdLeader.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdTitle.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add( p.txt.parse("<i>Player titles are just for fun. No rules connected to them." ));
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdMap.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Claimed land with ownership set is further protected so"));
pageLines.add(p.txt.parse("<i>that only the owner(s), faction admin, and possibly the"));
pageLines.add(p.txt.parse("<i>faction moderators have full access."));
2011-07-31 03:17:00 +02:00
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
pageLines.add( p.cmdBase.cmdDisband.getUseageTemplate(true) );
pageLines.add("");
pageLines.add( p.cmdBase.cmdRelationAlly.getUseageTemplate(true) );
2011-10-23 22:08:57 +02:00
pageLines.add( p.cmdBase.cmdRelationTruce.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdRelationNeutral.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdRelationEnemy.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Set the relation you WISH to have with another faction."));
pageLines.add(p.txt.parse("<i>Your default relation with other factions will be neutral."));
pageLines.add(p.txt.parse("<i>If BOTH factions choose \"ally\" you will be allies."));
pageLines.add(p.txt.parse("<i>If ONE faction chooses \"enemy\" you will be enemies."));
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>You can never hurt members or allies."));
pageLines.add(p.txt.parse("<i>You can not hurt neutrals in their own territory."));
pageLines.add(p.txt.parse("<i>You can always hurt enemies and players without faction."));
pageLines.add("");
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Damage from enemies is reduced in your own territory."));
pageLines.add(p.txt.parse("<i>When you die you lose power. It is restored over time."));
pageLines.add(p.txt.parse("<i>The power of a faction is the sum of all member power."));
pageLines.add(p.txt.parse("<i>The power of a faction determines how much land it can hold."));
pageLines.add(p.txt.parse("<i>You can claim land from factions with too little power."));
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Only faction members can build and destroy in their own"));
pageLines.add(p.txt.parse("<i>territory. Usage of the following items is also restricted:"));
pageLines.add(p.txt.parse("<i>Door, Chest, Furnace, Dispenser, Diode."));
2011-03-23 17:39:56 +01:00
pageLines.add("");
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Make sure to put pressure plates in front of doors for your"));
pageLines.add(p.txt.parse("<i>guest visitors. Otherwise they can't get through. You can"));
pageLines.add(p.txt.parse("<i>also use this to create member only areas."));
pageLines.add(p.txt.parse("<i>As dispensers are protected, you can create traps without"));
pageLines.add(p.txt.parse("<i>worrying about those arrows getting stolen."));
2011-03-23 17:39:56 +01:00
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add("Finally some commands for the server admins:");
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) );
2011-10-23 17:41:47 +02:00
pageLines.add(p.txt.parse("<c>/f claim safezone <i>claim land for the Safe Zone"));
pageLines.add(p.txt.parse("<c>/f claim warzone <i>claim land for the War Zone"));
pageLines.add(p.txt.parse("<c>/f autoclaim [safezone|warzone] <i>take a guess"));
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
pageLines.add( p.cmdBase.cmdChatSpy.getUseageTemplate(true) );
2011-10-10 01:21:05 +02:00
pageLines.add(p.txt.parse("<i>Peaceful factions are protected from PvP and land capture."));
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate(true) );
helpPages.add(pageLines);
}
}