2011-09-13 20:14:09 +02:00
|
|
|
package com.massivecraft.factions.commands;
|
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.FPlayers;
|
2011-09-13 20:14:09 +02:00
|
|
|
import com.massivecraft.factions.Faction;
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-09-13 20:14:09 +02:00
|
|
|
|
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public class CmdPermanent extends FCommand
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-10-09 20:10:19 +02:00
|
|
|
public CmdPermanent()
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
this.aliases.add("permanent");
|
2011-09-13 20:14:09 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
this.requiredArgs.add("faction tag");
|
|
|
|
//this.optionalArgs.put("", "");
|
2011-09-13 20:14:09 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
this.permission = Permission.COMMAND_SET_PERMANENT.node;
|
2011-09-13 20:14:09 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
2011-09-13 20:14:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-10-09 18:35:39 +02:00
|
|
|
public void perform()
|
|
|
|
{
|
|
|
|
Faction faction = this.argAsFaction(0);
|
|
|
|
if (faction == null) return;
|
|
|
|
|
|
|
|
String change;
|
|
|
|
if(faction.isPermanent())
|
|
|
|
{
|
|
|
|
change = "removed permanent status from";
|
|
|
|
faction.setPermanent(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
change = "added permanent status to";
|
|
|
|
faction.setPermanent(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inform all players
|
|
|
|
for (FPlayer fplayer : FPlayers.i.getOnline())
|
|
|
|
{
|
|
|
|
if (fplayer.getFaction() == faction)
|
|
|
|
{
|
|
|
|
fplayer.sendMessageParsed(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" your faction.");
|
2011-09-13 20:14:09 +02:00
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
fplayer.sendMessageParsed(fme.getNameAndRelevant(fplayer)+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
2011-09-13 20:14:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|