2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
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-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdPeaceful extends FCommand {
|
|
|
|
|
|
|
|
public CmdPeaceful() {
|
2014-07-01 22:10:18 +02:00
|
|
|
super();
|
|
|
|
this.aliases.add("peaceful");
|
2014-04-04 20:55:21 +02:00
|
|
|
|
|
|
|
this.requiredArgs.add("faction tag");
|
|
|
|
//this.optionalArgs.put("", "");
|
|
|
|
|
2014-07-01 22:10:18 +02:00
|
|
|
this.permission = Permission.SET_PEACEFUL.node;
|
|
|
|
this.disableOnLock = true;
|
2014-04-04 20:55:21 +02:00
|
|
|
|
2014-07-01 22:10:18 +02:00
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
2014-04-04 20:55:21 +02:00
|
|
|
senderMustBeAdmin = false;
|
|
|
|
}
|
|
|
|
|
2014-12-08 00:12:52 +01:00
|
|
|
//TODO: TL
|
2014-04-04 20:55:21 +02:00
|
|
|
@Override
|
|
|
|
public void perform() {
|
2014-07-01 22:10:18 +02:00
|
|
|
Faction faction = this.argAsFaction(0);
|
|
|
|
if (faction == null) {
|
|
|
|
return;
|
|
|
|
}
|
2014-04-04 20:55:21 +02:00
|
|
|
|
2014-07-01 22:10:18 +02:00
|
|
|
String change;
|
|
|
|
if (faction.isPeaceful()) {
|
|
|
|
change = "removed peaceful status from";
|
|
|
|
faction.setPeaceful(false);
|
2014-07-01 21:52:40 +02:00
|
|
|
} else {
|
2014-07-01 22:10:18 +02:00
|
|
|
change = "granted peaceful status to";
|
|
|
|
faction.setPeaceful(true);
|
2014-04-04 20:55:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Inform all players
|
2014-10-19 07:37:25 +02:00
|
|
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
2014-04-04 20:55:21 +02:00
|
|
|
if (fplayer.getFaction() == faction) {
|
|
|
|
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true)) + "<i> has " + change + " your faction.");
|
2014-07-01 21:52:40 +02:00
|
|
|
} else {
|
2014-04-04 20:55:21 +02:00
|
|
|
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true)) + "<i> has " + change + " the faction \"" + faction.getTag(fplayer) + "<i>\".");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-08-05 10:50:47 +02:00
|
|
|
}
|