2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-06-10 21:26:12 +02:00
|
|
|
|
2011-10-22 17:03:49 +02:00
|
|
|
import com.massivecraft.factions.Faction;
|
2011-10-09 14:53:38 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-10-25 08:27:58 +02:00
|
|
|
import com.massivecraft.factions.struct.Role;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdAutoClaim extends FCommand {
|
2014-08-05 17:17:27 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public CmdAutoClaim() {
|
2014-07-01 22:10:18 +02:00
|
|
|
super();
|
|
|
|
this.aliases.add("autoclaim");
|
2014-04-04 20:55:21 +02:00
|
|
|
|
|
|
|
//this.requiredArgs.add("");
|
|
|
|
this.optionalArgs.put("faction", "your");
|
|
|
|
|
2014-07-01 22:10:18 +02:00
|
|
|
this.permission = Permission.AUTOCLAIM.node;
|
|
|
|
this.disableOnLock = true;
|
2014-04-04 20:55:21 +02:00
|
|
|
|
2014-07-01 22:10:18 +02:00
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
2014-04-04 20:55:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
Faction forFaction = this.argAsFaction(0, myFaction);
|
|
|
|
if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
|
2014-07-01 22:10:18 +02:00
|
|
|
fme.setAutoClaimFor(null);
|
2014-12-08 00:12:52 +01:00
|
|
|
msg(TL.COMMAND_AUTOCLAIM_DISABLED);
|
2014-07-01 22:10:18 +02:00
|
|
|
return;
|
2014-04-04 20:55:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!fme.canClaimForFaction(forFaction)) {
|
2014-07-01 21:52:40 +02:00
|
|
|
if (myFaction == forFaction) {
|
2015-01-22 00:58:33 +01:00
|
|
|
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
|
2014-07-01 22:10:18 +02:00
|
|
|
} else {
|
2014-12-08 00:12:52 +01:00
|
|
|
msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
|
2014-07-01 22:10:18 +02:00
|
|
|
}
|
2014-04-04 20:55:21 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fme.setAutoClaimFor(forFaction);
|
|
|
|
|
2014-12-08 00:12:52 +01:00
|
|
|
msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
|
2014-04-04 20:55:21 +02:00
|
|
|
fme.attemptClaim(forFaction, me.getLocation(), true);
|
|
|
|
}
|
|
|
|
|
2015-01-22 00:58:33 +01:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_AUTOCLAIM_DESCRIPTION;
|
|
|
|
}
|
|
|
|
|
2011-10-22 17:03:49 +02:00
|
|
|
}
|