Rank cmd rework

This commit is contained in:
Magnus Ulf 2014-12-28 17:22:53 +01:00 committed by Olof Larsson
parent 7a674468c8
commit 68fe1f2d28
10 changed files with 518 additions and 362 deletions

View File

@ -23,7 +23,6 @@ public enum Perm
CLAIM_CIRCLE("claim.circle"),
CLAIM_ALL("claim.all"),
CREATE("create"),
DEMOTE("demote"),
DESCRIPTION("description"),
DISBAND("disband"),
EXPANSIONS("expansions"),
@ -35,8 +34,6 @@ public enum Perm
JOIN_ANY("join.any"),
JOIN_OTHERS("join.others"),
KICK("kick"),
LEADER("leader"),
LEADER_ANY("leader.any"),
LEAVE("leave"),
LIST("list"),
MAP("map"),
@ -49,13 +46,13 @@ public enum Perm
MONEY_P2F("money.p2f"),
MONEY_WITHDRAW("money.withdraw"),
MOTD("motd"),
OFFICER("officer"),
OFFICER_ANY("officer.any"),
OPEN("open"),
PERM("perm"),
PLAYER("player"),
POWERBOOST("powerboost"),
PROMOTE("promote"),
RANK("rank"),
RANK_SHOW("rank.show"),
RANK_ACTION("rank.action"),
RELATION("relation"),
SEECHUNK("seechunk"),
SEECHUNKOLD("seechunkold"),

View File

@ -30,10 +30,11 @@ public class CmdFactions extends FactionsCommand
public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
public CmdFactionsPromote cmdFactionsPromote = new CmdFactionsPromote();
public CmdFactionsDemote cmdFactionsDemote = new CmdFactionsDemote();
public CmdFactionsOfficer cmdFactionsOfficer = new CmdFactionsOfficer();
public CmdFactionsLeader cmdFactionsLeader = new CmdFactionsLeader();
public CmdFactionsRank cmdFactionsRank = new CmdFactionsRank();
public CmdFactionsRankOld cmdFactionsRankOldLeader = new CmdFactionsRankOld("leader");
public CmdFactionsRankOld cmdFactionsRankOldOfficer = new CmdFactionsRankOld("officer");
public CmdFactionsRankOld cmdFactionsRankOldPromote = new CmdFactionsRankOld("promote");
public CmdFactionsRankOld cmdFactionsRankOldDemote = new CmdFactionsRankOld("demote");
public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney();
public CmdFactionsSeeChunk cmdFactionsSeeChunk = new CmdFactionsSeeChunk();
public CmdFactionsSeeChunkOld cmdFactionsSeeChunkOld = new CmdFactionsSeeChunkOld();
@ -78,10 +79,11 @@ public class CmdFactions extends FactionsCommand
this.addSubCommand(this.cmdFactionsInvite);
this.addSubCommand(this.cmdFactionsKick);
this.addSubCommand(this.cmdFactionsTitle);
this.addSubCommand(this.cmdFactionsPromote);
this.addSubCommand(this.cmdFactionsDemote);
this.addSubCommand(this.cmdFactionsOfficer);
this.addSubCommand(this.cmdFactionsLeader);
this.addSubCommand(this.cmdFactionsRank);
this.addSubCommand(this.cmdFactionsRankOldLeader);
this.addSubCommand(this.cmdFactionsRankOldOfficer);
this.addSubCommand(this.cmdFactionsRankOldPromote);
this.addSubCommand(this.cmdFactionsRankOldDemote);
this.addSubCommand(this.cmdFactionsMoney);
this.addSubCommand(this.cmdFactionsSeeChunk);
this.addSubCommand(this.cmdFactionsSeeChunkOld);

View File

@ -1,75 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsDemote extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsDemote()
{
// Aliases
this.addAliases("demote");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.DEMOTE.node));
//To demote someone from member -> recruit you must be an officer.
//To demote someone from officer -> member you must be a leader.
//We'll handle this internally
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != msenderFaction)
{
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (you == msender)
{
msg("<b>The target player mustn't be yourself.");
return;
}
if (you.getRole() == Rel.MEMBER)
{
if (!msender.getRole().isAtLeast(Rel.OFFICER))
{
msg("<b>You must be an officer to demote a member to recruit.");
return;
}
you.setRole(Rel.RECRUIT);
msenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(msenderFaction, true));
}
else if (you.getRole() == Rel.OFFICER)
{
if (!msender.getRole().isAtLeast(Rel.LEADER))
{
msg("<b>You must be the leader to demote an officer to member.");
return;
}
you.setRole(Rel.MEMBER);
msenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(msenderFaction, true));
}
}
}

View File

@ -1,109 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsLeader extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsLeader()
{
// Aliases
this.addAliases("leader");
// Args
this.addRequiredArg("player");
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.LEADER.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(), msenderFaction);
if (targetFaction == null) return;
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have mplayer and the target faction
if (this.senderIsConsole || msender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{
// Do whatever you wish
}
else
{
// Follow the standard rules
if (msender.getRole() != Rel.LEADER || targetFaction != msenderFaction)
{
sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc()));
return;
}
if (newLeader.getFaction() != msenderFaction)
{
msg("%s<i> is not a member in the faction.", newLeader.describeTo(msender, true));
return;
}
if (newLeader == msender)
{
msg("<b>The target player musn't be yourself.");
return;
}
}
// only run event when newLeader isn't actually in the faction
if (newLeader.getFaction() != targetFaction)
{
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, newLeader, targetFaction, MembershipChangeReason.LEADER);
event.run();
if (event.isCancelled()) return;
}
// if target player is currently leader, demote and replace him
if (targetFactionCurrentLeader == newLeader)
{
targetFaction.promoteNewLeader();
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(msender, true));
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", msender.describeTo(newLeader, true));
return;
}
// Perform the switching
if (targetFactionCurrentLeader != null)
{
targetFactionCurrentLeader.setRole(Rel.OFFICER);
}
newLeader.setFaction(targetFaction);
newLeader.setRole(Rel.LEADER);
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(msender, true));
// Inform all players
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(msender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
}
}
}

View File

@ -1,81 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOfficer extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOfficer()
{
// Aliases
this.addAliases("officer");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.OFFICER.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
if (targetFaction != msenderFaction && !permAny)
{
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (msender != null && msender.getRole() != Rel.LEADER && !permAny)
{
msg("<b>You are not the faction leader.");
return;
}
if (you == msender && !permAny)
{
msg("<b>The target player musn't be yourself.");
return;
}
if (you.getRole() == Rel.LEADER)
{
msg("<b>The target player is a faction leader. Demote them first.");
return;
}
if (you.getRole() == Rel.OFFICER)
{
// Revoke
you.setRole(Rel.MEMBER);
targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have removed officer status from %s<i>.", you.describeTo(msender, true));
}
else
{
// Give
you.setRole(Rel.OFFICER);
targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have promoted %s<i> to officer.", you.describeTo(msender, true));
}
}
}

View File

@ -1,76 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPromote extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsPromote()
{
// Aliases
this.addAliases("promote");
// Args
this.addRequiredArg("player");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.PROMOTE.node));
//To promote someone from recruit -> member you must be an officer.
//To promote someone from member -> officer you must be a leader.
//We'll handle this internally
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != msenderFaction)
{
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (you == msender)
{
msg("<b>The target player mustn't be yourself.");
return;
}
if (you.getRole() == Rel.RECRUIT)
{
if (!msender.getRole().isAtLeast(Rel.OFFICER))
{
msg("<b>You must be an officer to promote someone to member.");
return;
}
you.setRole(Rel.MEMBER);
msenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(msenderFaction, true));
}
else if (you.getRole() == Rel.MEMBER)
{
if (!msender.getRole().isAtLeast(Rel.LEADER))
{
msg("<b>You must be the leader to promote someone to officer.");
return;
}
// Give
you.setRole(Rel.OFFICER);
msenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(msenderFaction, true));
}
}
}

View File

@ -0,0 +1,304 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.cmd.arg.ARRank;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsRank extends FactionsCommand
{
// -------------------------------------------- //
// CONSTANTS
// -------------------------------------------- //
// The rank required to do any rank changes
final static Rel rankReq = Rel.OFFICER;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
//These fields are set upon perform() and unset afterwards
//Target
private Faction targetFaction = null;
private MPlayer target = null;
//Roles
private Rel senderRole = null;
private Rel targetRole = null;
private Rel rank = null;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRank()
{
// Aliases
this.addAliases("r","rank");
// Args
this.addOptionalArg("player","you");
this.addOptionalArg("action", "show");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.RANK.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// This sets target and much other. Returns false if not succeeded
if(!registerFields())
{
return;
}
// Sometimes we just want to show the rank
if(!this.argIsSet(1))
{
if(!Perm.RANK_SHOW.has(sender, true))
{
return;
}
showRank();
return;
}
// Permission check
if(!Perm.RANK_ACTION.has(sender, true))
{
return;
}
// Is the player allowed or not. Method can be found later down
if(!isPlayerAllowed())
{
return;
}
// Does the change make sense.
if(!this.isChangeRequired())
{
return;
}
// Should we fire an event when rank is changed?
// Currently we don't
// Change the rank
changeRank();
}
// This is always run after performing a MassiveCommand
// It might be a bit hacky, but is easier than adding a line of code at every return statement
// Sometimes it is nice to know the exact mechanics of MassiveCore
@Override
public void unsetSenderVars()
{
super.unsetSenderVars();
this.unregisterFields();
}
// -------------------------------------------- //
// PRIVATE
// -------------------------------------------- //
private boolean registerFields()
{
// Getting the target and faction
target = this.arg(0, ARMPlayer.getAny(), msender);
if (null == target) return false;
targetFaction = target.getFaction();
// Rank if any passed.
if (this.argIsSet(1))
{
rank = this.arg(1, ARRank.get(target.getRole()));
if(null == rank) return false;
}
//Roles/ranks
senderRole = msender.getRole();
targetRole = target.getRole();
return true;
}
private void unregisterFields()
{
targetFaction = null;
target = null;
senderRole = null;
targetRole = null;
rank = null;
}
private void showRank()
{
String name = target.describeTo(msender) + (target == msender ? "r" : "'s");
msg(Txt.parse("%s <i>rank is %s", name, target.getColorTo(msender)+Txt.getNicedEnum(target.getRole())));
}
private boolean isPlayerAllowed()
{
// People with permission don't follow the normal rules
if (msender.isUsingAdminMode())
{
return true;
}
// If somone gets the leadership of wilderness (Which has happened before)
// We can at least try to limit their powers
if (targetFaction.isNone())
{
msg( "<b>Wilderness doesn't use ranks sorry :(" );
return false;
}
if (targetFaction != msenderFaction)
{
//Don't change ranks outside of your faction
msg(Txt.parse( "%s <b>is not in the same faction as you" ,target.describeTo(msender)));
return false;
}
if (target == msender)
{
// Don't change your own rank
msg("<b>The target player mustn't be yourself.");
return false;
}
if (senderRole.isLessThan(rankReq))
{
// You need a specific rank to change ranks
msg(Txt.parse("<b>You must be %s or higher to change ranks",Txt.getNicedEnum(rankReq).toLowerCase()));
return false;
}
// The following two if statements could be merged.
// But isn't for the sake of nicer error messages.
if (senderRole == targetRole)
{
// You can't change someones rank if it is equal to yours
msg(Txt.parse("<b>%s can't manage eachother",Txt.getNicedEnum(rankReq)+"s"));
return false;
}
if (senderRole.isLessThan(targetRole))
{
// You can't change someones rank if it is higher than yours
msg(Txt.parse("<b>You can't manage people higher ranked than you"));
return false;
}
if (senderRole.isAtMost(rank) && senderRole != Rel.LEADER)
{
// You can't set ranks equal to or higer than your own. Unless you are the leader
msg("<b>You can't set ranks higher than or equal to your own");
return false;
}
// If it wasn't cancelled above, player is allowe
return true;
}
private boolean isChangeRequired()
{
// Just a nice msg. It would however be caught by an if statement below
if (target.getRole() == Rel.RECRUIT && arg(1).equalsIgnoreCase("demote"))
{
msg("<b>You can't demote a recruit");
return false;
}
// Just a nice msg. It would however be caught by an if statement below
if (target.getRole() == Rel.LEADER && arg(1).equalsIgnoreCase("promote"))
{
msg("<b>You can't promote the leader");
return false;
}
// There must be a change, else it is all waste of time
if (target.getRole() == rank)
{
msg("<b>Player already has that rank");
return false;
}
return true;
}
private void changeRank()
{
// In case of leadership change, we do special things not done in other rank changes
if (rank == Rel.LEADER)
{
changeRankLeader();
}
else
{
changeRankOther();
}
}
private void changeRankLeader()
{
// If there is a current leader. Demote & inform them
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
if (targetFactionCurrentLeader != null)
{
// Inform & demote the old leader
targetFactionCurrentLeader.setRole(Rel.OFFICER);
if (targetFactionCurrentLeader != msender) //They kinda know if they fired the command themself
targetFactionCurrentLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", msender.describeTo(targetFactionCurrentLeader, true));
}
// Inform & promote the new leader
target.setRole(Rel.LEADER);
if (target != msender) //They kinda know if they fired the command themself
target.msg("<i>You have been promoted to the position of faction leader by %s<i>.", msender.describeTo(target, true));
// Inform the msg sender
msg("<i>You have promoted %s<i> to the position of faction leader.", target.describeTo(msender, true));
// Inform everyone
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
String changerName = senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(msender, mplayer, true);
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", changerName, target.describeTo(mplayer), targetFaction.describeTo(mplayer));
}
}
private void changeRankOther()
{
// If the target is currently the leader and faction isn't permanent...
if(targetRole == Rel.LEADER && (!MConf.get().permanentFactionsDisableLeaderPromotion
|| !targetFaction.getFlag(MFlag.ID_PERMANENT)))
{
// ...we must promote a new one
targetFaction.promoteNewLeader();
}
// Were they demoted or promoted?
String change = (rank.isLessThan(targetRole) ? "demoted" : "promoted");
// The rank will be set before the msg, so they have the appropriate prefix
target.setRole(rank);
String rankName = Txt.getNicedEnum(rank).toLowerCase();
msenderFaction.msg("%s<i> was %s to being %s %s in your faction.", target.describeTo(msenderFaction, true), change, Txt.aan(rankName), rankName);
}
}

View File

@ -0,0 +1,41 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.massivecore.cmd.VisibilityMode;
import com.massivecraft.massivecore.util.MUtil;
public class CmdFactionsRankOld extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
final String rankName;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsRankOld(String rank)
{
this.rankName = rank.toLowerCase();
// Aliases
this.addAliases(rankName);
// Args
this.addRequiredArg("player");
this.setVisibilityMode(VisibilityMode.INVISIBLE);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
Factions.get().getOuterCmdFactions().cmdFactionsRank.execute(sender, MUtil.list(arg(0),rankName));
}
}

View File

@ -0,0 +1,153 @@
package com.massivecraft.factions.cmd.arg;
import java.util.Collection;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.Rel;
import com.massivecraft.massivecore.cmd.arg.ARAbstractSelect;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
public class ARRank extends ARAbstractSelect<Rel>
{
//----------------------------------------------//
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
//Default constructor. Can't use promote and demote.
private static ARRank i = new ARRank();
public static ARRank get() { return i; }
public ARRank()
{
this.startRank = null;
}
//Fancy constructor. Can use promote and demote
public static ARRank get(Rel rank) { return new ARRank(rank); }
public ARRank(Rel rank)
{
this.startRank = rank;
}
//----------------------------------------------//
// FIELDS
// -------------------------------------------- //
final Rel startRank;
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public String typename()
{
return "rank";
}
@Override
public Rel select(String arg, CommandSender sender)
{
//Default it is nothing
Rel ret = null;
// This is especially useful when one rank can have aliases.
// In the case of promote/demote,
// that would require 10 lines of code repeated for each alias.
arg = this.prepareArg(arg);
switch(arg)
{
// All the normal ranks
case "leader": ret = Rel.LEADER; break;
case "officer": ret = Rel.OFFICER; break;
case "member": ret = Rel.MEMBER; break;
case "recruit": ret = Rel.RECRUIT; break;
// Promote
case "promote":
switch(startRank)
{
case LEADER : ret = Rel.LEADER; break;
case OFFICER : ret = Rel.LEADER; break;
case MEMBER : ret = Rel.OFFICER; break;
case RECRUIT : ret = Rel.MEMBER; break;
// This should not happen
default:
//This might happen of the default constrcutor is used
Mixin.msgOne(sender, Txt.parse("<b>You can't use promote & demote"));
ret = null; break;
} break;
// Demote
case "demote":
switch(startRank)
{
case LEADER : ret = Rel.OFFICER; break;
case OFFICER : ret = Rel.MEMBER; break;
case MEMBER : ret = Rel.RECRUIT; break;
case RECRUIT : ret = Rel.RECRUIT; break;
// This should not happen
default:
//This might happen of the default constrcutor is used
Mixin.msgOne(sender, Txt.parse("<b>You can't use promote & demote"));
ret = null; break;
} break;
}
return ret;
}
@Override
public Collection<String> altNames(CommandSender sender)
{
return MUtil.list(
Txt.getNicedEnum(Rel.LEADER),
Txt.getNicedEnum(Rel.OFFICER),
Txt.getNicedEnum(Rel.MEMBER),
Txt.getNicedEnum(Rel.RECRUIT),
"Promote",
"Demote");
}
// -------------------------------------------- //
// PRIVATE
// -------------------------------------------- //
private String prepareArg(String str)
{
String ret = str;
if (str.startsWith("admin") || str.startsWith("lea"))
{
ret = "leader";
}
else if (str.startsWith("mod") || str.startsWith("off"))
{
ret = "officer";
}
else if (str.startsWith("mem"))
{
ret = "member";
}
else if (str.startsWith("rec"))
{
ret = "recruit";
}
else if (str.startsWith("+") || str.startsWith("plus"))
{
ret = "promote";
}
else if (str.startsWith("-") || str.startsWith("minus"))
{
ret = "demote";
}
return ret;
}
}

View File

@ -23,7 +23,6 @@ permissions:
factions.claim.circle: {description: claim by circle and radius, default: false}
factions.claim.all: {description: claim all faction land, default: false}
factions.create: {description: create new faction, default: false}
factions.demote: {description: demote lesser members in your faction, default: false}
factions.description: {description: change faction description, default: false}
factions.disband: {description: disband faction, default: false}
factions.expansions: {description: list expansions, default: false}
@ -35,8 +34,6 @@ permissions:
factions.join.any: {description: join closed faction, default: false}
factions.join.others: {description: have another player join faction, default: false}
factions.kick: {description: kick player from faction, default: false}
factions.leader: {description: set leader for faction, default: false}
factions.leader.any: {description: set leader for another faction, default: false}
factions.leave: {description: leave your faction, default: false}
factions.list: {description: list all factions, default: false}
factions.map: {description: show territory map, default: false}
@ -49,13 +46,13 @@ permissions:
factions.money.p2f: {description: transfer p --> f, default: false}
factions.money.withdraw: {description: withdraw from faction, default: false}
factions.motd: {description: faction motd, default: false}
factions.officer: {description: make player officer, default: false}
factions.officer.any: {description: set officers for another faction, default: false}
factions.open: {description: set if invitation is required to join, default: false}
factions.perm: {description: change faction permissions, default: false}
factions.player: {description: show player information}
factions.powerboost: {description: set powerboost, default: false}
factions.promote: {description: promote lesser members in your faction, default: false}
factions.rank: {description: manage/show ranks, default: false}
factions.rank.show: {description: show rank, default: false}
factions.rank.action: {description: change rank, default: false}
factions.relation: {description: set relation wish to another faction, default: false}
factions.seechunk: {description: see the chunk you stand in, default: false}
factions.seechunkold: {description: see the chunk you stand in, default: false}
@ -208,6 +205,9 @@ permissions:
factions.perm: true
factions.player: true
factions.promote: true
factions.rank: true
factions.rank.show: true
factions.rank.action: true
factions.relation: true
factions.seechunk: true
factions.seechunkold: true