Factions/src/com/massivecraft/factions/cmd/CmdOfficer.java

60 lines
1.2 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel;
2011-10-23 17:55:53 +02:00
public class CmdOfficer extends FCommand
{
2011-10-23 17:55:53 +02:00
public CmdOfficer()
{
super();
2011-10-23 17:55:53 +02:00
this.aliases.add("officer");
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
2011-10-23 17:55:53 +02:00
this.permission = Permission.OFFICER.node;
2011-10-09 21:57:43 +02:00
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = false;
senderMustBeLeader = true;
}
@Override
public void perform()
{
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) return;
if (you.getFaction() != myFaction)
{
2011-10-21 19:20:33 +02:00
msg("%s<b> is not a member in your faction.", you.describeTo(fme, true));
return;
}
if (you == fme)
{
2011-10-10 13:40:24 +02:00
msg("<b>The target player musn't be yourself.");
return;
}
if (you.getRole() == Rel.OFFICER)
{
// Revoke
you.setRole(Rel.MEMBER);
myFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(myFaction, true));
}
else
{
// Give
you.setRole(Rel.OFFICER);
myFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(myFaction, true));
}
}
}