2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.FPlayers;
|
2011-08-05 10:50:47 +02:00
|
|
|
import com.massivecraft.factions.Faction;
|
2011-08-20 03:36:23 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
2011-10-05 12:13:54 +02:00
|
|
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public class CmdPeaceful extends FCommand
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public CmdPeaceful()
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
this.aliases.add("peaceful");
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
this.requiredArgs.add("faction tag");
|
|
|
|
//this.optionalArgs.put("", "");
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 21:57:43 +02:00
|
|
|
this.permission = Permission.SET_PEACEFUL.node;
|
|
|
|
this.disableOnLock = true;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-10-09 18:35:39 +02:00
|
|
|
public void perform()
|
|
|
|
{
|
|
|
|
Faction faction = this.argAsFaction(0);
|
|
|
|
if (faction == null) return;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
String change;
|
|
|
|
if (faction.isPeaceful())
|
|
|
|
{
|
|
|
|
change = "removed peaceful status from";
|
|
|
|
faction.setPeaceful(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
change = "granted peaceful status to";
|
|
|
|
faction.setPeaceful(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inform all players
|
|
|
|
for (FPlayer fplayer : FPlayers.i.getOnline())
|
|
|
|
{
|
|
|
|
if (fplayer.getFaction() == faction)
|
|
|
|
{
|
2011-10-21 19:20:33 +02:00
|
|
|
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" your faction.");
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
else
|
|
|
|
{
|
2011-10-21 19:20:33 +02:00
|
|
|
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true))+"<i> has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
2011-08-20 03:36:23 +02:00
|
|
|
}
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
|
|
|
|
SpoutFeatures.updateAppearances(faction);
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|