Factions/src/com/massivecraft/factions/commands/CmdHelp.java

190 lines
7.3 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
import java.util.ArrayList;
2011-07-18 22:06:02 +02:00
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");
this.permission = Permission.COMMAND_HELP.node;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
2011-03-23 17:39:56 +01:00
@Override
public void perform()
{
int page = this.argAsInt(0, 1);
sendMessage(p.txt.titleize("Factions Help ("+page+"/"+helpPages.size()+")"));
page -= 1;
if (page < 0 || page >= helpPages.size())
{
sendMessageParsed("<b>This page does not exist");
return;
}
sendMessage(helpPages.get(page));
}
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
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
public static ArrayList<ArrayList<String>> helpPages;
public static void updateHelp()
{
helpPages = new ArrayList<ArrayList<String>>();
ArrayList<String> pageLines;
pageLines = new ArrayList<String>();
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdHelp().getUseageTemplate() );
pageLines.add( new CmdList().getUseageTemplate() );
pageLines.add( new CmdShow().getUseageTemplate() );
pageLines.add( new CmdPower().getUseageTemplate() );
pageLines.add( new CmdJoin().getUseageTemplate() );
pageLines.add( new CmdLeave().getUseageTemplate() );
pageLines.add( new CmdChat().getUseageTemplate() );
pageLines.add( new CmdHome().getUseageTemplate() );
2011-03-23 17:39:56 +01:00
pageLines.add( "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>();
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdCreate().getUseageTemplate() );
pageLines.add( new CmdDescription().getUseageTemplate() );
pageLines.add( new CmdTag().getUseageTemplate() );
pageLines.add( "You might want to close it and use invitations:" );
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdOpen().getUseageTemplate() );
pageLines.add( new CmdInvite().getUseageTemplate() );
pageLines.add( new CmdDeinvite().getUseageTemplate() );
2011-03-23 17:39:56 +01:00
pageLines.add( "And don't forget to set your home:" );
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdSethome().getUseageTemplate() );
2011-03-23 17:39:56 +01:00
helpPages.add(pageLines);
if (Econ.enabled() && 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>();
pageLines.add( "" );
pageLines.add( "Your faction has a bank which is used to pay for certain" );
pageLines.add( "things, so it will need to have money deposited into it." );
pageLines.add( "" );
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdBalance().getUseageTemplate() );
pageLines.add( new CmdDeposit().getUseageTemplate() );
pageLines.add( new CmdWithdraw().getUseageTemplate() );
pageLines.add( new CmdPay().getUseageTemplate() );
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( "" );
helpPages.add(pageLines);
}
2011-09-24 03:22:53 +02:00
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdClaim().getUseageTemplate() );
pageLines.add( new CmdAutoClaim().getUseageTemplate() );
pageLines.add( new CmdUnclaim().getUseageTemplate() );
pageLines.add( new CmdUnclaimall().getUseageTemplate() );
pageLines.add( new CmdKick().getUseageTemplate() );
pageLines.add( new CmdMod().getUseageTemplate() );
pageLines.add( new CmdAdmin().getUseageTemplate() );
pageLines.add( new CmdTitle().getUseageTemplate() );
2011-03-23 17:39:56 +01:00
pageLines.add( "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>();
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdMap().getUseageTemplate() );
pageLines.add( new CmdBoom().getUseageTemplate() );
2011-07-31 03:17:00 +02:00
pageLines.add("");
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdOwner().getUseageTemplate() );
pageLines.add( new CmdOwnerList().getUseageTemplate() );
2011-07-31 03:17:00 +02:00
pageLines.add("");
pageLines.add("Claimed land with ownership set is further protected so");
pageLines.add("that only the owner(s), faction admin, and possibly the");
pageLines.add("faction moderators have full access.");
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdDisband().getUseageTemplate() );
pageLines.add("");
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdRelationAlly().getUseageTemplate() );
pageLines.add( new CmdRelationNeutral().getUseageTemplate() );
pageLines.add( new CmdRelationEnemy().getUseageTemplate() );
2011-03-23 17:39:56 +01:00
pageLines.add("Set the relation you WISH to have with another faction.");
pageLines.add("Your default relation with other factions will be neutral.");
pageLines.add("If BOTH factions choose \"ally\" you will be allies.");
pageLines.add("If ONE faction chooses \"enemy\" you will be enemies.");
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add("You can never hurt members or allies.");
pageLines.add("You can not hurt neutrals in their own territory.");
pageLines.add("You can always hurt enemies and players without faction.");
pageLines.add("");
2011-03-23 17:39:56 +01:00
pageLines.add("Damage from enemies is reduced in your own territory.");
pageLines.add("When you die you lose power. It is restored over time.");
pageLines.add("The power of a faction is the sum of all member power.");
pageLines.add("The power of a faction determines how much land it can hold.");
pageLines.add("You can claim land from factions with too little power.");
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
2011-03-23 17:39:56 +01:00
pageLines.add("Only faction members can build and destroy in their own");
pageLines.add("territory. Usage of the following items is also restricted:");
pageLines.add("Door, Chest, Furnace, Dispenser, Diode.");
2011-03-23 17:39:56 +01:00
pageLines.add("");
pageLines.add("Make sure to put pressure plates in front of doors for your");
pageLines.add("guest visitors. Otherwise they can't get through. You can");
pageLines.add("also use this to create member only areas.");
pageLines.add("As dispensers are protected, you can create traps without");
pageLines.add("worrying about those arrows getting stolen.");
helpPages.add(pageLines);
2011-03-23 17:39:56 +01:00
pageLines = new ArrayList<String>();
pageLines.add("Finally some commands for the server admins:");
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdBypass().getUseageTemplate() );
pageLines.add( new CmdSafeclaim().getUseageTemplate() );
pageLines.add( new CmdAutoSafeclaim().getUseageTemplate() );
pageLines.add( new CmdSafeunclaimall().getUseageTemplate() );
pageLines.add( new CmdWarclaim().getUseageTemplate() );
pageLines.add( new CmdAutoWarclaim().getUseageTemplate() );
pageLines.add( new CmdWarunclaimall().getUseageTemplate() );
pageLines.add("Note: " + new CmdUnclaim().getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.");
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
pageLines.add("More commands for server admins:");
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdPeaceful().getUseageTemplate() );
pageLines.add( new CmdPermanent().getUseageTemplate() );
New "peaceful" status for factions which can only be set by server admins/moderators. Members of peaceful factions cannot deal or receive PvP damage (unless in a war zone which has friendly fire enabled), cannot claim land from another faction and likewise can't have their land claimed, and cannot be considered as ally or enemy of any other faction. Faction admins and moderators of peaceful factions can enable/disable all explosions inside their faction's territory at will. The main purpose of this is to provide a way for more peaceful players who don't want to take part in faction wars (or just want to take a break from them) to still have fun on the server. It is also meant to allow groups of players to make protected buildings, monuments, grand constructions, and so forth without having to worry about another faction destroying them. New conf.json settings: "peacefulTerritoryDisablePVP" (default true) prevents PvP damage for anyone inside a peaceful faction's territory "peacefulTerritoryDisableMonsters" (default false) provides protection against monsters spawning or attacking inside a peaceful faction's territory "peacefulMembersDisablePowerLoss" (default true) which keeps members of peaceful factions from suffering power loss when they die. New commands: /f peaceful [faction tag] - toggle the indicated faction's "peaceful" status /f noboom - enable/disable explosions inside your faction's territory; only available to faction admin and faction moderators for peaceful factions New permission nodes: factions.setPeaceful - ability to use the /f peaceful command (admins) factions.peacefulExplosionToggle - ability to use /f noboom (everyone)
2011-08-05 10:50:47 +02:00
pageLines.add("Peaceful factions are protected from PvP and land capture.");
2011-10-09 20:10:19 +02:00
pageLines.add( new CmdLock().getUseageTemplate() );
pageLines.add( new CmdReload().getUseageTemplate() );
pageLines.add( new CmdSaveAll().getUseageTemplate() );
pageLines.add( new CmdVersion().getUseageTemplate() );
pageLines.add( new CmdConfig().getUseageTemplate() );
helpPages.add(pageLines);
}
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
static
{
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
updateHelp();
}
}