Add Expansions command and placeholders.
This commit is contained in:
@@ -36,6 +36,7 @@ public class CmdFactions extends FactionsCommand
|
||||
public CmdFactionsOfficer cmdFactionsOfficer = new CmdFactionsOfficer();
|
||||
public CmdFactionsLeader cmdFactionsLeader = new CmdFactionsLeader();
|
||||
public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney();
|
||||
public CmdFactionsXPlaceholder cmdFactionsTax = new CmdFactionsXPlaceholder("FactionsTax", "tax");
|
||||
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
|
||||
public CmdFactionsSeeChunkOld cmdFactionsSeeChunkOld = new CmdFactionsSeeChunkOld();
|
||||
public CmdFactionsAccess cmdFactionsAccess = new CmdFactionsAccess();
|
||||
@@ -46,6 +47,8 @@ public class CmdFactions extends FactionsCommand
|
||||
public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
|
||||
public CmdFactionsFlag cmdFactionsFlag = new CmdFactionsFlag();
|
||||
public CmdFactionsDisband cmdFactionsDisband = new CmdFactionsDisband();
|
||||
public CmdFactionsExpansions cmdFactionsExpansions = new CmdFactionsExpansions();
|
||||
public CmdFactionsXPlaceholder cmdFactionsDynmap = new CmdFactionsXPlaceholder("FactionsDynmap", "dynmap");
|
||||
public CmdFactionsAdmin cmdFactionsAdmin = new CmdFactionsAdmin();
|
||||
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
|
||||
public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version");
|
||||
@@ -80,6 +83,7 @@ public class CmdFactions extends FactionsCommand
|
||||
this.addSubCommand(this.cmdFactionsOfficer);
|
||||
this.addSubCommand(this.cmdFactionsLeader);
|
||||
this.addSubCommand(this.cmdFactionsMoney);
|
||||
this.addSubCommand(this.cmdFactionsTax);
|
||||
this.addSubCommand(this.cmdFactionsSeeChunk);
|
||||
this.addSubCommand(this.cmdFactionsSeeChunkOld);
|
||||
this.addSubCommand(this.cmdFactionsAccess);
|
||||
@@ -90,6 +94,8 @@ public class CmdFactions extends FactionsCommand
|
||||
this.addSubCommand(this.cmdFactionsPerm);
|
||||
this.addSubCommand(this.cmdFactionsFlag);
|
||||
this.addSubCommand(this.cmdFactionsDisband);
|
||||
this.addSubCommand(this.cmdFactionsExpansions);
|
||||
this.addSubCommand(this.cmdFactionsDynmap);
|
||||
this.addSubCommand(this.cmdFactionsAdmin);
|
||||
this.addSubCommand(this.cmdFactionsPowerBoost);
|
||||
this.addSubCommand(this.cmdFactionsVersion);
|
||||
|
@@ -0,0 +1,53 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.massivecraft.factions.event.EventFactionsExpansions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsExpansions extends FactionsCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsExpansions()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("e", "expansions");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqHasPerm.get(Perm.EXPANSIONS.node));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// Event
|
||||
EventFactionsExpansions event = new EventFactionsExpansions(sender);
|
||||
event.run();
|
||||
|
||||
// Title
|
||||
msg(Txt.titleize("Factions Expansions"));
|
||||
|
||||
// Lines
|
||||
for (Entry<String, Boolean> entry : event.getExpansions().entrySet())
|
||||
{
|
||||
String name = entry.getKey();
|
||||
Boolean installed = entry.getValue();
|
||||
String format = (installed ? "<g>[X] <h>%s" : "<b>[ ] <h>%s");
|
||||
msg(format, name);
|
||||
}
|
||||
|
||||
// URL Suggestion
|
||||
msg("<i>Learn all about expansions in the online documentation:");
|
||||
msg("<aqua>http://www.massivecraft.com/factions");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
public class CmdFactionsXPlaceholder extends FactionsCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public String extensionName;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsXPlaceholder(String extensionName, String... aliases)
|
||||
{
|
||||
// Fields
|
||||
this.extensionName = extensionName;
|
||||
|
||||
// Aliases
|
||||
this.addAliases(aliases);
|
||||
|
||||
// Desc
|
||||
this.setDesc("Use " + extensionName);
|
||||
|
||||
// Args
|
||||
this.setErrorOnToManyArgs(false);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
msg("<b>The extension <h>%s <b>isn't installed.", this.extensionName);
|
||||
msg("<g>Learn more and download the extension here:");
|
||||
msg("<aqua>http://www.massivecraft.com/%s", this.extensionName.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user