2015-01-09 22:36:12 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Perm;
|
|
|
|
import com.massivecraft.factions.entity.MPerm;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2015-05-13 23:00:53 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.ArgSetting;
|
2015-01-09 22:36:12 +01:00
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
|
|
|
import com.massivecraft.massivecore.util.Txt;
|
|
|
|
|
|
|
|
public class CmdFactionsPermList extends FactionsCommand
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public CmdFactionsPermList()
|
|
|
|
{
|
|
|
|
// Aliases
|
|
|
|
this.addAliases("l", "list");
|
|
|
|
|
|
|
|
// Args
|
2015-05-13 23:00:53 +02:00
|
|
|
this.addArg(ArgSetting.getPage());
|
2015-01-09 22:36:12 +01:00
|
|
|
|
|
|
|
// Requirements
|
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.PERM_LIST.node));
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
@Override
|
2015-02-12 12:00:55 +01:00
|
|
|
public void perform() throws MassiveException
|
2015-01-09 22:36:12 +01:00
|
|
|
{
|
|
|
|
// Args
|
2015-05-13 23:00:53 +02:00
|
|
|
int page = this.readArg();
|
2015-01-09 22:36:12 +01:00
|
|
|
|
|
|
|
// Create messages
|
|
|
|
List<String> messages = new ArrayList<String>();
|
|
|
|
|
|
|
|
for (MPerm perm : MPerm.getAll())
|
|
|
|
{
|
|
|
|
if ( ! perm.isVisible() && ! msender.isUsingAdminMode()) continue;
|
|
|
|
messages.add(perm.getDesc(true, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Send messages
|
2015-09-03 09:33:01 +02:00
|
|
|
message(Txt.getPage(messages, page, "Available Faction Perms", sender));
|
2015-01-09 22:36:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|