2012-05-09 03:24:07 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
2013-04-09 13:24:55 +02:00
|
|
|
import com.massivecraft.factions.FPerm;
|
2013-04-16 11:05:49 +02:00
|
|
|
import com.massivecraft.factions.cmd.arg.ARFaction;
|
2013-04-22 09:37:53 +02:00
|
|
|
import com.massivecraft.factions.entity.Faction;
|
2012-05-09 03:24:07 +02:00
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public abstract class CmdFactionsCapeAbstract extends FCommand
|
2012-05-09 03:24:07 +02:00
|
|
|
{
|
|
|
|
public Faction capeFaction;
|
|
|
|
public String currentCape;
|
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsCapeAbstract()
|
2012-05-09 03:24:07 +02:00
|
|
|
{
|
2013-04-16 10:30:21 +02:00
|
|
|
this.addOptionalArg("faction", "you");
|
2012-05-09 03:24:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean validCall(CommandSender sender, List<String> args)
|
|
|
|
{
|
|
|
|
this.capeFaction = null;
|
|
|
|
this.currentCape = null;
|
|
|
|
|
|
|
|
if (this.myFaction == null && ! this.argIsSet(this.requiredArgs.size()))
|
|
|
|
{
|
|
|
|
msg("<b>You must specify a faction from console.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-04-16 11:05:49 +02:00
|
|
|
this.capeFaction = this.arg(this.requiredArgs.size(), ARFaction.get(), this.myFaction);
|
2012-05-09 03:24:07 +02:00
|
|
|
if (this.capeFaction == null) return false;
|
|
|
|
|
|
|
|
// Do we have permission to manage the cape of that faction?
|
|
|
|
if (fme != null && ! FPerm.CAPE.has(fme, capeFaction)) return false;
|
|
|
|
|
|
|
|
this.currentCape = this.capeFaction.getCape();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|