2018-12-21 02:41:42 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.entity.Faction;
|
|
|
|
import com.massivecraft.factions.entity.MPlayer;
|
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
|
|
|
|
|
|
|
public class CmdFactionsRankEdit extends FactionsCommand
|
|
|
|
{
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// FIELDS
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
|
|
|
public CmdFactionsRankEditCreate cmdFactionsRankEditCreate = new CmdFactionsRankEditCreate();
|
|
|
|
public CmdFactionsRankEditDelete cmdFactionsRankEditDelete = new CmdFactionsRankEditDelete();
|
|
|
|
public CmdFactionsRankEditName cmdFactionsRankEditName = new CmdFactionsRankEditName();
|
|
|
|
public CmdFactionsRankEditPrefix cmdFactionsRankEditPrefix = new CmdFactionsRankEditPrefix();
|
|
|
|
public CmdFactionsRankEditPriority cmdFactionsRankEditPriority = new CmdFactionsRankEditPriority();
|
|
|
|
|
2019-01-03 15:23:06 +01:00
|
|
|
static void ensureAllowed(MPlayer msender, Faction faction, String action) throws MassiveException
|
2018-12-21 02:41:42 +01:00
|
|
|
{
|
|
|
|
if (msender.isOverriding()) return;
|
|
|
|
|
|
|
|
if (faction != msender.getFaction())
|
|
|
|
{
|
|
|
|
throw new MassiveException().addMsg("<b>You can't manage ranks outside your own faction.");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!msender.getRank().isLeader())
|
|
|
|
{
|
2019-01-03 15:23:06 +01:00
|
|
|
throw new MassiveException().addMsg("<b>Only the leader can %s ranks.", action);
|
2018-12-21 02:41:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|